/[dolibarr]/dolibarr/htdocs/admin/expedition.php
ViewVC logotype

Diff of /dolibarr/htdocs/admin/expedition.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by eldy, Sat Jul 9 01:16:31 2005 UTC revision 1.17 by rodolphe, Sun Jul 31 09:16:53 2005 UTC
# Line 46  $expedition_default = EXPEDITION_ADDON; Line 46  $expedition_default = EXPEDITION_ADDON;
46   */   */
47  if ($_GET["action"] == 'set')  if ($_GET["action"] == 'set')
48  {  {
49      $file = DOL_DOCUMENT_ROOT . '/expedition/mods/methode_expedition_'.$_GET["value"].'.modules.php';    $file = DOL_DOCUMENT_ROOT . '/expedition/mods/methode_expedition_'.$_GET["value"].'.modules.php';
   
     $classname = 'methode_expedition_'.$_GET["value"];  
     require_once($file);  
   
     $obj = new $classname();  
   
     // Mise a jour statut  
     $sql = "UPDATE ".MAIN_DB_PREFIX."expedition_methode set status='".$_GET["statut"]."'";  
     $sql.= " WHERE rowid = ".$obj->id;  
     print "$sql";  
     exit;  
   
     Header("Location: expedition.php");  
50    
51      $classname = 'methode_expedition_'.$_GET["value"];
52      require_once($file);
53      
54      $obj = new $classname($db);
55      
56      $obj->Active($_GET["statut"]);
57      
58      Header("Location: expedition.php");
59  }  }
60    
61  if ($_GET["action"] == 'setpdf')  if ($_GET["action"] == 'setpdf')
# Line 71  if ($_GET["action"] == 'setpdf') Line 66  if ($_GET["action"] == 'setpdf')
66      $resql=$db->query($sql);      $resql=$db->query($sql);
67      if ($resql)      if ($resql)
68      {      {
69          $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON_PDF','".$_GET["value"]."',0)";        $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON_PDF','".$_GET["value"]."',0)";
70          $resql=$db->query($sql);        $resql=$db->query($sql);
71          if ($resql)        if ($resql)
72          {          {
73              // la constante qui a été lue en avant du nouveau set            // la constante qui a été lue en avant du nouveau set
74              // on passe donc par une variable pour avoir un affichage cohérent            // on passe donc par une variable pour avoir un affichage cohérent
75              $expedition_addon_var_pdf = $value;            $expedition_addon_var_pdf = $value;
76              
77              $db->commit();            $db->commit();
78                    
79              Header("Location: ".$_SERVER["PHP_SELF"]);            Header("Location: ".$_SERVER["PHP_SELF"]);
80              exit;            exit;
81          }          }
82          else        else
83          {          {
84              $db->rollback();            $db->rollback();
85              dolibarr_print_error($db);            dolibarr_print_error($db);
86          }          }
87      }      }
88      else      else
89      {        {
90          $db->rollback();          $db->rollback();
91          dolibarr_print_error($db);          dolibarr_print_error($db);
92      }        }
93  }  }
94    
95  if ($_GET["action"] == 'setdef')  if ($_GET["action"] == 'setdef')
96  {  {
97      $db->begin();    $db->begin();
98      
99      $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON';";    $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON';";
100      $resql=$db->query($sql);    $resql=$db->query($sql);
101      if ($resql)    if ($resql)
102      {      {
103          $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON','".$_GET["value"]."',0)";        $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON','".$_GET["value"]."',0)";
104          $resql=$db->query($sql);        $resql=$db->query($sql);
105          if ($resql)        if ($resql)
106          {          {
107              // la constante qui a été lue en avant du nouveau set            // la constante qui a été lue en avant du nouveau set
108              // on passe donc par une variable pour avoir un affichage cohérent            // on passe donc par une variable pour avoir un affichage cohérent
109              $expedition_default = $_GET["value"];            $expedition_default = $_GET["value"];
110              $db->commit();            $db->commit();
111              
112              Header("Location: ".$_SERVER["PHP_SELF"]);            Header("Location: ".$_SERVER["PHP_SELF"]);
113              exit;            exit;
114          }          }
115          else        else
116          {          {
117              $db->rollback();            $db->rollback();
118              dolibarr_print_error($db);            dolibarr_print_error($db);
119          }          }
120      }      }
121      else    else
122      {      {
123          $db->rollback();        $db->rollback();
124          dolibarr_print_error($db);        dolibarr_print_error($db);
125      }      }
126  }  }
127    
   
