From 917ef1e01e0f98e3914d9a9d1c1c04bacee3e44e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Mar 2017 20:34:01 +0100 Subject: [PATCH] Uniformize code --- htdocs/admin/confexped.php | 26 +++----- htdocs/admin/expedition.php | 75 +++++++++------------- htdocs/admin/expedition_extrafields.php | 2 +- htdocs/admin/expeditiondet_extrafields.php | 2 +- htdocs/admin/livraison.php | 6 +- htdocs/admin/livraison_extrafields.php | 2 +- htdocs/admin/livraisondet_extrafields.php | 2 +- 7 files changed, 46 insertions(+), 69 deletions(-) diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index 859534d53fd..0059f337752 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -94,28 +94,23 @@ print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'sending'); -/* - * Formulaire parametres divers - */ - -$var=true; +// Miscellaneous parameters print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; // expedition activation/desactivation -$var=!$var; -print ""; +print ""; print ''; -print ''; -print '"; print ''; // Bon de livraison activation/desactivation -$var=!$var; -print ''; +print ''; print ''; -print ''; -print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -250,8 +250,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - $var=true; - while (($file = readdir($handle))!==false) { if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -268,8 +266,7 @@ foreach ($dirmodels as $reldir) if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - $var=!$var; - print '\n"; + print '\n"; print ''; @@ -374,7 +371,6 @@ print "\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { foreach (array('','/doc') as $valdir) @@ -412,8 +408,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - $var = !$var; - print '
'.$langs->trans("Feature").' '.$langs->trans("Status").' '.$langs->trans("Status").'
'.$langs->trans("SendingsAbility").''; +print ''; print ''; +print ''; print $langs->trans("Required"); /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { @@ -129,15 +124,14 @@ print "
'; print $langs->trans("DeliveriesOrderAbility"); print '
'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1); print '
'; +print ''; print ''; +print ''; if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 34a561121b2..ef8b10c411f 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -72,26 +72,28 @@ if ($action == 'updateMask') } } -else if ($action == 'set_SHIPPING_FREE_TEXT') +else if ($action == 'set_param') { $freetext=GETPOST('SHIPPING_FREE_TEXT'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - - if ($res > 0) - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - else + if ($res <= 0) + { + $error++; setEventMessages($langs->trans("Error"), null, 'errors'); -} - -else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') -{ + } + $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - - if ($res > 0) - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - else + if ($res <= 0) + { + $error++; setEventMessages($langs->trans("Error"), null, 'errors'); + } + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } } else if ($action == 'specimen') @@ -222,11 +224,9 @@ print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'sending'); -/* - * Expedition numbering model - */ +// Shipment numbering model print load_fiche_titre($langs->trans("SendingsNumberingModules")); @@ -235,8 +235,8 @@ print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$module->nom."
'.$module->nom."'; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -498,19 +493,16 @@ print '
'; */ print load_fiche_titre($langs->trans("OtherOptions")); -$var=true; +print '
'; +print ''; +print ''; + print ""; print ""; print "\n"; -print '\n"; -print "\n"; print ""; -$var=! $var; -print ''; -print ''; -print ''; -print '\n"; -print ''; -$var=!$var; -print ''; -print ''; -print ''; -print '\n"; -print ''; print '
".$langs->trans("Parameter")."'.$langs->trans("Value")." 
'; +print '
'; print $langs->trans("FreeLegalTextOnShippings").' ('.$langs->trans("AddCRIfTooLong").')
'; $variablename='SHIPPING_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -523,25 +515,18 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details'); print $doleditor->Create(); } -print '
'; -print ''; print "
'; +print '
'; print $langs->trans("WatermarkOnDraft").'
'; print ''; -print '
'; -print ''; print "
'; +print '
'; + +print ''; llxFooter(); $db->close(); diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index d682f73ce6d..8c24c49cb23 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index c4d45f08ded..283eeab452a 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 42d7fa69ac8..e49f25d7ef8 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -214,12 +214,10 @@ print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), 0, 'sending'); +dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), -1, 'sending'); -/* - * Livraison numbering model - */ +// Delivery numbering model print load_fiche_titre($langs->trans("DeliveryOrderNumberingModules"),'',''); diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/livraison_extrafields.php index 71a34039084..84037ae9b80 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/livraison_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), 0, 'sending'); +dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/livraisondet_extrafields.php b/htdocs/admin/livraisondet_extrafields.php index 4679123352a..22a7e89d724 100644 --- a/htdocs/admin/livraisondet_extrafields.php +++ b/htdocs/admin/livraisondet_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), 0, 'sending'); +dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';