diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 3b3a3002687..1a858ba6947 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2011 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -34,9 +34,6 @@ require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'); $langs->load("admin"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("orders"); if (!$user->admin) accessforbidden(); @@ -57,12 +54,23 @@ if ($action == 'updateMask') { $maskconstorder=$_POST['maskconstorder']; $maskorder=$_POST['maskorder']; - if ($maskconstorder) dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); + if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } if ($action == 'specimen') // For orders { - $modele=$_GET["module"]; + $modele=GETPOST("module"); $commande = new CommandeFournisseur($db); $commande->initAsSpecimen(); @@ -99,7 +107,7 @@ if ($action == 'specimen') // For orders if ($action == 'specimenfacture') // For invoices { - $modele=$_GET["module"]; + $modele=GETPOST("module"); $facture = new FactureFournisseur($db); $facture->initAsSpecimen(); @@ -216,7 +224,19 @@ if ($action == 'addcat') if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') { - dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$_POST["SUPPLIER_INVOICE_FREE_TEXT"],'chaine',0,'',$conf->entity); + $free = GETPOST("SUPPLIER_INVOICE_FREE_TEXT"); + $res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$free,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } /* * View @@ -282,18 +302,22 @@ foreach ($conf->file->dol_document_root as $dirroot) // Show example of numbering module print ''; $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); + if (preg_match('/^Error/',$tmp)) + { + $langs->load("errors"); + print $langs->trans($tmp); + } else print $tmp; print ''."\n"; print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file") { - print img_picto($langs->trans("Activated"),'on'); + print img_picto($langs->trans("Activated"),'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"),'off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } print ''; @@ -414,19 +438,19 @@ foreach ($conf->file->dol_document_root as $dirroot) if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") { print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'; - print img_picto($langs->trans("Enabled"),'on'); + print img_picto($langs->trans("Enabled"),'switch_on'); print ''; } else { - print img_picto($langs->trans("Enabled"),'on'); + print img_picto($langs->trans("Enabled"),'switch_on'); } print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -546,19 +570,19 @@ foreach ($conf->file->dol_document_root as $dirroot) if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") { print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'; - print img_picto($langs->trans("Enabled"),'on'); + print img_picto($langs->trans("Enabled"),'switch_on'); print ''; } else { - print img_picto($langs->trans("Enabled"),'on'); + print img_picto($langs->trans("Enabled"),'switch_on'); } print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -618,5 +642,9 @@ print '' print "\n"; print ''; +dol_htmloutput_mesg($mesg); + +$db->close(); + llxFooter(); ?>