diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index c4ad077296a..cb97502c3f8 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -57,7 +57,7 @@ llxHeader('', $langs->trans($page_name)); // Subheader $linkback = '' . $langs->trans("BackToModuleList") . ''; -print_fiche_titre($langs->trans($page_name), $linkback); +print load_fiche_titre($langs->trans($page_name), $linkback); // Configuration header diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 86930956d1a..7a60d234405 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -38,103 +38,35 @@ $action = GETPOST('action','alpha'); /* - * Actions + * Action */ - -if($action) +if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg)) { - $db->begin(); - - if ($action == 'STOCK_SUPPORTS_SERVICES') - { - $res = dolibarr_set_const($db, "STOCK_SUPPORTS_SERVICES", GETPOST('STOCK_SUPPORTS_SERVICES','alpha'),'chaine',0,'',$conf->entity); - } - if ($action == 'STOCK_USERSTOCK_AUTOCREATE') - { - $res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity); - } - if ($action == 'STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') { - $res = dolibarr_set_const($db, "STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE", GETPOST('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE','alpha'),'chaine',0,'',$conf->entity); - } - if ($action == 'STOCK_ALLOW_NEGATIVE_TRANSFER') - { - $res = dolibarr_set_const($db, "STOCK_ALLOW_NEGATIVE_TRANSFER", GETPOST('STOCK_ALLOW_NEGATIVE_TRANSFER','alpha'),'chaine',0,'',$conf->entity); - } - // Mode of stock decrease - if ($action == 'STOCK_CALCULATE_ON_BILL' - || $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER' - || $action == 'STOCK_CALCULATE_ON_SHIPMENT' - || $action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE') - { - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", '','chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", GETPOST('STOCK_CALCULATE_ON_SHIPMENT_CLOSE','alpha'),'chaine',0,'',$conf->entity); - } - // Mode of stock increase - if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL' - || $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER' - || $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER' - || $action == 'STOCK_CALCULATE_ON_RECEPTION' - || $action == 'STOCK_CALCULATE_ON_RECEPTION_CLOSE') - { - //Use variable cause empty(GETPOST()) do not work with php version < 5.4 - $valdispatch=GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'); - - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION", '','chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION_CLOSE", '','chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_RECEPTION') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION", GETPOST('STOCK_CALCULATE_ON_RECEPTION','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_RECEPTION_CLOSE') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION_CLOSE", GETPOST('STOCK_CALCULATE_ON_RECEPTION_CLOSE','alpha'),'chaine',0,'',$conf->entity); - if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $valdispatch,'chaine',0,'',$conf->entity); - if (empty($valdispatch)) { - $res=dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", '','chaine',0,'',$conf->entity); - } - } - - if($action == 'SUPPLIER_ORDER_USE_DISPATCH_STATUS') { - $res = dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", GETPOST('SUPPLIER_ORDER_USE_DISPATCH_STATUS','alpha'),'chaine',0,'',$conf->entity); - } - - if($action == 'STOCK_USE_VIRTUAL_STOCK') { - $res = dolibarr_set_const($db, "STOCK_USE_VIRTUAL_STOCK", GETPOST('STOCK_USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity); - } - - if($action == 'STOCK_MUST_BE_ENOUGH_FOR_INVOICE') { - $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_INVOICE", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_INVOICE','alpha'),'chaine',0,'',$conf->entity); - } - if($action == 'STOCK_MUST_BE_ENOUGH_FOR_ORDER') { - $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_ORDER", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_ORDER','alpha'),'chaine',0,'',$conf->entity); - } - if($action == 'STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT') { - $res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT','alpha'),'chaine',0,'',$conf->entity); - } - if($action == 'INDEPENDANT_SUBPRODUCT_STOCK') { - $res = dolibarr_set_const($db, "INDEPENDANT_SUBPRODUCT_STOCK", GETPOST('INDEPENDANT_SUBPRODUCT_STOCK','alpha'),'chaine',0,'',$conf->entity); - } - - if (! $res > 0) $error++; - - if (! $error) + $code=$reg[1]; + if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + header("Location: ".$_SERVER["PHP_SELF"]); + exit; } else { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); + dol_print_error($db); } } +if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg)) +{ + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} /* * View @@ -165,23 +97,23 @@ print '
'; // Title rule for stock decrease print ''; print ''; -print " \n"; -print " \n"; +print "\n"; +print ''."\n"; print ''."\n"; $found=0; print ''; print ''; -print ''; print ''; -print ''; print ''; -print ''; print ''; -print '
".$langs->trans("RuleForStockManagementDecrease")." ".$langs->trans("RuleForStockManagementDecrease")."'.$langs->trans("Status").'
'.$langs->trans("DeStockOnBill").''; +print ''; if (! empty($conf->facture->enabled)) { - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); +} } else { @@ -193,15 +125,15 @@ $found++; print '
'.$langs->trans("DeStockOnValidateOrder").''; +print ''; if (! empty($conf->commande->enabled)) { - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); +} } else { @@ -215,15 +147,15 @@ $found++; print '
'.$langs->trans("DeStockOnShipment").''; +print ''; if (! empty($conf->expedition->enabled)) { - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); +} } else { @@ -235,15 +167,15 @@ $found++; print '
'.$langs->trans("DeStockOnShipmentOnClosing").''; +print ''; if (! empty($conf->expedition->enabled)) { - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT_CLOSE",$conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE,1,$disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); +} } else { @@ -267,23 +199,23 @@ print '
'; // Title rule for stock increase print ''; print ''; -print " \n"; -print " \n"; +print "\n"; +print ''."\n"; print ''."\n"; $found=0; print ''; print ''; -print ''; print ''; -print ''; print ''; - print '\n\n"; $found++; @@ -332,15 +264,14 @@ if (!empty($conf->reception->enabled)) print ''; print ''; - print '\n\n"; $found++; } @@ -348,15 +279,15 @@ else { print ''; print ''; - print '
".$langs->trans("RuleForStockManagementIncrease")." ".$langs->trans("RuleForStockManagementIncrease")."'.$langs->trans("Status").'
'.$langs->trans("ReStockOnBill").''; +print ''; if (! empty($conf->fournisseur->enabled)) { - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); +} } else { @@ -296,15 +228,15 @@ $found++; print '
'.$langs->trans("ReStockOnValidateOrder").''; +print ''; if (! empty($conf->fournisseur->enabled)) { - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); +} } else { @@ -317,14 +249,14 @@ if (!empty($conf->reception->enabled)) { print '
'.$langs->trans("StockOnReception").''; + print ''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_RECEPTION", $conf->global->STOCK_CALCULATE_ON_RECEPTION, 1, $disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); +} print "
'.$langs->trans("StockOnReceptionOnClosing").''; - - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE, 1, $disabled); - print ''; - print "
\n"; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); +} print "
'.$langs->trans("ReStockOnDispatchOrder").''; + print ''; if (! empty($conf->fournisseur->enabled)) { - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); +} } else { @@ -379,20 +310,20 @@ print '
'; print '
'; print ''; print ''; -print " \n"; -print " \n"; +print "\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print '\n"; print "\n"; @@ -401,13 +332,13 @@ if($conf->invoice->enabled) { print ''; print ''; - print '\n"; print "\n"; } @@ -416,13 +347,13 @@ if($conf->order->enabled) { print ''; print ''; - print '\n"; print "\n"; } @@ -431,13 +362,13 @@ if($conf->expedition->enabled) { print ''; print ''; - print '\n"; print "\n"; } @@ -452,21 +383,21 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) if ($virtualdiffersfromphysical) { - print '
".$langs->trans("RuleForStockAvailability")." ".$langs->trans("RuleForStockAvailability")."'.$langs->trans("Status").'
'.$langs->trans("WarehouseAllowNegativeTransfer").''; -print "
"; -print ''; -print ""; -print $form->selectyesno("STOCK_ALLOW_NEGATIVE_TRANSFER",$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER,1); -print ''; -print '
'; +print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_ALLOW_NEGATIVE_TRANSFER'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_ALLOW_NEGATIVE_TRANSFER", $arrval, $conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER); +} print "
'.$langs->trans("StockMustBeEnoughForInvoice").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); - print ''; - print '
'; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE); +} print "
'.$langs->trans("StockMustBeEnoughForOrder").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1); - print ''; - print '
'; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER); +} print "
'.$langs->trans("StockMustBeEnoughForShipment").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1); - print ''; - print '
'; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT); +} print "
'; - print ''; - print " \n"; - print " \n"; +print '
".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))." 
'; +print ''; + print "\n"; + print ''."\n"; print ''."\n"; print ''; print ''; - print '\n"; print "\n"; print '
".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."'.$langs->trans("Status").'
'.$langs->trans("UseVirtualStockByDefault").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_USE_VIRTUAL_STOCK",$conf->global->STOCK_USE_VIRTUAL_STOCK,1); - print ''; - print '
'; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); +} print "
'; @@ -477,19 +408,19 @@ if ($virtualdiffersfromphysical) print ''; print ''; -print " \n"; -print " \n"; +print "\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print '\n"; print "\n"; @@ -497,25 +428,25 @@ print ''; print ''; -print '\n"; print "\n"; print ''; print ''; -print '\n"; print "\n"; @@ -524,12 +455,12 @@ if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULAT print ''; print ''; print '\n\n"; } @@ -541,46 +472,43 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print '
".$langs->trans("Other")." ".$langs->trans("Other")."'.$langs->trans("Status").'
'.$langs->trans("UserWarehouseAutoCreate").''; -print "
"; -print ''; -print ""; -print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1); -print ''; -print '
'; +print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_USERSTOCK_AUTOCREATE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_USERSTOCK_AUTOCREATE", $arrval, $conf->global->STOCK_USERSTOCK_AUTOCREATE); +} print "
'; print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); print ''; -print "
"; -print ''; -print ""; -print $form->selectyesno("STOCK_SUPPORTS_SERVICES",$conf->global->STOCK_SUPPORTS_SERVICES,1); -print ''; -print '
'; +print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_SUPPORTS_SERVICES'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, $conf->global->STOCK_SUPPORTS_SERVICES); +} print "
'.$langs->trans("AllowAddLimitStockByWarehouse").''; -print "
"; -print ''; -print ""; -print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1); -print ''; -print '
'; +print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE", $arrval, $conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE); +} print "
'.$langs->trans("UseDispatchStatus").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1); - print ''; - print "
\n"; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("SUPPLIER_ORDER_USE_DISPATCH_STATUS", $arrval, $conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS); +} print "
'; print ''; print ''."\n"; - print ''; - print ''."\n"; + print ''."\n"; + print ''."\n"; // Example with a yes / no select print ''; print ''; - print ''; - print ''; // Example with a yes / no select print ''; print ''; - print ''; - print ''; // Example with a yes / no select print ''; print ''; - print ''; - print ''; print '
'.$langs->trans("Inventory").'  '.$langs->trans("Status").'
'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").' '; - print '
'; - print ''; - print ''; - print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1); - print ''; - print '
'; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVENTORY_DISABLE_VIRTUAL'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL); +} print '
'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").' '; - print '
'; - print ''; - print ''; - print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1); - print ''; - print '
'; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVENTORY_USE_MIN_PA_IF_NO_LAST_PA'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA); +} print '
'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").' '; - print '
'; - print ''; - print ''; - print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1); - print ''; - print '
'; + print '
'; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT); +} print '
'; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 5cf72b302c9..86f6250cede 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -253,7 +253,7 @@ dol_fiche_end(); * Projects Numbering model */ -print_titre($langs->trans("TicketNumberingModules")); +print load_fiche_titre($langs->trans("TicketNumberingModules")); print ''; print ''; @@ -353,7 +353,7 @@ if (!$conf->use_javascript_ajax) { print ''; print ''; } -print_titre($langs->trans("TicketParamPublicInterface")); +print load_fiche_titre($langs->trans("TicketParamPublicInterface")); print '
'; @@ -422,7 +422,7 @@ print ''; print '

