diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index 9425cbc667b..72d50cebd28 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -39,7 +39,15 @@ $action = GETPOST('action','alpha');
* Actions
*/
-if ($action == 'setcoder')
+if ($action == 'setbarcodeon')
+{
+ $res=dolibarr_set_const($db, "BARCODE_ADDON_NUM", GETPOST('value'), 'chaine', 0, '', $conf->entity);
+}
+elseif ($action == 'setbarcodeoff')
+{
+ $res=dolibarr_del_const($db, "BARCODE_ADDON_NUM", $conf->entity);
+}
+else if ($action == 'setcoder')
{
$coder = GETPOST('coder','alpha');
$code_id = GETPOST('code_id','alpha');
@@ -49,33 +57,54 @@ if ($action == 'setcoder')
$sqlp.= " AND entity = ".$conf->entity;
$resql=$db->query($sqlp);
- //print $sqlp;
+ if (! $resql) dol_print_error($db);
}
-else if ($action == 'setgenbarcodelocation')
+else if ($action == 'update')
{
- $location = GETPOST('genbarcodelocation','alpha');
- $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
+ if (GETPOST('submit_GENBARCODE_LOCATION'))
+ {
+ $location = GETPOST('genbarcodelocation','alpha');
+ $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
+ }
+ if (GETPOST('submit_PRODUIT_DEFAULT_BARCODE_TYPE'))
+ {
+ $coder_id = GETPOST('PRODUIT_DEFAULT_BARCODE_TYPE','alpha');
+ $res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
+ }
+ if (GETPOST('submit_GENBARCODE_BARCODETYPE_THIRDPARTY'))
+ {
+ $coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
+ $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
+ }
}
-else if ($action == 'setdefaultbarcodetype')
-{
- $coder_id = GETPOST('coder_id','alpha');
- $res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
-}
-else if ($action == 'GENBARCODE_BARCODETYPE_THIRDPARTY')
-{
- $coder_id = GETPOST('coder_id','alpha');
- $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
-}
-/*
- else if ($_POST["action"] == 'setproductusebarcode')
- {
- dolibarr_set_const($db, "PRODUIT_USE_BARCODE",$_POST["value"],'chaine',0,'',$conf->entity);
- header("Location: barcode.php");
- exit;
- }
- */
-if($action && $action!='setcoder')
+// define constants for models generator that need parameters
+if ($action == 'setModuleOptions')
+{
+ $post_size=count($_POST);
+
+ for($i=0;$i < $post_size;$i++)
+ {
+ if (array_key_exists('param'.$i,$_POST))
+ {
+ $param=GETPOST("param".$i,'alpha');
+ $value=GETPOST("value".$i,'alpha');
+ if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
+ }
+ }
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessage($langs->trans("SetupSaved"));
+ }
+ else
+ {
+ setEventMessage($langs->trans("Error"),'errors');
+ }
+}
+
+if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
{
if (! $res > 0) $error++;
@@ -259,6 +288,10 @@ print "
";
*/
print_titre($langs->trans("OtherOptions"));
+print "
';
print "
";
$db->close();
llxFooter();
-?>
+?>
\ No newline at end of file
diff --git a/htdocs/core/modules/barcode/mod_barcode_standard.php b/htdocs/core/modules/barcode/mod_barcode_standard.php
index d1963c992f8..b543c1d3221 100644
--- a/htdocs/core/modules/barcode/mod_barcode_standard.php
+++ b/htdocs/core/modules/barcode/mod_barcode_standard.php
@@ -81,14 +81,15 @@ class mod_barcode_standard extends ModeleNumRefBarCode
$texte.= '';
$texte.= '';
- $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Product"),$langs->transnoentities("Product"));
+ $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("BarCode"),$langs->transnoentities("BarCode"));
$tooltip.=$langs->trans("GenericMaskCodes3");
$tooltip.=$langs->trans("GenericMaskCodes4c");
$tooltip.=$langs->trans("GenericMaskCodes5");
// Mask parameter
- $texte.= '| '.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'): | ';
- $texte.= ''.$form->textwithpicto('',$tooltip,1,1).' | ';
+ //$texte.= '
| '.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'): | ';
+ $texte.= '
| '.$langs->trans("Mask").': | ';
+ $texte.= ''.$form->textwithpicto('',$tooltip,1,1).' | ';
$texte.= ' | ';
$texte.= '
';
@@ -102,43 +103,24 @@ class mod_barcode_standard extends ModeleNumRefBarCode
/**
* Return an example of result returned by getNextValue
*
- * @param Translate $langs Object langs
+ * @param Translate $langs Object langs
* @param product $objproduct Object product
- * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
- * @return string Return string example
+ * @return string Return string example
*/
- function getExample($langs,$objproduct=0,$type=-1)
+ function getExample($langs,$objproduct=0)
{
- if ($type == 0 || $type == -1)
+ $examplebarcode = $this->getNextValue($objproduct,0);
+ if (! $examplebarcode)
{
- $exampleproduct = $this->getNextValue($objproduct,0);
- if (! $exampleproduct)
- {
- $exampleproduct = $langs->trans('NotConfigured');
- }
- if($exampleproduct=="ErrorBadMask")
- {
- $langs->load("errors");
- $exampleproduct=$langs->trans($exampleproduct);
- }
+ $examplebarcode = $langs->trans('NotConfigured');
}
- if ($type == 1 || $type == -1)
+ if($examplebarcode=="ErrorBadMask")
{
- $exampleservice = $this->getNextValue($objproduct,1);
- if (! $exampleservice)
- {
- $exampleservice = $langs->trans('NotConfigured');
- }
- if($exampleservice=="ErrorBadMask")
- {
- $langs->load("errors");
- $exampleservice=$langs->trans($exampleservice);
- }
+ $langs->load("errors");
+ $examplebarcode=$langs->trans($examplebarcode);
}
- if ($type == 0) return $exampleproduct;
- if ($type == 1) return $exampleservice;
- return $exampleproduct.'
'.$exampleservice;
+ return $examplebarcode;
}
/**
@@ -175,7 +157,7 @@ class mod_barcode_standard extends ModeleNumRefBarCode
return $numFinal;
}
-
+
/**
* Check if mask/numbering use prefix
*
diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php
index 6e84a65a6aa..888d714d63a 100644
--- a/htdocs/core/modules/barcode/modules_barcode.class.php
+++ b/htdocs/core/modules/barcode/modules_barcode.class.php
@@ -52,8 +52,125 @@ abstract class ModeleNumRefBarCode
{
var $error='';
+ /** Renvoi la description par defaut du modele de numerotation
+ *
+ * @param Translate $langs Object langs
+ * @return string Texte descripif
+ */
+ function info($langs)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoDescription");
+ }
+
+ /** Renvoi nom module
+ *
+ * @param Translate $langs Object langs
+ * @return string Nom du module
+ */
+ function getNom($langs)
+ {
+ return $this->nom;
+ }
+
+ /** Renvoi un exemple de numerotation
+ *
+ * @param Translate $langs Object langs
+ * @return string Example
+ */
+ function getExample($langs)
+ {
+ $langs->load("bills");
+ return $langs->trans("NoExample");
+ }
+ /**
+ * Return next value available
+ *
+ * @param Societe $objsoc Object thirdparty
+ * @param int $type Type
+ * @return string Value
+ */
+ function getNextValue($objsoc=0,$type=-1)
+ {
+ global $langs;
+ return $langs->trans("Function_getNextValue_InModuleNotWorking");
+ }
+
+ /** Return version of module
+ *
+ * @return string Version
+ */
+ function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ return $langs->trans("NotAvailable");
+ }
+
+ /**
+ * Return description of module parameters
+ *
+ * @param Translate $langs Output language
+ * @param Societe $soc Third party object
+ * @param int $type -1=Nothing, 0=Product, 1=Service
+ * @return string HTML translated description
+ */
+ function getToolTip($langs,$soc,$type)
+ {
+ global $conf;
+
+ $langs->load("admin");
+
+ $s='';
+ $s.=$langs->trans("Name").': '.$this->nom.'
';
+ $s.=$langs->trans("Version").': '.$this->getVersion().'
';
+ if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': '.$this->getNom($langs).'
';
+ $s.='
';
+ $s.=''.$langs->trans("ThisIsModuleRules").':
';
+ if ($type == 0)
+ {
+ $s.=$langs->trans("RequiredIfProduct").': ';
+ if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null,1,2);
+ if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+ $s.='
';
+ }
+ if ($type == 1)
+ {
+ $s.=$langs->trans("RequiredIfService").': ';
+ if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null,1,2);
+ if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+ $s.='
';
+ }
+ if ($type == -1)
+ {
+ $s.=$langs->trans("Required").': ';
+ if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.='';
+ $s.=yn(!$this->code_null,1,2);
+ if (! empty($conf->global->MAIN_BARCODE_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')';
+ $s.='
';
+ }
+ /*$s.=$langs->trans("CanBeModifiedIfOk").': ';
+ $s.=yn($this->code_modifiable,1,2);
+ $s.='
';
+ $s.=$langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide,1,2).'
';
+ */
+ $s.=$langs->trans("AutomaticCode").': '.yn($this->code_auto,1,2).'
';
+ $s.='
';
+
+ $nextval=$this->getNextValue($soc,0);
+ if (empty($nextval)) $nextval=$langs->trans("Undefined");
+ $s.=$langs->trans("NextValue").': '.$nextval.'
';
+
+ return $s;
+ }
+
}
?>
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index da9ac62aaf8..dfcd5c5d27c 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1325,6 +1325,7 @@ BarcodeDescC39=Barcode of type C39
BarcodeDescC128=Barcode of type C128
GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types)
BarcodeInternalEngine=Internal engine
+BarCodeNumberManager=Manager to auto define barcode numbers
##### Prelevements #####
WithdrawalsSetup=Withdrawal module setup
##### ExternalRSS #####
@@ -1366,17 +1367,6 @@ OSCommerceErrorConnectOkButWrongDatabase=Connection succeeded but database doesn
OSCommerceTestOk=Connection to server '%s' on database '%s' with user '%s' successfull.
OSCommerceTestKo1=Connection to server '%s' succeed but database '%s' could not be reached.
OSCommerceTestKo2=Connection to server '%s' with user '%s' failed.
-##### Mantis #####
-MantisSetup=Mantis link setup
-MantisURL=URL for Mantis access
-MantisServer=Server hosting Mantis database
-MantisDatabaseName=Database name
-MantisUser=User to access database
-MantisSetupSaved=Mantis setup saved successfully.
-MantisTestOk=Connection to server '%s' on database '%s' with user '%s' successfull.
-MantisTestKo1=Connection to server '%s' succeed but database '%s' could not be reached.
-MantisTestKo2=Connection to server '%s' with user '%s' failed.
-MantisErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be a Mantis database.
##### Stock #####
StockSetup=Configuration module stock
UserWarehouse=Use user personal stocks