128  /*  /*
129   *   *
130   */   */
131    
132  llxHeader();  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE statut = 1";
133    $db->fetch_all_rows($sql, $mods);
134    
135    llxHeader();
136    
137  $dir = DOL_DOCUMENT_ROOT."/expedition/mods/";  $dir = DOL_DOCUMENT_ROOT."/expedition/mods/";
138    
   
139  // Méthode de livraison  // Méthode de livraison
140    
141  print_titre($langs->trans("SendingsSetup"));  print_titre($langs->trans("SendingsSetup"));
# Line 152  print_titre($langs->trans("SendingMethod Line 147  print_titre($langs->trans("SendingMethod
147  print '<table class="noborder" width="100%">';  print '<table class="noborder" width="100%">';
148  print '<tr class="liste_titre">';  print '<tr class="liste_titre">';
149  print '<td width="140">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>';  print '<td width="140">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>';
150  print '<td align="center" colspan="2">'.$langs->trans("Active").'</td>';  print '<td align="center">&nbsp;</td>';
151    print '<td align="center">'.$langs->trans("Active").'</td>';
152  print '<td align="center">'.$langs->trans("Default").'</td>';  print '<td align="center">'.$langs->trans("Default").'</td>';
153  print "</tr>\n";  print "</tr>\n";
154    
155  if(is_dir($dir)) {  if(is_dir($dir)) {
156      $handle=opendir($dir);    $handle=opendir($dir);
157      $var=true;    $var=true;
158          
159      while (($file = readdir($handle))!==false)    while (($file = readdir($handle))!==false)
160      {      {
161          if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_')        if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_')
162          {          {
163              $name = substr($file, 19, strlen($file) - 31);            $name = substr($file, 19, strlen($file) - 31);
164              $classname = substr($file, 0, strlen($file) - 12);            $classname = substr($file, 0, strlen($file) - 12);
165              
166              require_once($dir.$file);            require_once($dir.$file);
167              
168              $obj = new $classname();            $obj = new $classname();
169              
170              $var=!$var;            $var=!$var;
171              print "<tr $bc[$var]><td>";            print "<tr $bc[$var]><td>";
172              echo $obj->name;            echo $obj->name;
173              print "</td><td>\n";            print "</td><td>\n";
174              
175              print $obj->description;            print $obj->description;
176              
177              print '</td><td align="center">';            print '</td><td align="center">';
178    
179              if (in_array($obj->id, $mods))
180              print "&nbsp;";              {
181              print "</td><td>\n";                print img_tick();
182              print '<a href="expedition.php?action=set&amp;statut=1&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';                print '</td><td align="center">';
183                  print '<a href="expedition.php?action=set&amp;statut=0&amp;value='.$name.'">'.$langs->trans("Disable").'</a>';
184    
185              print '</td>';              }
186              else
187                {
188                  print '&nbsp;</td><td align="center">';
189                  print '<a href="expedition.php?action=set&amp;statut=1&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
190                }
191                      
192              print '</td>';
193                            
194              // Default            // Default
195              print '<td align="center">';            print '<td align="center">';
196              if ($expedition_default == "$name")            if ($expedition_default == "$name")
197              {              {
198                  print img_tick();                print img_tick();
199              }              }
200              else            else
201              {              {
202                  print '<a href="expedition.php?action=setdef&amp;value='.$name.'">'.$langs->trans("Default").'</a>';                print '<a href="expedition.php?action=setdef&amp;value='.$name.'">'.$langs->trans("Default").'</a>';
203              }              }
204              print '</td>';            print '</td>';          
205              print '</tr>';
             print '</tr>';  
206          }          }
207      }      }
208      closedir($handle);      closedir($handle);
# Line 229  $dir = DOL_DOCUMENT_ROOT."/expedition/mo Line 231  $dir = DOL_DOCUMENT_ROOT."/expedition/mo
231    
232  if(is_dir($dir))  if(is_dir($dir))
233  {  {
234      $handle=opendir($dir);    $handle=opendir($dir);
235      $var=true;    $var=true;
236      
237      while (($file = readdir($handle))!==false)      while (($file = readdir($handle))!==false)
238      {        {
239          if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')          if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
240          {            {
241              $name = substr($file, 15, strlen($file) - 27);              $name = substr($file, 15, strlen($file) - 27);
242              $classname = substr($file, 0, strlen($file) - 12);              $classname = substr($file, 0, strlen($file) - 12);
243                
244              $var=!$var;              $var=!$var;
245              print "<tr $bc[$var]><td>";              print "<tr $bc[$var]><td>";
246              print $name;              print $name;

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26