'; -print_titre($langs->trans("TicketParams")); +print load_fiche_titre($langs->trans("TicketParams")); print ''; // Activate email notifications @@ -515,7 +515,7 @@ if (!$conf->use_javascript_ajax) { } // Admin var of module -print_titre($langs->trans("TicketParamMail")); +print load_fiche_titre($langs->trans("TicketParamMail")); print '
'; diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index 6fa70808ec8..f63af3d2a82 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -92,7 +92,7 @@ if ($action != 'create' && $action != 'edit') { if ($action == 'create') { print "
"; - print_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php'; } @@ -104,7 +104,7 @@ if ($action == 'create') { /* ************************************************************************** */ if ($action == 'edit' && !empty($attrname)) { print "
"; - print_titre($langs->trans("FieldEdition", $attrname)); + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php'; } diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index f0188c5ed94..86e963e50df 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -463,7 +463,7 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print "
"; - print_fiche_titre( $langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); + print load_fiche_titre( $langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); $sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,"; $sql.= " pct.code as payment_code,"; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 936c2c9c0f2..8dc443aee6b 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -405,7 +405,7 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print "
"; - print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); + print load_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); $sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index c40710ceb56..50c6b1e1b50 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -682,7 +682,7 @@ else // Jabber if (! empty($conf->global->SOCIALNETWORKS_JABBER)) { - print ''; + print ''; print ''; } // Skype @@ -968,7 +968,7 @@ else // Jabber ID if (! empty($conf->global->SOCIALNETWORKS_JABBER)) { - print ''; + print ''; print ''; } // Skype diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d7d896f023c..99d6d377f9c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -39,48 +39,6 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php'; -/** - * Function to return value of a static property when class - * name is dynamically defined (not hard coded). - * This is because $myclass::$myvar works from PHP 5.3.0+ only - * - * @param string $class Class name - * @param string $member Name of property - * @return mixed Return value of static property - * @deprecated Dolibarr now requires 5.3.0+, use $class::$property syntax - * @see https://php.net/manual/language.oop5.static.php - */ -function getStaticMember($class, $member) -{ - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); - - // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member - /*if (version_compare(phpversion(), '5.3.0', '<')) - { - if (is_object($class)) $class = get_class($class); - $classObj = new ReflectionClass($class); - $result = null; - - $found=0; - foreach($classObj->getStaticProperties() as $prop => $value) - { - if ($prop == $member) - { - $result = $value; - $found++; - break; - } - } - - if ($found) return $result; - }*/ - - if (isset($class::$member)) return $class::$member; - dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); - return null; -} - - /** * Return a DoliDB instance (database handler). * diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 15ab669bd9a..af8c99c3fc7 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -47,7 +47,7 @@ print ''; - print_fiche_titre($langs->trans("AdvTgtTitle")); + print load_fiche_titre($langs->trans("AdvTgtTitle")); print '
' . "\n"; print '
' . "\n"; @@ -520,7 +520,7 @@ print '
jabberid).'">
jabberid).'">