Fix: correctin pb sur choix model commandes
This commit is contained in:
parent
b481cde348
commit
023933c412
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2004 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2004 Andre Cianfarani <acianfa@free.fr>
|
||||||
@ -41,70 +41,52 @@ if (!$user->admin)
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
// positionne la variable pour le test d'affichage de l'icone
|
|
||||||
|
|
||||||
$commande_addon_var = COMMANDE_ADDON;
|
|
||||||
$commande_addon_var_pdf = COMMANDE_ADDON_PDF;
|
|
||||||
$commande_rib_number_var = COMMANDE_RIB_NUMBER;
|
|
||||||
|
|
||||||
$commande_addon_var = COMMANDE_ADDON;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_GET["action"] == 'setmod')
|
if ($_GET["action"] == 'setmod')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'COMMANDE_ADDON' ;";
|
dolibarr_set_const($db,'COMMANDE_ADDON',$_GET["value"]);
|
||||||
$db->query($sql);
|
|
||||||
$sql = '';
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
|
||||||
('COMMANDE_ADDON','".$_GET["value"]."',0) ; ";
|
|
||||||
|
|
||||||
if ($db->query($sql))
|
|
||||||
{
|
|
||||||
// la constante qui a été lue en avant du nouveau set
|
|
||||||
// on passe donc par une variable pour avoir un affichage cohérent
|
|
||||||
$commande_addon_var = $_GET["value"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($_GET["action"] == 'set')
|
if ($_GET["action"] == 'set')
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
||||||
|
$resql=$db->query($sql);
|
||||||
if ($db->query($sql))
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$propale_addon_var_pdf = $conf->global->PROPALE_ADDON_PDF;
|
|
||||||
if ($_GET["action"] == 'setpdf')
|
if ($_GET["action"] == 'setpdf')
|
||||||
{
|
{
|
||||||
|
dolibarr_set_const($db,'COMMANDE_ADDON_PDF',$_GET["value"]);
|
||||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"]))
|
|
||||||
$commande_addon_var_pdf = $_GET["value"];
|
|
||||||
|
|
||||||
// On active le modele
|
// On active le modele
|
||||||
$sql_del = "delete from ".MAIN_DB_PREFIX."commande_model_pdf where nom = '".$_GET["value"]."';";
|
$sql_del = "delete from ".MAIN_DB_PREFIX."commande_model_pdf where nom = '".$_GET["value"]."';";
|
||||||
$db->query($sql_del);
|
$resql=$db->query($sql_del);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')";
|
||||||
if ($db->query($sql))
|
$resql=$db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($_GET["action"] == 'del')
|
if ($_GET["action"] == 'del')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_model_pdf WHERE nom='".$_GET["value"]."'";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_model_pdf WHERE nom='".$_GET["value"]."'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
if ($db->query($sql))
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
/*
|
||||||
$propale_addon_var_pdf = $conf->global->PROPALE_ADDON_PDF;
|
* Affichage page
|
||||||
|
*/
|
||||||
|
|
||||||
$dir = "../includes/modules/commande/";
|
$dir = "../includes/modules/commande/";
|
||||||
|
|
||||||
@ -116,9 +98,9 @@ print_titre($langs->trans("OrdersNumberingModules"));
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>';
|
print '<td width="100">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td>'.$langs->trans("Example").'</td>';
|
print '<td>'.$langs->trans("Example").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Activated").'</td>';
|
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
@ -148,7 +130,7 @@ if ($handle)
|
|||||||
print $modCommande->getExample();
|
print $modCommande->getExample();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($commande_addon_var == "$file")
|
if ($conf->global->COMMANDE_ADDON == "$file")
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print img_tick();
|
print img_tick();
|
||||||
@ -171,14 +153,14 @@ print '</table>';
|
|||||||
* PDF
|
* PDF
|
||||||
*/
|
*/
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre("Modèles de commande pdf");
|
print_titre($langs->trans("OrdersModelModule"));
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||||
print "<tr class=\"liste_titre\">\n";
|
print "<tr class=\"liste_titre\">\n";
|
||||||
print " <td width=\"140\">".$langs->trans("Name")."</td>\n";
|
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||||
print " <td>".$langs->trans("Description")."</td>\n";
|
print " <td>".$langs->trans("Description")."</td>\n";
|
||||||
print ' <td align="center" colspan="2">'.$langs->trans("Activated")."</td>\n";
|
print ' <td align="center" width="100">'.$langs->trans("Activated")."</td>\n";
|
||||||
print ' <td align="center">'.$langs->trans("Default")."</td>\n";
|
print ' <td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
@ -192,8 +174,8 @@ if ($resql)
|
|||||||
$num_rows=$db->num_rows($resql);
|
$num_rows=$db->num_rows($resql);
|
||||||
while ($i < $num_rows)
|
while ($i < $num_rows)
|
||||||
{
|
{
|
||||||
$array = $db->fetch_array($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
array_push($def, $array[0]);
|
array_push($def, $obj->nom);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +189,6 @@ while (($file = readdir($handle))!==false)
|
|||||||
{
|
{
|
||||||
if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
|
if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
|
||||||
{
|
{
|
||||||
$var = !$var;
|
|
||||||
$name = substr($file, 4, strlen($file) -16);
|
$name = substr($file, 4, strlen($file) -16);
|
||||||
$classname = substr($file, 0, strlen($file) -12);
|
$classname = substr($file, 0, strlen($file) -12);
|
||||||
|
|
||||||
@ -220,30 +201,34 @@ while (($file = readdir($handle))!==false)
|
|||||||
|
|
||||||
print $obj->description;
|
print $obj->description;
|
||||||
|
|
||||||
print "</td>\n <td align=\"center\">\n";
|
print "</td>\n";
|
||||||
|
|
||||||
|
// Activé
|
||||||
|
print "<td align=\"center\">\n";
|
||||||
if (in_array($name, $def))
|
if (in_array($name, $def))
|
||||||
{
|
{
|
||||||
print img_tick();
|
print img_tick().' ';
|
||||||
print "</td>\n <td>";
|
if ($conf->global->COMMANDE_ADDON_PDF != "$name")
|
||||||
|
{
|
||||||
print '<a href="commande.php?action=del&value='.$name.'">'.$langs->trans("Disable").'</a>';
|
print '<a href="commande.php?action=del&value='.$name.'">'.$langs->trans("Disable").'</a>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print " ";
|
|
||||||
print "</td>\n <td>";
|
|
||||||
print '<a href="commande.php?action=set&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
print '<a href="commande.php?action=set&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</td>\n <td align=\"center\">";
|
print "</td>\n";
|
||||||
|
|
||||||
if ($commande_addon_var_pdf == "$name")
|
// Defaut
|
||||||
|
print "<td align=\"center\">";
|
||||||
|
if ($conf->global->COMMANDE_ADDON_PDF == "$name")
|
||||||
{
|
{
|
||||||
print img_tick();
|
print img_tick();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="commande.php?action=setpdf&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
print '<a href="commande.php?action=setpdf&value='.$name.'">'.$langs->trans("Default").'</a>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -181,7 +181,7 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||||
print "<td colspan=\"2\">".$commande->statuts[$commande->statut]."</td>\n";
|
print "<td colspan=\"2\">".$commande->getLibStatut(4)."</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user