diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 3434c5c1d93..8b561e4065f 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -126,18 +126,7 @@ if ($_GET["action"] == 'specimenfacture') if ($_GET["action"] == 'set') { - $type='supplier_order'; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; - if ($db->query($sql)) - { - - } -} - -if ($_GET["action"] == 'setfacture') -{ - $type='supplier_invoice'; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$_GET["type"]."',".$conf->entity.")"; if ($db->query($sql)) { @@ -146,23 +135,9 @@ if ($_GET["action"] == 'setfacture') if ($_GET["action"] == 'del') { - $type='supplier_order'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " WHERE nom = '".$_GET["value"]."'"; - $sql.= " AND type = '".$type."'"; - $sql.= " AND entity = ".$conf->entity; - if ($db->query($sql)) - { - - } -} - -if ($_GET["action"] == 'delfacture') -{ - $type='supplier_invoice'; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql.= " WHERE nom = '".$_GET["value"]."'"; - $sql.= " AND type = '".$type."'"; + $sql.= " AND type = '".$_GET["type"]."'"; $sql.= " AND entity = ".$conf->entity; if ($db->query($sql)) { @@ -174,19 +149,24 @@ if ($_GET["action"] == 'setdoc') { $db->begin(); - if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) + if ($_GET["type"] == 'supplier_order' && dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) { $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $_GET["value"]; } + + if ($_GET["type"] == 'supplier_invoice' && dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) + { + $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $_GET["value"]; + } // On active le modele $type='supplier_order'; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql_del.= " WHERE nom = '".$_GET["value"]."'"; - $sql_del.= " AND type = '".$type."'"; + $sql_del.= " AND type = '".$_GET["type"]."'"; $sql_del.= " AND entity = ".$conf->entity; $result1=$db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$_GET["type"]."',".$conf->entity.")"; $result2=$db->query($sql); if ($result1 && $result2) { @@ -198,35 +178,6 @@ if ($_GET["action"] == 'setdoc') } } -if ($_GET["action"] == 'setdocfacture') -{ - $db->begin(); - - if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) - { - $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $_GET["value"]; - } - - // On active le modele - $type='supplier_invoice'; - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql_del.= " WHERE nom = '".$_GET["value"]."'"; - $sql_del.= " AND type = '".$type."'"; - $sql_del.= " AND entity = ".$conf->entity; - $result1=$db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; - $result2=$db->query($sql); - if ($result1 && $result2) - { - $db->commit(); - } - else - { - $db->rollback(); - } -} - - if ($_GET["action"] == 'setmod') { // \todo Verifier si module numerotation choisi peut etre active @@ -381,14 +332,14 @@ else dol_print_error($db); } -print "\n"; -print "\n"; -print ' \n"; -print " \n"; -print '\n"; -print '\n"; +print '
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Status")."'.$langs->trans("Default")."
'."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; print ''; -print "\n"; +print ''."\n"; clearstatcache(); @@ -413,10 +364,10 @@ while (($file = readdir($handle))!==false) // Active if (in_array($name, $def)) { - print ""; } // Defaut - print "'; @@ -502,19 +453,19 @@ else dol_print_error($db); } -print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("Info").'
\n"; + print ''."\n"; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") { - print ''; + print ''; print img_picto($langs->trans("Enabled"),'on'); print ''; } @@ -428,20 +379,20 @@ while (($file = readdir($handle))!==false) } else { - print "\n"; - print ''.img_picto($langs->trans("Disabled"),'off').''; + print ''."\n"; + print ''.img_picto($langs->trans("Disabled"),'off').''; print ""; + print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"),'on'); } else { - print ''.img_picto($langs->trans("Disabled"),'on').''; + print ''.img_picto($langs->trans("Disabled"),'on').''; } print '
\n"; -print "\n"; -print ' \n"; -print " \n"; -print '\n"; -print '\n"; +print '
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Status")."'.$langs->trans("Default")."
'."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; print ''; -print "\n"; +print ''."\n"; clearstatcache(); $handle=opendir($dir); - +print 'xxx='.$conf->global->INVOICE_SUPPLIER_ADDON_PDF; $var=true; while (($file = readdir($handle))!==false) { @@ -537,7 +488,7 @@ while (($file = readdir($handle))!==false) print ""; } @@ -562,7 +513,7 @@ while (($file = readdir($handle))!==false) } else { - print ''.img_picto($langs->trans("Disabled"),'on').''; + print ''.img_picto($langs->trans("Disabled"),'on').''; } print ''; diff --git a/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php index 3d0d400077e..41ebb1211f6 100755 --- a/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php @@ -65,7 +65,8 @@ class ModelePDFSuppliersInvoices */ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs) { - global $langs; + global $conf, $langs; + $langs->load("suppliers"); $dir = DOL_DOCUMENT_ROOT."/includes/modules/supplier_invoice/pdf/";
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("Info").'
\n"; if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") { - print ''; + print ''; print img_picto($langs->trans("Enabled"),'on'); print ''; } @@ -550,7 +501,7 @@ while (($file = readdir($handle))!==false) else { print "\n"; - print ''.img_picto($langs->trans("Disabled"),'off').''; + print ''.img_picto($langs->trans("Disabled"),'off').''; print "