';
// Amount
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 912c9953229..37a39e7d1f0 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -219,7 +219,7 @@ if ($action == "update_extras" && !empty($permissiontoadd))
$object->array_options['options_'.$attributekey] = dol_mktime(GETPOST($attributekeylong.'hour', 'int'), GETPOST($attributekeylong.'min', 'int'), GETPOST($attributekeylong.'sec', 'int'), GETPOST($attributekeylong.'month', 'int'), GETPOST($attributekeylong.'day', 'int'), GETPOST($attributekeylong.'year', 'int'));
//var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit;
} else {
- $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, ' alpha');
+ $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha');
}
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 7fc42512baf..9894d2e6c64 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5531,11 +5531,12 @@ abstract class CommonObject
$new_array_options[$key] = null;
}
break;
- case 'double':
+ case 'price':
+ case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value != '')
{
- dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
+ dol_syslog($langs->trans("ExtraFieldHasWrongValue")." for ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
@@ -5589,9 +5590,6 @@ abstract class CommonObject
$new_array_options[$key] = $this->array_options[$key];
}
break;
- case 'price':
- $new_array_options[$key] = price2num($this->array_options[$key]);
- break;
case 'date':
case 'datetime':
// If data is a string instead of a timestamp, we convert it
@@ -5689,7 +5687,7 @@ abstract class CommonObject
{
if (!isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
{
- if (in_array($tmpval, array('int', 'double'))) $sql .= ", 0";
+ if (in_array($tmpval, array('int', 'double', 'price'))) $sql .= ", 0";
else $sql .= ", ''";
}
}
@@ -7050,7 +7048,7 @@ abstract class CommonObject
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
{
$out .= "\n";
- $out .= ' ';
+ $out .= ' ';
$out .= "\n";
$extrafields_collapse_num = '';
@@ -7188,7 +7186,7 @@ abstract class CommonObject
// HTML, select, integer and text add default value
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
{
- if ($action == 'create') $value = $extrafields->attributes[$this->table_element]['default'][$key];
+ if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
else $value = $this->array_options['options_'.$key];
}
@@ -7272,7 +7270,7 @@ abstract class CommonObject
setListDependencies();
});
'."\n";
- $out .= ' '."\n";
+ $out .= ' '."\n";
}
}
return $out;
@@ -7970,11 +7968,11 @@ abstract class CommonObject
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
$keys = array();
- $values = array();
+ $values = array(); // Array to store string forged for SQL syntax
foreach ($fieldvalues as $k => $v) {
$keys[$k] = $k;
$value = $this->fields[$k];
- $values[$k] = $this->quote($v, $value);
+ $values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null
}
// Clean and check mandatory
@@ -7984,8 +7982,7 @@ abstract class CommonObject
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
- //var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
- if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
+ if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && (!isset($values[$key]) || $values[$key] === 'NULL') && is_null($this->fields[$key]['default']))
{
$error++;
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php
index 8d9c449b972..09dcc3681b7 100644
--- a/htdocs/core/class/dolreceiptprinter.class.php
+++ b/htdocs/core/class/dolreceiptprinter.class.php
@@ -468,6 +468,26 @@ class dolReceiptPrinter extends Printer
return $error;
}
+ /**
+ * Function to delete a printer template in db
+ *
+ * @param int $templateid Template ID
+ * @return int 0 if OK; >0 if KO
+ */
+ public function deleteTemplate($templateid)
+ {
+ global $conf;
+ $error = 0;
+ $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
+ $sql .= " WHERE rowid = ".((int) $this->db->escape($templateid));
+ $sql .= " AND entity = ".$conf->entity;
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->errors[] = $this->db->lasterror;
+ }
+ return $error;
+ }
/**
* Function to Update a printer template in db
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 90fc879bd17..eecb5b54330 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -154,8 +154,8 @@ class ExtraFields
public static $type2label = array(
- 'varchar'=>'String',
- 'text'=>'TextLong',
+ 'varchar'=>'String1Line',
+ 'text'=>'TextLongNLines',
'html'=>'HtmlText',
'int'=>'Int',
'double'=>'Float',
@@ -2098,6 +2098,10 @@ class ExtraFields
{
$value_key = GETPOST("options_".$key, 'alpha');
}
+ elseif (in_array($key_type, array('text')))
+ {
+ $value_key = GETPOST("options_".$key, 'alphanohtml');
+ }
else
{
$value_key = GETPOST("options_".$key);
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 9c4e2526249..14db0028606 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2743,9 +2743,9 @@ class Form
$outval .= ' - '.$langs->transnoentities("VirtualStock").':';
if ($virtualstock > 0) {
- $outval .= ' - ';
+ $outval .= '';
}elseif ($virtualstock <= 0) {
- $outval .= ' - ';
+ $outval .= '';
}
$outval .= $virtualstock;
$outval .= '';
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index 3fc3151030a..f20fcbcd5b9 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -546,7 +546,10 @@ class Translate
{
global $conf, $db;
- if (!is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
+ if (!is_string($key)) {
+ //xdebug_print_function_stack('ErrorBadValueForParamNotAString');
+ return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
+ }
$newstr = $key;
if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg))
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 967849d775a..91a3061dd41 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -601,7 +601,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('"', '../'), '', trim($out));
- $out = dol_string_nohtmltag($out, 1);
+ $out = dol_string_nohtmltag($out, 0);
}
break;
case 'restricthtml': // Recommended for most html textarea
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 99c9a1002a5..8b51df3368f 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -234,12 +234,14 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
!empty($conf->ficheinter->enabled)
) ? 1 : 0,
'perms'=>(!empty($user->rights->propal->lire) ||
- !empty($user->rights->commande->lire) ||
- !empty($user->rights->fournisseur->lire) ||
- !empty($user->rights->supplier_proposal->lire) ||
- !empty($user->rights->supplier_order->lire) ||
- !empty($user->rights->contrat->lire) ||
- !empty($user->rights->ficheinter->lire)
+ !empty($user->rights->commande->lire) ||
+ !empty($user->rights->fournisseur->lire) ||
+ !empty($user->rights->supplier_proposal->lire) ||
+ !empty($user->rights->supplier_order->lire) ||
+ !empty($user->rights->contrat->lire) ||
+ !empty($user->rights->ficheinter->lire) ||
+ !empty($user->rights->supplier_order->lire) ||
+ !empty($user->rights->fournisseur->commande->lire)
),
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
);
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
index 80a7cac7de3..191b4cf40c8 100644
--- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
@@ -186,8 +186,10 @@ elseif (($type == 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($
?>
trans("LabelOrTranslationKey"); ?>
+
trans("AttributeCode"); ?>
+
trans("Type"); ?>
array('varchar', 'phone', 'mail', 'url', 'select'),
'select'=>array('varchar', 'phone', 'mail', 'url', 'select')
);
+/* Disabled because text is text on several lines, when varchar is text on 1 line, we should not be able to convert
+if ($size <= 255 && in_array($type, array('text', 'html'))) {
+ $typewecanchangeinto['text'][] = 'varchar';
+}*/
if (in_array($type, array_keys($typewecanchangeinto)))
{
@@ -225,8 +231,10 @@ else
}
?>
diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php
index d6ebb8b919f..6e1dae186b1 100644
--- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php
+++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php
@@ -43,7 +43,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
{
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
$morecss = '';
- if (in_array($typeofextrafield, array('link', 'sellist'))) $morecss = 'maxwidth200';
+ if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) $morecss = 'maxwidth200';
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
}
print '';
diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql
index 2a7a8963e9f..83a502dbbff 100644
--- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql
+++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql
@@ -98,7 +98,7 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
-ALTER TABLE llx_bom_bomline DROP COLUMN rank;
+ALTER TABLE llx_bom_bomline DROP COLUMN `rank`;
create table llx_categorie_warehouse
(
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index c99c436915d..bd957f0ca02 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -409,7 +409,9 @@ PriceBaseTypeToChange=Modify on prices with base reference value defined on
MassConvert=Launch bulk conversion
PriceFormatInCurrentLanguage=Price Format In Current Language
String=String
+String1Line=String (1 line)
TextLong=Long text
+TextLongNLines=Long text (n lines)
HtmlText=Html text
Int=Integer
Float=Float
@@ -544,9 +546,9 @@ Module54Desc=Management of contracts (services or recurring subscriptions)
Module55Name=Barcodes
Module55Desc=Barcode management
Module56Name=Payment by credit transfer
-Module56Desc=Management of payment of suppliers by credit transfer orders. It includes generation of SEPA file for European countries.
-Module57Name=Bank Direct Debit payments
-Module57Desc=Management of Direct Debit payment orders. It includes generation of SEPA file for European countries.
+Module56Desc=Management of payment of suppliers by Credit Transfer orders. It includes generation of SEPA file for European countries.
+Module57Name=Payments by Direct Debit
+Module57Desc=Management of Direct Debit orders. It includes generation of SEPA file for European countries.
Module58Name=ClickToDial
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
Module59Name=Bookmark4u
@@ -2006,3 +2008,6 @@ RssNote=Note: Each RSS feed definition provides a widget that you must enable to
JumpToBoxes=Jump to Setup -> Widgets
MeasuringUnitTypeDesc=Use here a value like "size", "surface", "volume", "weight", "time"
MeasuringScaleDesc=The scale is the number of places you have to move the decimal part to match the default reference unit. For "time" unit type, it is the number of seconds. Values between 80 and 99 are reserved values.
+TemplateAdded=Template added
+TemplateUpdated=Template updated
+TemplateDeleted=Template deleted
\ No newline at end of file
diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang
index c7d7dd95cb7..ce5cdaf4ba6 100644
--- a/htdocs/langs/en_US/cashdesk.lang
+++ b/htdocs/langs/en_US/cashdesk.lang
@@ -117,3 +117,4 @@ HideCategoryImages=Hide Category Images
HideProductImages=Hide Product Images
NumberOfLinesToShow=Number of lines of images to show
DefineTablePlan=Define tables plan
+ModuleReceiptPrinterMustBeEnabled=Module Receipt printer must have been enabled first
diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang
index 446de9e09d3..d05f2663cfc 100644
--- a/htdocs/langs/fr_FR/withdrawals.lang
+++ b/htdocs/langs/fr_FR/withdrawals.lang
@@ -77,7 +77,7 @@ StatusMotif8=Autre motif
CreateForSepaFRST=Créer fichier de prélèvement (SEPA FRST)
CreateForSepaRCUR=Créer fichier de prélèvement (SEPA RCUR)
CreateAll=Créer le fichier de prélèvement (tout)
-CreateFileForPaymentByBankTransfer=Créer un virement (tout)
+CreateFileForPaymentByBankTransfer=Créer un fichier de virement
CreateSepaFileForPaymentByBankTransfer=Créer un fichier de virement (SEPA)
CreateGuichet=Seulement guichet
CreateBanque=Seulement banque
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index d557dd90392..4dd4c7b3420 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -565,7 +565,7 @@ class Product extends CommonObject
return -1;
}
- if (empty($this->ref)) {
+ if (empty($this->ref) || $this->ref == 'auto') {
// Load object modCodeProduct
$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard');
if ($module != 'mod_codeproduct_leopard') // Do not load module file for leopard
@@ -3603,7 +3603,7 @@ class Product extends CommonObject
$sql = "SELECT sum(d.qty), date_format(d.date_valid, '%Y%m')";
if ($mode == 'bynumber') {
- $sql .= ", count(DISTINCT c.rowid)";
+ $sql .= ", count(DISTINCT d.rowid)";
}
$sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as d LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
if ($filteronproducttype >= 0) {
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index 47c3ac9d1b5..f5121ea0089 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -659,8 +659,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
$urlsource .= str_replace('&', '&', $param);
$filedir = $diroutputmassaction;
- $genallowed = $user->rights->mymodule->read;
- $delallowed = $user->rights->mymodule->create;
+ $genallowed = $user->rights->stock->read;
+ $delallowed = $user->rights->stock->create;
print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 1fb01bb52bb..587493709f2 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -180,14 +180,14 @@ if (empty($reshook))
if ($result < 0)
{
$langs->load("errors");
- setEventMessages($langs->trans($object->error), null, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
else
{
$langs->load("errors");
- setEventMessages($langs->trans($object->error), null, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
if (!$error && !empty($object->id) > 0)
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index e3d6409ddd6..6c8ab008252 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2798,7 +2798,7 @@ class Societe extends CommonObject
* Return bank number property of thirdparty (label or rum)
*
* @param string $mode 'label' or 'rum' or 'format'
- * @return string Bank number
+ * @return string Bank label or RUM or '' if no bank account found
*/
public function display_rib($mode = 'label')
{
@@ -2808,27 +2808,31 @@ class Societe extends CommonObject
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $this->id);
- if ($mode == 'label')
- {
- return $bac->getRibLabel(true);
- }
- elseif ($mode == 'rum')
- {
- if (empty($bac->rum))
+ if ($bac->id > 0) { // If a bank account has been found for company $this->id
+ if ($mode == 'label')
{
- require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
- $prelevement = new BonPrelevement($this->db);
- $bac->fetch_thirdparty();
- $bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id);
+ return $bac->getRibLabel(true);
}
- return $bac->rum;
+ elseif ($mode == 'rum')
+ {
+ if (empty($bac->rum))
+ {
+ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
+ $prelevement = new BonPrelevement($this->db);
+ $bac->fetch_thirdparty();
+ $bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id);
+ }
+ return $bac->rum;
+ }
+ elseif ($mode == 'format')
+ {
+ return $bac->frstrecur;
+ } else {
+ return 'BadParameterToFunctionDisplayRib';
+ }
+ } else {
+ return '';
}
- elseif ($mode == 'format')
- {
- return $bac->frstrecur;
- }
-
- return 'BadParameterToFunctionDisplayRib';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php
index 3d4bd490dde..b6a06dee9fb 100644
--- a/htdocs/takepos/admin/bar.php
+++ b/htdocs/takepos/admin/bar.php
@@ -105,14 +105,16 @@ print "\n";
if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") {
print '