test.zip -l 10 -p tmp/
- // with -l is the range of dot to go back in path.
- // and path_traversal_archiver.py found at https://github.com/Alamot/code-snippets/blob/master/path_traversal/path_traversal_archiver.py
- for ($i = 0; $i < $zip->numFiles; $i++) {
- if (preg_match('/\.\./', $zip->getNameIndex($i))) {
- dol_syslog("Warning: Try to unzip a file with a transversal path ".$zip->getNameIndex($i), LOG_WARNING);
- continue; // Discard the file
- }
- $zip->extractTo($outputdir.'/', array($zip->getNameIndex($i)));
+ return array('error'=>'ErrNoZipEngine');
+ } elseif (in_array($fileinfo["extension"], array('gz', 'bz2', 'zst'))) {
+ include_once DOL_DOCUMENT_ROOT."/core/class/utils.class.php";
+ $utils = new Utils($db);
+
+ dol_mkdir(dol_sanitizePathName($outputdir));
+ $outputfilename = escapeshellcmd(dol_sanitizePathName($outputdir).'/'.dol_sanitizeFileName($fileinfo["filename"]));
+ dol_delete_file($outputfilename.'.tmp');
+ dol_delete_file($outputfilename.'.err');
+
+ $extension = strtolower(pathinfo($fileinfo["filename"], PATHINFO_EXTENSION));
+ if ($extension == "tar") {
+ $cmd = 'tar -C '.escapeshellcmd(dol_sanitizePathName($outputdir)).' -xvf '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"]));
+
+ $resarray = $utils->executeCLI($cmd, $outputfilename.'.tmp', 0, $outputfilename.'.err', 0);
+ if ($resarray["result"] != 0) {
+ $resarray["error"] .= file_get_contents($outputfilename.'.err');
}
-
- $zip->close();
- return array();
} else {
- return array('error'=>'ErrUnzipFails');
+ $program = "";
+ if ($fileinfo["extension"] == "gz") {
+ $program = 'gzip';
+ } elseif ($fileinfo["extension"] == "bz2") {
+ $program = 'bzip2';
+ } elseif ($fileinfo["extension"] == "zst") {
+ $program = 'zstd';
+ } else {
+ return array('error'=>'ErrorBadFileExtension');
+ }
+ $cmd = $program.' -dc '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"]));
+ $cmd .= ' > '.$outputfilename;
+
+ $resarray = $utils->executeCLI($cmd, $outputfilename.'.tmp', 0, null, 1, $outputfilename.'.err');
+ if ($resarray["result"] != 0) {
+ $errfilecontent = @file_get_contents($outputfilename.'.err');
+ if ($errfilecontent) {
+ $resarray["error"] .= " - ".$errfilecontent;
+ }
+ }
}
+ return $resarray["result"] != 0 ? array('error' => $resarray["error"]) : array();
}
- return array('error'=>'ErrNoZipEngine');
+ return array('error'=>'ErrorBadFileExtension');
}
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 2792b6d9997..c963c74c8b6 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -507,7 +507,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// BorderTableActive
- /* Disabled because not supported by md theme
if ($foruserprofile) {
} else {
$default = $langs->trans('No');
@@ -525,7 +524,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '';
print '';
}
- */
// Background color THEME_ELDY_BACKBODY
if ($foruserprofile) {
diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php
index c101001af4c..17b5a9bb16a 100644
--- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php
+++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php
@@ -176,7 +176,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value if OK, '' if module not configured, <0 if KO
*/
- public function getNextValue($objproduct = null, $type = '')
+ public function getNextValue($objproduct, $type = '')
{
global $db, $conf;
diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php
index c7a69a82caa..ef34b145e52 100644
--- a/htdocs/core/modules/facture/mod_facture_mars.php
+++ b/htdocs/core/modules/facture/mod_facture_mars.php
@@ -150,7 +150,7 @@ class mod_facture_mars extends ModeleNumRefFactures
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
- * @return string Value
+ * @return string Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $invoice, $mode = 'next')
{
diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php
index 621bb8e6d2d..7a572615a21 100644
--- a/htdocs/core/modules/facture/mod_facture_mercure.php
+++ b/htdocs/core/modules/facture/mod_facture_mercure.php
@@ -171,7 +171,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
$this->error = $numFinal;
}
- return $numFinal;
+ return $numFinal;
}
diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php
index 55f6dd816d1..9660be93266 100644
--- a/htdocs/core/modules/facture/mod_facture_terre.php
+++ b/htdocs/core/modules/facture/mod_facture_terre.php
@@ -185,7 +185,7 @@ class mod_facture_terre extends ModeleNumRefFactures
* @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
- * @return string Next ref value or last ref if $mode is 'last'
+ * @return string Next ref value or last ref if $mode is 'last', <= 0 if KO
*/
public function getNextValue($objsoc, $invoice, $mode = 'next')
{
@@ -259,6 +259,8 @@ class mod_facture_terre extends ModeleNumRefFactures
} else {
dol_print_error('', 'Bad parameter for getNextValue');
}
+
+ return 0;
}
/**
diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php
index e188f66b1ad..480c532cc1f 100644
--- a/htdocs/core/modules/facture/modules_facture.php
+++ b/htdocs/core/modules/facture/modules_facture.php
@@ -132,10 +132,11 @@ abstract class ModeleNumRefFactures
* Renvoi prochaine valeur attribuee
*
* @param Societe $objsoc Objet societe
- * @param Facture $facture Objet facture
+ * @param Facture $invoice Objet facture
+ * @param string $mode 'next' for next value or 'last' for last value
* @return string Value
*/
- public function getNextValue($objsoc, $facture)
+ public function getNextValue($objsoc, $invoice, $mode = 'next')
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php
index 8cf79227d4f..185ef4cf73b 100644
--- a/htdocs/core/modules/fichinter/modules_fichinter.php
+++ b/htdocs/core/modules/fichinter/modules_fichinter.php
@@ -122,9 +122,11 @@ abstract class ModeleNumRefFicheinter
/**
* Return the next assigned value
*
- * @return string Value
+ * @param Societe $objsoc Object thirdparty
+ * @param Object $object Object we need next value for
+ * @return string Value if KO, <0 if KO
*/
- public function getNextValue()
+ public function getNextValue($objsoc = 0, $object = '')
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
index 84d6638a27e..a1647a67953 100644
--- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php
+++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
@@ -117,11 +117,11 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
/**
* Return next value
*
- * @param Societe $user user object
+ * @param Societe $objsoc third party object
* @param Object $holiday holiday object
* @return string Value if OK, 0 if KO
*/
- public function getNextValue($user, $holiday)
+ public function getNextValue($objsoc, $holiday)
{
global $db, $conf;
@@ -134,7 +134,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
return 0;
}
- $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $user, $holiday->date_create);
+ $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $objsoc, $holiday->date_create);
return $numFinal;
}
diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php
index 65b08f4bba8..7b6e13ea992 100644
--- a/htdocs/core/modules/holiday/modules_holiday.php
+++ b/htdocs/core/modules/holiday/modules_holiday.php
@@ -126,10 +126,10 @@ class ModelNumRefHolidays
* Return next value
*
* @param Societe $objsoc third party object
- * @param Object $contract contract object
- * @return string Value
+ * @param Object $holiday Holiday object
+ * @return string Value if OK, 0 if KO
*/
- public function getNextValue($objsoc, $contract)
+ public function getNextValue($objsoc, $holiday)
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 947dd3d18d3..e45630df298 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -324,7 +324,8 @@ class ImportCsv extends ModeleImports
//dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid);
//var_dump($array_match_file_to_database);
- //var_dump($arrayrecord);
+ //var_dump($arrayrecord); exit;
+
$array_match_database_to_file = array_flip($array_match_file_to_database);
$sort_array_match_file_to_database = $array_match_file_to_database;
ksort($sort_array_match_file_to_database);
@@ -367,12 +368,15 @@ class ImportCsv extends ModeleImports
//dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]);
}
- // array of fields to column index
+ // Define array to convert fields ('c.ref', ...) into column index (1, ...)
$arrayfield = array();
foreach ($sort_array_match_file_to_database as $key => $val) {
$arrayfield[$val] = ($key - 1);
}
+ // $arrayrecord start at key 0
+ // $sort_array_match_file_to_database start at key 1
+
// Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom)
foreach ($sort_array_match_file_to_database as $key => $val) {
$fieldalias = preg_replace('/\..*$/i', '', $val);
@@ -595,9 +599,24 @@ class ImportCsv extends ModeleImports
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
$modForNumber = new $classModForNumber;
- $defaultref = $modForNumber->getNextValue(null, null);
+
+ $tmpobject = null;
+ // Set the object when we can
+ if (!empty($objimport->array_import_convertvalue[0][$val]['classobject'])) {
+ $pathForObject = $objimport->array_import_convertvalue[0][$val]['pathobject'];
+ require_once DOL_DOCUMENT_ROOT.$pathForObject;
+ $tmpclassobject = $objimport->array_import_convertvalue[0][$val]['classobject'];
+ $tmpobject = new $tmpclassobject($this->db);
+ foreach ($arrayfield as $tmpkey => $tmpval) { // $arrayfield is array('c.ref'=>0, ...)
+ if (in_array($tmpkey, array('t.date', 'c.date_commande'))) {
+ $tmpobject->date = dol_stringtotime($arrayrecord[$arrayfield[$tmpkey]]['val'], 1);
+ }
+ }
+ }
+
+ $defaultref = $modForNumber->getNextValue(null, $tmpobject);
}
- if (is_numeric($defaultref) && $defaultref <= 0) {
+ if (is_numeric($defaultref) && $defaultref <= 0) { // If error
$defaultref = '';
}
$newval = $defaultref;
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index 3747e8f6847..9fa5cbf2c44 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -367,7 +367,8 @@ class ImportXlsx extends ModeleImports
//dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid);
//var_dump($array_match_file_to_database);
- //var_dump($arrayrecord);
+ //var_dump($arrayrecord); exit;
+
$array_match_database_to_file = array_flip($array_match_file_to_database);
$sort_array_match_file_to_database = $array_match_file_to_database;
ksort($sort_array_match_file_to_database);
@@ -410,12 +411,15 @@ class ImportXlsx extends ModeleImports
//dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]);
}
- // array of fields to column index
+ // Define array to convert fields ('c.ref', ...) into column index (1, ...)
$arrayfield = array();
foreach ($sort_array_match_file_to_database as $key => $val) {
- $arrayfield[$val] = ($key - 1);
+ $arrayfield[$val] = ($key);
}
+ // $arrayrecord start at key 1
+ // $sort_array_match_file_to_database start at key 1
+
// Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom)
foreach ($sort_array_match_file_to_database as $key => $val) {
$fieldalias = preg_replace('/\..*$/i', '', $val);
@@ -619,7 +623,7 @@ class ImportXlsx extends ModeleImports
$this->thirpartyobject->get_codecompta('supplier');
$newval = $this->thirpartyobject->code_compta_fournisseur;
if (empty($newval)) {
- $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
+ $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
}
//print 'code_compta_fournisseur='.$newval;
}
@@ -636,9 +640,24 @@ class ImportXlsx extends ModeleImports
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
$modForNumber = new $classModForNumber;
- $defaultref = $modForNumber->getNextValue(null, null);
+
+ $tmpobject = null;
+ // Set the object with the date property when we can
+ if (!empty($objimport->array_import_convertvalue[0][$val]['classobject'])) {
+ $pathForObject = $objimport->array_import_convertvalue[0][$val]['pathobject'];
+ require_once DOL_DOCUMENT_ROOT.$pathForObject;
+ $tmpclassobject = $objimport->array_import_convertvalue[0][$val]['classobject'];
+ $tmpobject = new $tmpclassobject($this->db);
+ foreach ($arrayfield as $tmpkey => $tmpval) { // $arrayfield is array('c.ref'=>1, ...)
+ if (in_array($tmpkey, array('t.date', 'c.date_commande'))) {
+ $tmpobject->date = dol_stringtotime($arrayrecord[$arrayfield[$tmpkey]]['val'], 1);
+ }
+ }
+ }
+
+ $defaultref = $modForNumber->getNextValue(null, $tmpobject);
}
- if (is_numeric($defaultref) && $defaultref <= 0) {
+ if (is_numeric($defaultref) && $defaultref <= 0) { // If error
$defaultref = '';
}
$newval = $defaultref;
diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php
index d8ba1f98146..9aac30fe8a5 100644
--- a/htdocs/core/modules/modCommande.class.php
+++ b/htdocs/core/modules/modCommande.class.php
@@ -196,10 +196,10 @@ class modCommande extends DolibarrModules
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country',
'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id",
'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate",
- 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.remise_percent'=>"GlobalDiscount", 'c.total_ht'=>"TotalHT",
+ 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.total_ht'=>"TotalHT",
'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate',
'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin',
- 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.label'=>"Label", 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct',
+ 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct',
'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC",
'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel'
);
@@ -220,7 +220,7 @@ class modCommande extends DolibarrModules
//$this->export_TypeFields_array[$r]=array(
// 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label',
// 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",
- // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",
+ // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.total_ht'=>"Numeric",
// 'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",
// 'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",
// 'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text'
@@ -228,7 +228,7 @@ class modCommande extends DolibarrModules
$this->export_TypeFields_array[$r] = array(
's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text',
's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date",
- 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric",
+ 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric",
'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text',
'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric",
'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text',
@@ -238,8 +238,8 @@ class modCommande extends DolibarrModules
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company',
'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order",
'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order",
- 'c.remise_percent'=>"order", 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order",
- 'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.label'=>"order_line", 'cd.description'=>"order_line",
+ 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order",
+ 'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line",
'cd.product_type'=>'order_line', 'cd.tva_tx'=>"order_line", 'cd.qty'=>"order_line", 'cd.total_ht'=>"order_line", 'cd.total_tva'=>"order_line",
'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'
);
@@ -296,18 +296,17 @@ class modCommande extends DolibarrModules
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields');
$this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id
+ $import_sample = array();
$this->import_fields_array[$r] = array(
'c.ref' => 'Ref*',
'c.ref_client' => 'RefCustomer',
'c.fk_soc' => 'ThirdPartyName*',
'c.fk_projet' => 'ProjectId',
'c.date_creation' => 'DateCreation',
- 'c.date_valid' => 'DateValid',
- 'c.date_commande' => 'DateOrder',
+ 'c.date_valid' => 'DateValidation',
+ 'c.date_commande' => 'OrderDate*',
'c.fk_user_modif' => 'ModifiedById',
'c.fk_user_valid' => 'ValidatedById',
- 'c.fk_statut' => 'Status*',
- 'c.remise_percent' => 'GlobalDiscount',
'c.total_tva' => 'TotalTVA',
'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC',
@@ -317,7 +316,8 @@ class modCommande extends DolibarrModules
'c.date_livraison' => 'DeliveryDate',
'c.fk_cond_reglement' => 'Payment Condition',
'c.fk_mode_reglement' => 'Payment Mode',
- 'c.model_pdf' => 'Model'
+ 'c.model_pdf' => 'Model',
+ 'c.fk_statut' => 'Status*'
);
if (!empty($conf->multicurrency->enabled)) {
@@ -327,51 +327,48 @@ class modCommande extends DolibarrModules
$this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
$this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
-
- // Add extra fields
$import_extrafield_sample = array();
- $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande' AND entity IN (0, ".$conf->entity.")";
- $resql = $this->db->query($sql);
+ $keyforselect = 'commande';
+ $keyforelement = 'order';
+ $keyforaliasextra = 'extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
- if ($resql) {
- while ($obj = $this->db->fetch_object($resql)) {
- $fieldname = 'extra.'.$obj->name;
- $fieldlabel = ucfirst($obj->label);
- $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
- $import_extrafield_sample[$fieldname] = $fieldlabel;
- }
- }
- // End add extra fields
-
- $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande'];
- $this->import_regex_array[$r] = [
+ $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande');
+ $this->import_regex_array[$r] = array(
'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
- ];
-
- $this->import_updatekeys_array[$r] = ['c.ref' => 'Ref'];
- $this->import_convertvalue_array[$r] = [
- 'c.fk_soc' => [
+ );
+ $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
+ $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref');
+ $this->import_convertvalue_array[$r] = array(
+ 'c.ref' => array(
+ 'rule'=>'getrefifauto',
+ 'class'=>(empty($conf->global->COMMANDE_ADDON) ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON),
+ 'path'=>"/core/modules/commande/".(empty($conf->global->COMMANDE_ADDON) ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON).'.php',
+ 'classobject'=>'Commande',
+ 'pathobject'=>'/commande/class/commande.class.php',
+ ),
+ 'c.fk_soc' => array(
'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php',
'class' => 'Societe',
'method' => 'fetch',
'element' => 'ThirdParty'
- ],
- 'c.fk_user_valid' => [
+ ),
+ 'c.fk_user_valid' => array(
'rule' => 'fetchidfromref',
'file' => '/user/class/user.class.php',
'class' => 'User',
'method' => 'fetch',
'element' => 'user'
- ],
- 'c.fk_mode_reglement' => [
+ ),
+ 'c.fk_mode_reglement' => array(
'rule' => 'fetchidfromcodeorlabel',
'file' => '/compta/paiement/class/cpaiement.class.php',
'class' => 'Cpaiement',
'method' => 'fetch',
'element' => 'cpayment'
- ],
- ];
+ ),
+ );
//Import CPV Lines
$r++;
@@ -381,15 +378,13 @@ class modCommande extends DolibarrModules
$this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields');
$this->import_fields_array[$r] = array(
- 'cd.fk_commande' => 'SalesOrder*',
- 'cd.fk_parent_line' => 'PrParentLine',
+ 'cd.fk_commande' => 'CustomerOrder*',
+ 'cd.fk_parent_line' => 'ParentLine',
'cd.fk_product' => 'IdProduct',
- 'cd.label' => 'Label',
'cd.description' => 'LineDescription',
'cd.tva_tx' => 'LineVATRate',
'cd.qty' => 'LineQty',
'cd.remise_percent' => 'Reduc. Percent',
- 'cd.remise' => 'Reduc.',
'cd.price' => 'Price',
'cd.subprice' => 'Sub Price',
'cd.total_ht' => 'LineTotalHT',
@@ -410,17 +405,11 @@ class modCommande extends DolibarrModules
$this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
- // Add extra fields
- $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")";
- $resql = $this->db->query($sql);
- if ($resql) {
- while ($obj = $this->db->fetch_object($resql)) {
- $fieldname = 'extra.'.$obj->name;
- $fieldlabel = ucfirst($obj->label);
- $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
- }
- }
- // End add extra fields
+ $import_extrafield_sample = array();
+ $keyforselect = 'commandedet';
+ $keyforelement = 'orderline';
+ $keyforaliasextra = 'extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commandedet'];
$this->import_regex_array[$r] = [
diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php
index 72838e92079..b64ecca6cc1 100644
--- a/htdocs/core/modules/modFacture.class.php
+++ b/htdocs/core/modules/modFacture.class.php
@@ -276,7 +276,7 @@ class modFacture extends DolibarrModules
'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text',
'none.rest'=>"NumericCompute",
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',
- 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric",
+ 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric",
'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date",
'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text',
$alias_product_perentity . '.accountancy_code_sell'=>'Text',
@@ -289,7 +289,7 @@ class modFacture extends DolibarrModules
$this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company',
's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company',
- 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.label'=>"invoice_line", 'fd.description'=>"invoice_line",
+ 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.description'=>"invoice_line",
'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line",
'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line',
'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product',
diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php
index befeb143ec9..708cd1fb408 100644
--- a/htdocs/core/modules/modFournisseur.class.php
+++ b/htdocs/core/modules/modFournisseur.class.php
@@ -612,7 +612,13 @@ class modFournisseur extends DolibarrModules
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = array('f.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array(
- //'c.ref'=>array('rule'=>'getrefifauto'),
+ 'f.ref' => array(
+ 'rule'=>'getrefifauto',
+ 'class'=>(empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER) ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER),
+ 'path'=>"/core/modules/supplier_invoice/".(empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER) ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER).'.php',
+ 'classobject'=>'FactureFournisseur',
+ 'pathobject'=>'/fourn/class/fournisseur.facture.class.php',
+ ),
'f.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
'f.fk_account' => array('rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'),
);
@@ -626,9 +632,8 @@ class modFournisseur extends DolibarrModules
$this->import_tables_array[$r] = array('fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields');
$this->import_fields_array[$r] = array(
'fd.fk_facture_fourn' => 'InvoiceRef*',
- 'fd.fk_parent_line' => 'FacParentLine',
+ 'fd.fk_parent_line' => 'ParentLine',
'fd.fk_product' => 'IdProduct',
- 'fd.label' => 'Label',
'fd.description' => 'LineDescription',
'fd.pu_ht' => 'PriceUHT',
'fd.pu_ttc' => 'PriceUTTC',
@@ -670,7 +675,6 @@ class modFournisseur extends DolibarrModules
'fd.fk_facture_fourn' => '(PROV001)',
'fd.fk_parent_line' => '',
'fd.fk_product' => '',
- 'fd.label' => '',
'fd.description' => 'Test Product',
'fd.pu_ht' => '50000',
'fd.pu_ttc' => '50000',
@@ -720,7 +724,6 @@ class modFournisseur extends DolibarrModules
'c.source' => 'Source',
'c.fk_statut' => 'Status*',
'c.billed' => 'Billed(0/1)',
- 'c.remise_percent' => 'GlobalDiscount',
'c.total_tva' => 'TotalTVA',
'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC',
@@ -762,6 +765,13 @@ class modFournisseur extends DolibarrModules
$this->import_updatekeys_array[$r] = array('c.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array(
+ 'c.ref' => array(
+ 'rule'=>'getrefifauto',
+ 'class'=>(empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER) ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER),
+ 'path'=>"/core/modules/supplier_order/".(empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER) ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER).'.php',
+ 'classobject'=>'CommandeFournisseur',
+ 'pathobject'=>'/fourn/class/fournisseur.commande.class.php',
+ ),
'c.fk_soc' => array(
'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php',
@@ -788,14 +798,12 @@ class modFournisseur extends DolibarrModules
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields');
$this->import_fields_array[$r] = array(
'cd.fk_commande' => 'PurchaseOrder*',
- 'cd.fk_parent_line' => 'PrParentLine',
+ 'cd.fk_parent_line' => 'ParentLine',
'cd.fk_product' => 'IdProduct',
- 'cd.label' => 'Label',
'cd.description' => 'LineDescription',
'cd.tva_tx' => 'LineVATRate',
'cd.qty' => 'LineQty',
'cd.remise_percent' => 'Reduc. Percent',
- 'cd.remise' => 'Reduc.',
'cd.subprice' => 'Sub Price',
'cd.total_ht' => 'LineTotalHT',
'cd.total_tva' => 'LineTotalVAT',
diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php
index 3e75f8efcd5..bd81f06dae7 100644
--- a/htdocs/core/modules/modHRM.class.php
+++ b/htdocs/core/modules/modHRM.class.php
@@ -214,28 +214,28 @@ class modHRM extends DolibarrModules
$r++;
// Evaluation
- $this->rights[$r][0] = 4020; // Permission id (must not be already used)
+ $this->rights[$r][0] = 4021; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->read)
$r++;
- $this->rights[$r][0] = 4021; // Permission id (must not be already used)
+ $this->rights[$r][0] = 4022; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify your evaluation'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->write)
$r++;
- $this->rights[$r][0] = 4022; // Permission id (must not be already used)
+ $this->rights[$r][0] = 4023; // Permission id (must not be already used)
$this->rights[$r][1] = 'Validate evaluation'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation_advance';
$this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->validate)
$r++;
- $this->rights[$r][0] = 4023; // Permission id (must not be already used)
+ $this->rights[$r][0] = 4025; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation';
@@ -243,12 +243,28 @@ class modHRM extends DolibarrModules
$r++;
// Comparison
- $this->rights[$r][0] = 4030; // Permission id (must not be already used)
+ $this->rights[$r][0] = 4028; // Permission id (must not be already used)
$this->rights[$r][1] = 'See comparison menu'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'compare_advance';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read)
$r++;
+
+ // Read employee
+ $this->rights[$r][0] = 4031; // Permission id (must not be already used)
+ $this->rights[$r][1] = 'Read personal information'; // Permission label
+ $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
+ $this->rights[$r][4] = 'read_personal_information';
+ $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_personal_information->read)
+ $r++;
+
+ // Write employee
+ $this->rights[$r][0] = 4032; // Permission id (must not be already used)
+ $this->rights[$r][1] = 'Write personal information'; // Permission label
+ $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
+ $this->rights[$r][4] = 'write_personal_information';
+ $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_personal_information->write)
+ $r++;
}
/**
diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php
index 87a4f453801..9cc9310cd19 100644
--- a/htdocs/core/modules/modOpenSurvey.class.php
+++ b/htdocs/core/modules/modOpenSurvey.class.php
@@ -182,6 +182,13 @@ class modOpenSurvey extends DolibarrModules
*/
public function init($options = '')
{
+ global $conf, $langs;
+
+ $result = $this->_load_tables('/install/mysql/tables/', 'opensurvey');
+ if ($result < 0) {
+ return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
+ }
+
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php
index 4f0633cd578..3419d4c866e 100644
--- a/htdocs/core/modules/modPropale.class.php
+++ b/htdocs/core/modules/modPropale.class.php
@@ -190,10 +190,10 @@ class modPropale extends DolibarrModules
$this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'co.code'=>'CountryCode', 's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer",
- 'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal", 'c.remise_percent'=>"GlobalDiscount",
+ 'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal",
'c.total_ht'=>"TotalHT", 'c.total_ttc'=>"TotalTTC", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate',
'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin',
- 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.label'=>"Label", 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct',
+ 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct',
'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC",
'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel'
);
@@ -214,14 +214,14 @@ class modPropale extends DolibarrModules
//$this->export_TypeFields_array[$r]=array(
// 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text',
// 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",
- // 'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",
+ // 'c.fin_validite'=>"Date",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",
// 'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",
// 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'
//);
$this->export_TypeFields_array[$r] = array(
's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text',
's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.datec'=>"Date", 'c.datep'=>"Date", 'c.fin_validite'=>"Date",
- 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date',
+ 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date',
'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric",
'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.ref'=>'Text', 'p.label'=>'Text',
'c.entity'=>'List:entity:label:rowid',
@@ -229,9 +229,9 @@ class modPropale extends DolibarrModules
$this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'co.code'=>'company', 's.phone'=>'company',
's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"propal", 'c.ref'=>"propal", 'c.ref_client'=>"propal",
- 'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.remise_percent'=>"propal", 'c.total_ht'=>"propal",
+ 'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.total_ht'=>"propal",
'c.total_ttc'=>"propal", 'c.fk_statut'=>"propal", 'c.note_public'=>"propal", 'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line',
- 'cd.label'=>"propal_line", 'cd.description'=>"propal_line", 'cd.product_type'=>'propal_line', 'cd.tva_tx'=>"propal_line", 'cd.qty'=>"propal_line",
+ 'cd.description'=>"propal_line", 'cd.product_type'=>'propal_line', 'cd.tva_tx'=>"propal_line", 'cd.qty'=>"propal_line",
'cd.total_ht'=>"propal_line", 'cd.total_tva'=>"propal_line", 'cd.total_ttc'=>"propal_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'
);
$this->export_dependencies_array[$r] = array('propal_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
@@ -293,7 +293,6 @@ class modPropale extends DolibarrModules
'c.datec' => 'DateCreation',
'c.datep' => 'DatePropal',
'c.fin_validite' => 'DateEndPropal',
- 'c.remise_percent' => 'GlobalDiscount',
'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC',
'c.fk_statut' => 'Status*',
@@ -330,7 +329,6 @@ class modPropale extends DolibarrModules
'c.datec' => '2020-01-01',
'c.datep' => '2020-01-01',
'c.fin_validite' => '2020-01-01',
- 'c.remise_percent' => '',
'c.total_ht' => '0',
'c.total_ttc' => '0',
'c.fk_statut' => '1',
@@ -344,16 +342,23 @@ class modPropale extends DolibarrModules
'c.multicurrency_total_ttc' => '0'
];
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
- $this->import_updatekeys_array[$r] = ['c.ref'=>'Ref'];
- $this->import_convertvalue_array[$r] = [
- 'c.fk_soc' => [
+ $this->import_updatekeys_array[$r] = array('c.ref'=>'Ref');
+ $this->import_convertvalue_array[$r] = array(
+ 'c.ref' => array(
+ 'rule'=>'getrefifauto',
+ 'class'=>(empty($conf->global->PROPALE_ADDON) ? 'mod_propale_marbre' : $conf->global->PROPALE_ADDON),
+ 'path'=>"/core/modules/propale/".(empty($conf->global->PROPALE_ADDON) ? 'mod_propale_marbre' : $conf->global->PROPALE_ADDON).'.php',
+ 'classobject'=>'Propal',
+ 'pathobject'=>'/comm/propal/class/propal.class.php',
+ ),
+ 'c.fk_soc' => array(
'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php',
'class' => 'Societe',
'method' => 'fetch',
'element' => 'ThirdParty'
- ]
- ];
+ )
+ );
//Import Proposal Lines
$r++;
@@ -367,15 +372,13 @@ class modPropale extends DolibarrModules
);
$this->import_fields_array[$r] = array(
'cd.fk_propal' => 'Proposal*',
- 'cd.fk_parent_line' => 'PrParentLine',
+ 'cd.fk_parent_line' => 'ParentLine',
'cd.fk_product' => 'IdProduct',
- 'cd.label' => 'Label',
'cd.description' => 'LineDescription',
'cd.product_type' => 'TypeOfLineServiceOrProduct',
'cd.tva_tx' => 'LineVATRate',
'cd.qty' => 'LineQty',
'cd.remise_percent' => 'Reduc. Percent',
- 'cd.remise' => 'Reduc.',
'cd.price' => 'Price',
'cd.subprice' => 'Sub Price',
'cd.total_ht' => 'LineTotalHT',
@@ -411,13 +414,11 @@ class modPropale extends DolibarrModules
'cd.fk_propal' => 'PROV(0001)',
'cd.fk_parent_line' => '',
'cd.fk_product' => '',
- 'cd.label' => '',
'cd.description' => 'Line description',
'cd.product_type' => '1',
'cd.tva_tx' => '0',
'cd.qty' => '2',
'cd.remise_percent' => '0',
- 'cd.remise' => '0',
'cd.price' => '',
'cd.subprice' => '5000',
'cd.total_ht' => '10000',
diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php
index dc05bf9dc66..248d3c006ce 100644
--- a/htdocs/core/modules/modWorkflow.class.php
+++ b/htdocs/core/modules/modWorkflow.class.php
@@ -95,7 +95,8 @@ class modWorkflow extends DolibarrModules
8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
9=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0),
10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0),
- 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0)
+ 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0),
+ 11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0)
);
// Boxes
diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php
index d44a261a16b..d56178697f5 100644
--- a/htdocs/core/modules/product_batch/mod_lot_advanced.php
+++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php
@@ -128,7 +128,7 @@ class mod_lot_advanced extends ModeleNumRefBatch
/**
* Return next free value
*
- * @param Societe $objsoc Object Societe
+ * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php
index def14bd37b3..d6b24945ab0 100644
--- a/htdocs/core/modules/product_batch/mod_lot_free.php
+++ b/htdocs/core/modules/product_batch/mod_lot_free.php
@@ -93,11 +93,11 @@ class mod_lot_free extends ModeleNumRefBatch
/**
* Return an example of result returned by getNextValue
*
- * @param product $objproduct Object product
- * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
+ * @param Societe $objsoc Object thirdparty
+ * @param Object $object Object we need next value for
* @return string Return next value
*/
- public function getNextValue($objproduct = 0, $type = -1)
+ public function getNextValue($objsoc, $object)
{
global $langs;
return '';
diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php
index 59de1965a6e..fc8d1389a00 100644
--- a/htdocs/core/modules/product_batch/mod_lot_standard.php
+++ b/htdocs/core/modules/product_batch/mod_lot_standard.php
@@ -111,11 +111,11 @@ class mod_lot_standard extends ModeleNumRefBatch
/**
* Return next free value
*
- * @param Product $objprod Object product
+ * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($objprod, $object)
+ public function getNextValue($objsoc, $object)
{
global $db, $conf;
diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php
index abe094220d2..6ee931d51a9 100644
--- a/htdocs/core/modules/product_batch/mod_sn_advanced.php
+++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php
@@ -128,11 +128,11 @@ class mod_sn_advanced extends ModeleNumRefBatch
/**
* Return next free value
*
- * @param Product $objprod Object product
+ * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($objprod, $object)
+ public function getNextValue($objsoc, $object)
{
global $db, $conf;
diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php
index 67d39ec085a..f6b2417d34b 100644
--- a/htdocs/core/modules/product_batch/mod_sn_free.php
+++ b/htdocs/core/modules/product_batch/mod_sn_free.php
@@ -92,11 +92,11 @@ class mod_sn_free extends ModeleNumRefBatch
/**
* Return an example of result returned by getNextValue
*
- * @param product $objproduct Object product
- * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
+ * @param Societe $objsoc Object thirdparty
+ * @param Object $object Object we need next value for
* @return string Return next value
*/
- public function getNextValue($objproduct = 0, $type = -1)
+ public function getNextValue($objsoc, $object)
{
global $langs;
return '';
diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php
index 845044c39f3..d6c109cff81 100644
--- a/htdocs/core/modules/product_batch/mod_sn_standard.php
+++ b/htdocs/core/modules/product_batch/mod_sn_standard.php
@@ -111,7 +111,7 @@ class mod_sn_standard extends ModeleNumRefBatch
/**
* Return next free value
*
- * @param Societe $objsoc Object product
+ * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php
index bbfc0daee45..6570f2c864a 100644
--- a/htdocs/core/modules/reception/mod_reception_beryl.php
+++ b/htdocs/core/modules/reception/mod_reception_beryl.php
@@ -96,10 +96,10 @@ class mod_reception_beryl extends ModelNumRefReception
* Return next value
*
* @param Societe $objsoc Third party object
- * @param Object $shipment Shipment object
+ * @param Object $reception Reception object
* @return string Value if OK, 0 if KO
*/
- public function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $reception)
{
global $db, $conf;
diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php
index 145a04fbd31..f519974382b 100644
--- a/htdocs/core/modules/reception/modules_reception.php
+++ b/htdocs/core/modules/reception/modules_reception.php
@@ -110,10 +110,10 @@ abstract class ModelNumRefReception
* Returns next value assigned
*
* @param Societe $objsoc Third party object
- * @param Object $shipment Shipment object
+ * @param Object $reception Reception object
* @return string Value
*/
- public function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $reception)
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
index acb3ad8fa2a..546596ab640 100644
--- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
+++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
@@ -120,7 +120,7 @@ abstract class ModeleNumRefSuppliersInvoices
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value if OK, 0 if KO
*/
- public function getNextValue($objsoc, $object, $mode)
+ public function getNextValue($objsoc, $object, $mode = 'next')
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php
index 6fe3cb8883d..51c4e5f07d3 100644
--- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php
+++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php
@@ -120,9 +120,11 @@ abstract class ModeleNumRefSuppliersOrders
/** Returns next value assigned
*
- * @return string Valeur
+ * @param Societe $objsoc Object third party
+ * @param Object $object Object
+ * @return string Valeur
*/
- public function getNextValue()
+ public function getNextValue($objsoc = 0, $object = '')
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
index b225899cef2..2e618b3ece3 100644
--- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
+++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
@@ -120,9 +120,9 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
/**
* Return next value
*
- * @param Societe $objsoc Object third party
- * @param Propal $supplier_proposal Object commercial proposal
- * @return string Next value
+ * @param Societe $objsoc Object third party
+ * @param SupplierProposal $supplier_proposal Object commercial proposal
+ * @return string Next value
*/
public function getNextValue($objsoc, $supplier_proposal)
{
diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
index e7db54062cb..57cba16c01b 100644
--- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
+++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
@@ -120,9 +120,9 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
/**
* Return next value
*
- * @param Societe $objsoc Object third party
- * @param Propal $supplier_proposal Object supplier_proposal
- * @return string Value if OK, 0 if KO
+ * @param Societe $objsoc Object third party
+ * @param SupplierProposal $supplier_proposal Object commercial proposal
+ * @return string Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $supplier_proposal)
{
diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
index 0b6f0b3725d..5a3d9e2280a 100644
--- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
+++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
@@ -124,11 +124,11 @@ abstract class ModeleNumRefSupplierProposal
/**
* Renvoi prochaine valeur attribuee
*
- * @param Societe $objsoc Object third party
- * @param Propal $propal Object commercial proposal
- * @return string Valeur
+ * @param Societe $objsoc Object third party
+ * @param SupplierProposal $supplier_proposal Object commercial proposal
+ * @return string Valeur
*/
- public function getNextValue($objsoc, $propal)
+ public function getNextValue($objsoc, $supplier_proposal)
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
index b3d26b39511..7e46c10a341 100644
--- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
+++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
@@ -119,7 +119,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($objsoc = 0, $invoice = null, $mode = 'next')
+ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
{
global $db, $conf;
diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php
index b9fae565647..24fa70b7f28 100644
--- a/htdocs/core/modules/takepos/modules_takepos.php
+++ b/htdocs/core/modules/takepos/modules_takepos.php
@@ -89,9 +89,12 @@ abstract class ModeleNumRefTakepos
/**
* Renvoi prochaine valeur attribuee
*
- * @return string Valeur
+ * @param Societe $objsoc Object thirdparty
+ * @param Facture $invoice Object invoice
+ * @param string $mode 'next' for next value or 'last' for last value
+ * @return string Value if KO, <0 if KO
*/
- public function getNextValue()
+ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
{
global $langs;
return $langs->trans('NotAvailable');
diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php
index 1d2bc944022..c8561382436 100644
--- a/htdocs/core/modules/ticket/modules_ticket.php
+++ b/htdocs/core/modules/ticket/modules_ticket.php
@@ -115,11 +115,11 @@ abstract class ModeleNumRefTicket
/**
* Renvoi prochaine valeur attribuee
*
- * @param Societe $objsoc Object third party
- * @param Project $project Object project
- * @return string Valeur
+ * @param Societe $objsoc Object third party
+ * @param Ticket $ticket Object ticket
+ * @return string Valeur
*/
- public function getNextValue($objsoc, $project)
+ public function getNextValue($objsoc, $ticket)
{
global $langs;
return $langs->trans("NotAvailable");
diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
index 4e98af5c6c7..1d46aec1008 100644
--- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
+++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
@@ -435,7 +435,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$number_contracts_found = 0;
foreach ($company_ids as $company_id) {
$contrat->socid = $company_id;
-
$list = $contrat->getListOfContracts($option = 'all', $status = [Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED], $product_categories = [$conf->global->TICKET_PRODUCT_CATEGORY], $line_status = [ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN]);
if (is_array($list) && !empty($list)) {
$number_contracts_found = count($list);
@@ -457,6 +456,28 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs');
}
}
+ // Automatically create intervention
+ if (!empty($conf->ficheinter->enabled) && !empty($conf->ticket->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) {
+ $fichinter = new Fichinter($this->db);
+ $fichinter->socid = (int) $object->fk_soc;
+ $fichinter->fk_project = $projectid;
+ $fichinter->fk_contrat = (int) $object->fk_contract;
+ $fichinter->author = $user->id;
+ $fichinter->model_pdf = (!empty($conf->global->FICHEINTER_ADDON_PDF)) ? $conf->global->FICHEINTER_ADDON_PDF : 'soleil';
+ $fichinter->origin = $object->element;
+ $fichinter->origin_id = $object->id;
+
+ // Extrafields
+ $extrafields = new ExtraFields($this->db);
+ $extrafields->fetch_name_optionals_label($fichinter->table_element);
+ $array_options = $extrafields->getOptionalsFromPost($fichinter->table_element);
+ $fichinter->array_options = $array_options;
+
+ $id = $fichinter->create($user);
+ if ($id <= 0) {
+ setEventMessages($fichinter->error, null, 'errors');
+ }
+ }
}
return 0;
}
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index f99a567a314..fb9b2a35dd0 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -627,10 +627,10 @@ class EcmDirectory extends CommonObject
* date_c Date creation
* fk_user_c User creation
* login_c Login creation
- * fullpath Full path of id (Added by build_path_from_id_categ call)
- * fullrelativename Full path name (Added by build_path_from_id_categ call)
- * fulllabel Full label (Added by build_path_from_id_categ call)
- * level Level of line (Added by build_path_from_id_categ call)
+ * fullpath Full path of id (Added by buildPathFromId call)
+ * fullrelativename Full path name (Added by buildPathFromId call)
+ * fulllabel Full label (Added by buildPathFromId call)
+ * level Level of line (Added by buildPathFromId call)
*
* @param int $force Force reload of full arbo even if already loaded in cache $this->cats
* @return array Tableau de array
@@ -698,10 +698,10 @@ class EcmDirectory extends CommonObject
// We add properties fullxxx to all elements
foreach ($this->cats as $key => $val) {
- if (isset($motherof[$key])) {
+ if (isset($this->motherof[$key])) {
continue;
}
- $this->build_path_from_id_categ($key, 0);
+ $this->buildPathFromId($key, 0);
}
$this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
@@ -710,7 +710,6 @@ class EcmDirectory extends CommonObject
return $this->cats;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs.
* Separator between directories is always '/', whatever is OS.
@@ -719,9 +718,8 @@ class EcmDirectory extends CommonObject
* @param int $protection Deep counter to avoid infinite loop
* @return void
*/
- public function build_path_from_id_categ($id_categ, $protection = 0)
+ private function buildPathFromId($id_categ, $protection = 0)
{
- // phpcs:enable
// Define fullpath
if (!empty($this->cats[$id_categ]['id_mere'])) {
$this->cats[$id_categ]['fullpath'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];
@@ -745,7 +743,7 @@ class EcmDirectory extends CommonObject
}
if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children'])) {
foreach ($this->cats[$id_categ]['id_children'] as $key => $val) {
- $this->build_path_from_id_categ($val, $protection);
+ $this->buildPathFromId($val, $protection);
}
}
}
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index a39a14dbab4..c89723af2b9 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1336,6 +1336,15 @@ if (empty($reshook)) {
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
+
+ unset($qty);
+ unset($value_unit_ht);
+ unset($value_unit);
+ unset($vatrate);
+ unset($comments);
+ unset($fk_c_type_fees);
+ unset($fk_project);
+ unset($date);
}
//header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index fac008ec304..ee2bf9269ce 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -255,7 +255,7 @@ class Fichinter extends CommonObject
}
if ($this->socid <= 0) {
- $this->error = 'ErrorBadParameterForFunc';
+ $this->error = 'ErrorFicheinterCompanyDoesNotExist';
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1;
}
diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php
index f77dd5638f7..fea334e43cf 100644
--- a/htdocs/fourn/class/fournisseur.facture-rec.class.php
+++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php
@@ -299,40 +299,34 @@ class FactureFournisseurRec extends CommonInvoice
$sql .= ') VALUES (';
$sql .= "'".$this->db->escape($this->titre)."'";
$sql .= ", '".$this->db->escape($this->ref_supplier)."'";
- $sql .= ', ' . (int) $conf->entity;
- $sql .= ', ' . (int) $facfourn_src->socid;
+ $sql .= ", ".((int) $conf->entity);
+ $sql .= ", ".((int) $facfourn_src->socid);
$sql .= ", '".$this->db->idate($now)."'";
- $sql .= ', ' . (int) $this->suspended;
- if (!empty(GETPOST('libelle'))) {
- $sql .= ", '" . $this->db->escape(GETPOST('libelle')) . "'";
- } elseif (! empty($this->libelle)) {
- $sql .= ", '" . $this->db->escape($this->libelle) . "'";
- } else {
- $sql .= ", ''";
- }
- $sql .= ', ' .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount
- $sql .= ', ' .(!empty($facfourn_src->remise) ? (float) $facfourn_src->remise : '0');
- $sql .= ', ' . (int) $user->id;
- $sql .= ', ' .(!empty($this->fk_project) ? $this->fk_project : 'NULL'); // Fields declarded on creation
- $sql .= ', ' .(!empty($facfourn_src->fk_account) ? $facfourn_src->fk_account : 'NULL');
- $sql .= ', ' .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
- $sql .= ', ' .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
- $sql .= ", '".($facfourn_src->date_echeance > 0 ? $this->db->idate($facfourn_src->date_echeance) : 'NULL')."'"; // date_lim_reglement
- $sql .= ', ' .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); // Fields declarded on creation
- $sql .= ', ' .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); // Fields declarded on creation
- $sql .= ', ' .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); // Fields declarded on creation
- $sql .= ', ' . (int) $facfourn_src->fk_multicurrency;
+ $sql .= ", ".((int) $this->suspended);
+ $sql .= ", '".$this->db->escape($this->libelle)."'";
+ $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount
+ $sql .= ", " .(!empty($facfourn_src->remise) ? (float) $facfourn_src->remise : '0');
+ $sql .= ", " .((int) $user->id);
+ $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');
+ $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');
+ $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
+ $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
+ $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement
+ $sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');
+ $sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');
+ $sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');
+ $sql .= ", " . (int) $facfourn_src->fk_multicurrency;
$sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'";
- $sql .= ', ' . (float) $facfourn_src->multicurrency_tx;
- $sql .= ', ' . (int) $this->usenewprice; // Fields declarded on creation
- $sql .= ', ' . (int) $this->frequency; // Fields declarded on creation
- $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; // Fields declarded on creation
- $sql .= ', ' .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); // Fields declarded on creation
- $sql .= ', ' .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); // Fields declarded on creation
- $sql .= ', ' . (int) $this->nb_gen_done; // Fields declarded on creation
- $sql .= ', ' . (int) $this->nb_gen_max; // Fields declarded on creation
- $sql .= ', ' . (int) $this->auto_validate; // Fields declarded on creation
- $sql .= ', ' . (int) $this->generate_pdf; // Fields declarded on creation
+ $sql .= ", " . (float) $facfourn_src->multicurrency_tx;
+ $sql .= ", " . (int) $this->usenewprice;
+ $sql .= ", " . (int) $this->frequency;
+ $sql .= ", '".$this->db->escape($this->unit_frequency)."'";
+ $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
+ $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
+ $sql .= ", " . (int) $this->nb_gen_done;
+ $sql .= ", " . (int) $this->nb_gen_max;
+ $sql .= ", " . (int) $this->auto_validate;
+ $sql .= ", " . (int) $this->generate_pdf;
$sql .= ')';
if ($this->db->query($sql)) {
@@ -475,44 +469,43 @@ class FactureFournisseurRec extends CommonInvoice
$error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET";
- $sql .= ' titre = "' . (!empty($this->titre) ? $this->titre .'",' : '"",') ;
- $sql .= ' ref_supplier = "'. (!empty($this->ref_supplier) ? $this->ref_supplier .'",' : '" ",');
- $sql .= " entity = ". (!empty($this->entity) ? $this->entity : 1) . ',';
+ $sql .= " titre = '" . (!empty($this->titre) ? $this->db->escape($this->titre) : "")."'," ;
+ $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
+ $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ',';
if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ',';
- $sql .= ' tms = "'. date('Y-m-d H:i:s', dol_now()) . '",';
- $sql .= " suspended = ". (!empty($this->suspended) ? $this->suspended : 0) . ',';
- $sql .= ' libelle = "'. (!empty($this->libelle) ? $this->libelle : 'NULL') . '",';
- $sql .= " amount = ". (!empty($this->amount) ? $this->amount : 0.00) . ',';
- $sql .= " remise = ". (!empty($this->remise) ? $this->remise : 'NULL') . ',';
- $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? $this->vat_src_code : 'NULL') . ',';
- $sql .= " localtax1 = ". (!empty($this->localtax1) ? $this->localtax1 : 0.00) . ',';
- $sql .= " localtax2 = ". (!empty($this->localtax2) ? $this->localtax2 : 0.00) . ',';
- $sql .= " total_ht = ". (!empty($this->total_ht) ? $this->total_ht : 0.00) . ',';
- $sql .= " total_tva = ". (!empty($this->total_tva) ? $this->total_tva : 0.00) . ',';
- $sql .= " total_ttc = ". (!empty($this->total_ttc) ? $this->total_ttc : 0.00) . ',';
- $sql .= " fk_user_modif = ". $user->id . ',';
- $sql .= " fk_projet = ". (!empty($this->fk_project) ? $this->fk_project : 'NULL') . ',';
- $sql .= " fk_account = ". (!empty($this->fk_account) ? $this->fk_account : 'NULL') . ',';
- $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? $this->mode_reglement_id : 'NULL') . ',';
- $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? $this->cond_reglement_id : 'NULL') . ',';
- $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? '"'.date("Y-m-d H:i:s", $this->date_lim_reglement).'"' : 'NULL') . ',';
- $sql .= ' note_private = "'. (!empty($this->note_private) ? $this->note_private : '') . '",';
- $sql .= ' note_public = "'. (!empty($this->note_public) ? $this->note_public : '') . '",';
- $sql .= ' modelpdf = "'. (!empty($this->model_pdf) ? $this->model_pdf : 'NULL') . '",';
- $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL') . ',';
- $sql .= ' multicurrency_code = "'. (!empty($this->multicurrency_code) ? $this->multicurrency_code : 'NULL') . '",';
- $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1) . ',';
- $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? $this->multicurrency_total_ht : 0.00) . ',';
- $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? $this->multicurrency_total_tva : 0.00) . ',';
- $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? $this->multicurrency_total_ttc : 0.00) . ',';
- $sql .= " usenewprice = ". (!empty($this->usenewprice) ? $this->usenewprice : 0) . ',';
- $sql .= " frequency = ". (!empty($this->frequency) ? $this->frequency : 0). ',';
- $sql .= ' unit_frequency = "'. (!empty($this->unit_frequency) ? $this->unit_frequency : 0). '",';
- $sql .= " date_when = ". (!empty($this->date_when) ? '"'.date("Y-m-d H:i:s", $this->date_when).'"' : 0) . ',';
- $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? '"'.date("Y-m-d H:i:s", $this->date_last_gen).'"' : 0) . ',';
- $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? $this->nb_gen_done : 0) . ',';
- $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? $this->nb_gen_max : 0) . ',';
- $sql .= " auto_validate = ". (!empty($this->auto_validate) ? $this->auto_validate : 0);
+ $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ',';
+ $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ",";
+ $sql .= " amount = ". (!empty($this->amount) ? ((float) $this->amount) : 0.00) . ',';
+ $sql .= " remise = ". (!empty($this->remise) ? ((float) $this->remise) : 'NULL') . ',';
+ $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ',';
+ $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ',';
+ $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ',';
+ $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ',';
+ $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ',';
+ $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ',';
+ $sql .= " fk_user_modif = ". ((int) $user->id) . ',';
+ $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ',';
+ $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ',';
+ $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ',';
+ $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ',';
+ $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ',';
+ $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',";
+ $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',";
+ $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ",";
+ $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ',';
+ $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ",";
+ $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ',';
+ $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ',';
+ $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ',';
+ $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ',';
+ $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ',';
+ $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ',';
+ $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',";
+ $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ',';
+ $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ',';
+ $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ',';
+ $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ',';
+ $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
$sql .= " WHERE rowid = ". (int) $this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@@ -1139,28 +1132,28 @@ class FactureFournisseurRec extends CommonInvoice
$sql .= ", ref = '" . $this->db->escape($ref) . "'";
$sql .= ", label = '" . $this->db->escape($label) . "'";
$sql .= ", description = '" . $this->db->escape($desc) . "'";
- $sql .= ', pu_ht=' . price2num($pu_ht);
- $sql .= ', qty=' . price2num($qty);
- $sql .= ", remise_percent='" . price2num($remise_percent) . "'";
- $sql .= ", vat_src_code='" . $this->db->escape($vat_src_code) . "'";
- $sql .= ', tva_tx=' . price2num($txtva);
- $sql .= ', localtax1_tx=' . (float) $txlocaltax1;
- $sql .= ", localtax1_type='" . $this->db->escape($localtaxes_type[0]) . "'";
- $sql .= ', localtax2_tx=' . (float) $txlocaltax2;
- $sql .= ", localtax2_type='" . $this->db->escape($localtaxes_type[2]) . "'";
- $sql .= ", total_ht='" . price2num($total_ht) . "'";
- $sql .= ", total_tva='" . price2num($total_tva) . "'";
- $sql .= ", total_localtax1='" . price2num($total_localtax1) . "'";
- $sql .= ", total_localtax2='" . price2num($total_localtax2) . "'";
- $sql .= ", total_ttc='" . price2num($total_ttc) . "'";
- $sql .= ', product_type=' . (int) $product_type;
- $sql .= ', date_start=' . (empty($date_start) ? 'NULL' : (int) $date_start);
- $sql .= ', date_end=' . (empty($date_end) ? 'NULL' : (int) $date_end);
- $sql .= ', info_bits=' . (int) $info_bits;
- $sql .= ', special_code=' . (int) $special_code;
- $sql .= ', rang=' . (int) $rang;
- $sql .= ', fk_unit=' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null');
- $sql .= ', fk_user_modif=' . (int) $user;
+ $sql .= ', pu_ht = ' . price2num($pu_ht);
+ $sql .= ', qty = ' . price2num($qty);
+ $sql .= ", remise_percent = '" . price2num($remise_percent) . "'";
+ $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'";
+ $sql .= ', tva_tx = ' . price2num($txtva);
+ $sql .= ', localtax1_tx = ' . (float) $txlocaltax1;
+ $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'";
+ $sql .= ', localtax2_tx = ' . (float) $txlocaltax2;
+ $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'";
+ $sql .= ", total_ht = '" . price2num($total_ht) . "'";
+ $sql .= ", total_tva = '" . price2num($total_tva) . "'";
+ $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'";
+ $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'";
+ $sql .= ", total_ttc = '" . price2num($total_ttc) . "'";
+ $sql .= ', product_type = ' . (int) $product_type;
+ $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start);
+ $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end);
+ $sql .= ', info_bits = ' . (int) $info_bits;
+ $sql .= ', special_code = ' . (int) $special_code;
+ $sql .= ', rang = ' . (int) $rang;
+ $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null');
+ $sql .= ', fk_user_modif = ' . (int) $user;
$sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise);
$sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht);
$sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva);
@@ -1766,14 +1759,15 @@ class FactureFournisseurRec extends CommonInvoice
return -2;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null');
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql .= " SET frequency = ".($frequency ? ((int) $this->db->escape($frequency)) : "NULL");
if (!empty($unit)) {
- $sql .= ', unit_frequency = '.$this->db->escape($unit);
+ $sql .= ", unit_frequency = '".$this->db->escape($unit)."'";
}
- $sql .= ' WHERE rowid = ' . (int) $this->id;
+ $sql .= " WHERE rowid = ".((int) $this->id);
+
+ dol_syslog(get_class($this).'::setFrequencyAndUnit', LOG_DEBUG);
- dol_syslog(get_class($this). '::setFrequencyAndUnit', LOG_DEBUG);
if ($this->db->query($sql)) {
$this->frequency = $frequency;
if (!empty($unit)) {
@@ -1781,7 +1775,7 @@ class FactureFournisseurRec extends CommonInvoice
}
return 1;
} else {
- dol_print_error($this->db);
+ $this->error = $this->db->lasterror();
return -1;
}
}
@@ -1796,17 +1790,18 @@ class FactureFournisseurRec extends CommonInvoice
public function setNextDate($date, $increment_nb_gen_done = 0)
{
if (!$this->table_element) {
- dol_syslog(get_class($this). '::setNextDate was called on objet with property table_element not defined', LOG_ERR);
+ dol_syslog(get_class($this).'::setNextDate was called on objet with property table_element not defined', LOG_ERR);
return -1;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' SET date_when = ' .($date ? "'".$this->db->idate($date)."'" : 'null');
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL");
if ($increment_nb_gen_done > 0) {
- $sql .= ', nb_gen_done = nb_gen_done + 1';
+ $sql .= ", nb_gen_done = nb_gen_done + 1";
}
- $sql .= ' WHERE rowid = ' . (int) $this->id;
+ $sql .= " WHERE rowid = " . (int) $this->id;
+
+ dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG);
- dol_syslog(get_class($this). '::setNextDate', LOG_DEBUG);
if ($this->db->query($sql)) {
$this->date_when = $date;
if ($increment_nb_gen_done > 0) {
@@ -1814,7 +1809,7 @@ class FactureFournisseurRec extends CommonInvoice
}
return 1;
} else {
- dol_print_error($this->db);
+ $this->error = $this->db->lasterror();
return -1;
}
}
@@ -1828,7 +1823,7 @@ class FactureFournisseurRec extends CommonInvoice
public function setMaxPeriod($nb)
{
if (!$this->table_element) {
- dol_syslog(get_class($this). '::setMaxPeriod was called on objet with property table_element not defined', LOG_ERR);
+ dol_syslog(get_class($this).'::setMaxPeriod was called on objet with property table_element not defined', LOG_ERR);
return -1;
}
@@ -1836,11 +1831,12 @@ class FactureFournisseurRec extends CommonInvoice
$nb = 0;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' SET nb_gen_max = '. (int) $nb;
- $sql .= ' WHERE rowid = ' . (int) $this->id;
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql .= " SET nb_gen_max = ". (int) $nb;
+ $sql .= " WHERE rowid = " . (int) $this->id;
+
+ dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG);
- dol_syslog(get_class($this). '::setMaxPeriod', LOG_DEBUG);
if ($this->db->query($sql)) {
$this->nb_gen_max = $nb;
return 1;
@@ -1859,15 +1855,16 @@ class FactureFournisseurRec extends CommonInvoice
public function setAutoValidate($validate)
{
if (!$this->table_element) {
- dol_syslog(get_class($this). '::setAutoValidate was called on objet with property table_element not defined', LOG_ERR);
+ dol_syslog(get_class($this).'::setAutoValidate was called on objet with property table_element not defined', LOG_ERR);
return -1;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' SET auto_validate = '.((int) $validate);
- $sql .= ' WHERE rowid = ' . (int) $this->id;
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql .= " SET auto_validate = ".((int) $validate);
+ $sql .= " WHERE rowid = " . (int) $this->id;
+
+ dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG);
- dol_syslog(get_class($this). '::setAutoValidate', LOG_DEBUG);
if ($this->db->query($sql)) {
$this->auto_validate = $validate;
return 1;
@@ -1886,15 +1883,16 @@ class FactureFournisseurRec extends CommonInvoice
public function setGeneratePdf($validate)
{
if (!$this->table_element) {
- dol_syslog(get_class($this). '::setGeneratePdf was called on objet with property table_element not defined', LOG_ERR);
+ dol_syslog(get_class($this).'::setGeneratePdf was called on objet with property table_element not defined', LOG_ERR);
return -1;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' SET generate_pdf = '. (int) $validate;
- $sql .= ' WHERE rowid = ' . (int) $this->id;
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql .= " SET generate_pdf = ". (int) $validate;
+ $sql .= " WHERE rowid = " . (int) $this->id;
+
+ dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG);
- dol_syslog(get_class($this). '::setGeneratePdf', LOG_DEBUG);
if ($this->db->query($sql)) {
$this->generate_pdf = $validate;
return 1;
@@ -1913,15 +1911,16 @@ class FactureFournisseurRec extends CommonInvoice
public function setModelPdf($model)
{
if (!$this->table_element) {
- dol_syslog(get_class($this). '::setModelPdf was called on objet with property table_element not defined', LOG_ERR);
+ dol_syslog(get_class($this).'::setModelPdf was called on objet with property table_element not defined', LOG_ERR);
return -1;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET modelpdf = '".$this->db->escape($model)."'";
- $sql .= ' WHERE rowid = ' . (int) $this->id;
+ $sql .= " WHERE rowid = " . (int) $this->id;
+
+ dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG);
- dol_syslog(get_class($this). '::setModelPdf', LOG_DEBUG);
if ($this->db->query($sql)) {
$this->model_pdf = $model;
return 1;
@@ -2144,8 +2143,8 @@ class FactureFournisseurLigneRec extends CommonObjectLine
$sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn;
$sql .= ', fk_parent_line = ' . (int) $this->fk_parent;
$sql .= ', fk_product = ' . (int) $this->fk_product;
- $sql .= ', ref = ' . (! empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'null');
- $sql .= ", label = " . (! empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'null');
+ $sql .= ', ref = ' . (! empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL');
+ $sql .= ", label = " . (! empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL');
$sql .= ", description = '" . $this->db->escape($this->description) . "'";
$sql .= ', pu_ht = ' . price2num($this->pu_ht);
$sql .= ', pu_ttc = ' . price2num($this->pu_ttc);
@@ -2153,27 +2152,26 @@ class FactureFournisseurLigneRec extends CommonObjectLine
$sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'";
$sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except;
$sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'";
- $sql .= ', tva_tx =' . price2num($this->tva_tx);
+ $sql .= ', tva_tx = ' . price2num($this->tva_tx);
$sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx);
$sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'";
$sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx);
$sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'";
if (empty($this->skip_update_total)) {
- $sql .= ', total_ht =' . price2num($this->total_ht);
- $sql .= ', total_tva =' . price2num($this->total_tva);
- $sql .= ', total_localtax1 =' . price2num($this->total_localtax1);
- $sql .= ', total_localtax2 =' . price2num($this->total_localtax2);
- $sql .= ', total_ttc =' . price2num($this->total_ttc);
+ $sql .= ', total_ht = ' . price2num($this->total_ht);
+ $sql .= ', total_tva = ' . price2num($this->total_tva);
+ $sql .= ', total_localtax1 = ' . price2num($this->total_localtax1);
+ $sql .= ', total_localtax2 = ' . price2num($this->total_localtax2);
+ $sql .= ', total_ttc = ' . price2num($this->total_ttc);
}
- $sql .= ', product_type =' . (int) $this->product_type;
- $sql .= ', date_start =' . (int) $this->date_start;
- $sql .= ', date_end =' . (int) $this->date_end;
- $sql .= ", info_bits ='" . price2num($this->info_bits) . "'";
+ $sql .= ', product_type = ' . (int) $this->product_type;
+ $sql .= ', date_start = ' . (int) $this->date_start;
+ $sql .= ', date_end = ' . (int) $this->date_end;
+ $sql .= ", info_bits = " . ((int) $this->info_bits);
$sql .= ', special_code =' . (int) $this->special_code;
- $sql .= ', rang =' . (int) $this->rang;
- $sql .= ', fk_unit =' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
- $sql .= ', fk_user_modif =' . (int) $user;
-
+ $sql .= ', rang = ' . (int) $this->rang;
+ $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
+ $sql .= ', fk_user_modif = ' . (int) $user;
$sql .= ' WHERE rowid = ' . (int) $this->id;
$this->db->begin();
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index fb90e598a8b..3ddb1350a8b 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -373,10 +373,8 @@ if (empty($reshook)) {
$objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
$objecttmp->fk_project = $cmd->fk_project;
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
- if (empty($createbills_onebythird)) {
- $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
- $default_ref_supplier+=1;
- }
+ $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
+ $default_ref_supplier+=1;
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($datefacture)) {
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index 1876d3428b4..fdb34f2191e 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -99,6 +99,8 @@ ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_m
-- v16
+ALTER TABLE llx_facture ADD INDEX idx_facture_datef (datef);
+
ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL;
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2);
@@ -117,6 +119,7 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value
ALTER TABLE llx_ticket ADD COLUMN date_last_msg_sent datetime AFTER date_read;
UPDATE llx_const SET name = 'WORKFLOW_TICKET_LINK_CONTRACT' WHERE name = 'TICKET_AUTO_ASSIGN_CONTRACT_CREATE';
+UPDATE llx_const SET name = 'WORKFLOW_TICKET_CREATE_INTERVENTION' WHERE name = 'TICKET_AUTO_CREATE_FICHINTER_CREATE';
CREATE TABLE llx_stock_mouvement_extrafields (
rowid integer AUTO_INCREMENT PRIMARY KEY,
@@ -282,6 +285,8 @@ ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER dom
-- Set default ticket type to OTHER if no default exists
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
+ALTER TABLE llx_user ADD COLUMN ref_employee varchar(50) DEFAULT NULL;
+ALTER TABLE llx_user ADD COLUMN national_registration_number varchar(50) DEFAULT NULL;
ALTER TABLE llx_propal ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf;
diff --git a/htdocs/install/mysql/tables/llx_facture.key.sql b/htdocs/install/mysql/tables/llx_facture.key.sql
index a46e27c851d..ee25f8c09d8 100644
--- a/htdocs/install/mysql/tables/llx_facture.key.sql
+++ b/htdocs/install/mysql/tables/llx_facture.key.sql
@@ -29,6 +29,7 @@ ALTER TABLE llx_facture ADD INDEX idx_facture_fk_projet (fk_projet);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_account (fk_account);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_currency (fk_currency);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_statut (fk_statut);
+ALTER TABLE llx_facture ADD INDEX idx_facture_datef (datef);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql
index d701005666c..8c7e2db385c 100644
--- a/htdocs/install/mysql/tables/llx_facture.sql
+++ b/htdocs/install/mysql/tables/llx_facture.sql
@@ -26,7 +26,7 @@ create table llx_facture
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
- ref varchar(30) NOT NULL, -- invoice reference number
+ ref varchar(30) NOT NULL, -- invoice reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.key.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.key.sql
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_comments.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql b/htdocs/install/mysql/tables/llx_opensurvey_formquestions-opensurvey.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_formquestions-opensurvey.sql
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.key.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.key.sql
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_sondage.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.sql
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers-opensurvey.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_user_formanswers-opensurvey.sql
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.key.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.key.sql
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql
similarity index 100%
rename from htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql
rename to htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql
diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql
index 6cfdf8bfbb8..694ed360b21 100644
--- a/htdocs/install/mysql/tables/llx_user.sql
+++ b/htdocs/install/mysql/tables/llx_user.sql
@@ -108,5 +108,7 @@ create table llx_user
import_key varchar(14), -- import key
default_range integer,
default_c_exp_tax_cat integer,
+ employee_number varchar(50),
+ national_registration_number varchar(50),
fk_warehouse integer -- default warehouse os user
)ENGINE=innodb;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index d4073f80b7c..1dc7d4e2092 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -972,6 +972,8 @@ Permission4021=Create/modify your evaluation
Permission4022=Validate evaluation
Permission4023=Delete evaluation
Permission4030=See comparison menu
+Permission4031=Read personal information
+Permission4032=Write personal information
Permission10001=Read website content
Permission10002=Create/modify website content (html and javascript content)
Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers.
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 68c08c9f234..eada0da8899 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -601,7 +601,6 @@ BILL_SUPPLIER_DELETEInDolibarr=Supplier invoice deleted
UnitPriceXQtyLessDiscount=Unit price x Qty - Discount
CustomersInvoicesArea=Customer billing area
SupplierInvoicesArea=Supplier billing area
-FacParentLine=Invoice Line Parent
SituationTotalRayToRest=Remainder to pay without taxe
PDFSituationTitle=Situation n° %d
SituationTotalProgress=Total progress %d %%
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 3e85f1b35f7..edd6f7b7dd8 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -51,6 +51,8 @@ CivilityCode=Civility code
RegisteredOffice=Registered office
Lastname=Last name
Firstname=First name
+RefEmployee=Employee reference
+NationalRegistrationNumber=National registration number
PostOrFunction=Job position
UserTitle=Title
NatureOfThirdParty=Nature of Third party
diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang
index 7c117fcd1f2..a57a84fc4c8 100644
--- a/htdocs/langs/en_US/interventions.lang
+++ b/htdocs/langs/en_US/interventions.lang
@@ -67,3 +67,4 @@ ToCreateAPredefinedIntervention=To create a predefined or recurring intervention
ConfirmReopenIntervention=Are you sure you want to open back the intervention %s?
GenerateInter=Generate intervention
FichinterNoContractLinked=Intervention %s has been created without a linked contract.
+ErrorFicheinterCompanyDoesNotExist=Company does not exist. Intervention has not been created.
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 62d167ea233..7e57db2091b 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -244,6 +244,7 @@ Designation=Description
DescriptionOfLine=Description of line
DateOfLine=Date of line
DurationOfLine=Duration of line
+ParentLine=Parent line ID
Model=Doc template
DefaultModel=Default doc template
Action=Event
diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang
index ed25b5501dc..aa5ef73f7dc 100644
--- a/htdocs/langs/en_US/propal.lang
+++ b/htdocs/langs/en_US/propal.lang
@@ -101,7 +101,6 @@ ConfirmMassValidationQuestion=Are you sure you want to validate the selected rec
ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ?
IdProposal=Proposal ID
IdProduct=Product ID
-PrParentLine=Proposal Parent Line
LineBuyPriceHT=Buy Price Amount net of tax for line
SignPropal=Accept proposal
RefusePropal=Refuse proposal
diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang
index 6ddf8d9c6a3..803a31c9646 100644
--- a/htdocs/langs/en_US/workflow.lang
+++ b/htdocs/langs/en_US/workflow.lang
@@ -7,6 +7,7 @@ descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a sales order after a
descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed (the new invoice will have same amount as the proposal)
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a sales order is closed (the new invoice will have same amount as the order)
+descWORKFLOW_TICKET_CREATE_INTERVENTION=On ticket creation, automatically create an intervention.
# Autoclassify customer proposal or order
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as billed when sales order is set to billed (and if the amount of the order is the same as the total amount of the signed linked proposal)
descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as billed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the signed linked proposal)
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index d6e59e4b2bd..288fd88eae6 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -122,7 +122,7 @@ class MyObject extends CommonObject
'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010),
- 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1),
+ 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>2000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1),
);
/**
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 874d964ad6e..b1caea730f9 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -382,20 +382,35 @@ class modMyModule extends DolibarrModules
$r = 1;
/* BEGIN MODULEBUILDER IMPORT MYOBJECT */
/*
- $langs->load("mymodule@mymodule");
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_icon[$r]='myobject@mymodule';
- $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule';
- include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
- $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule';
- include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
- //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
- $this->export_sql_end[$r] .=' WHERE 1 = 1';
- $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
- $r++; */
+ $langs->load("mymodule@mymodule");
+ $this->import_code[$r]=$this->rights_class.'_'.$r;
+ $this->import_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->import_icon[$r]='myobject@mymodule';
+ $this->import_tables_array[$r] = array('t' => MAIN_DB_PREFIX.'mymodule_myobject', 'extra' => MAIN_DB_PREFIX.'mymodule_myobject_extrafields');
+ $this->import_tables_creator_array[$r] = array('t' => 'fk_user_author'); // Fields to store import user id
+ $import_sample = array();
+ $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule';
+ include DOL_DOCUMENT_ROOT.'/core/commonfieldsinimport.inc.php';
+ $import_extrafield_sample = array();
+ $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
+ $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'mymodule_myobject');
+ $this->import_regex_array[$r] = array();
+ $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
+ $this->import_updatekeys_array[$r] = array('t.ref' => 'Ref');
+ $this->import_convertvalue_array[$r] = array(
+ 't.ref' => array(
+ 'rule'=>'getrefifauto',
+ 'class'=>(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON),
+ 'path'=>"/core/modules/commande/".(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON).'.php'
+ 'classobject'=>'MyObject',
+ 'pathobject'=>'/mymodule/class/myobject.class.php',
+ ),
+ 't.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
+ 't.fk_user_valid' => array('rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user'),
+ 't.fk_mode_reglement' => array('rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment'),
+ );
+ $r++; */
/* END MODULEBUILDER IMPORT MYOBJECT */
}
diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php
index 1bfecac3f1d..009534b91b5 100644
--- a/htdocs/reception/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php
@@ -56,7 +56,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
} ?>
| getNomUrl(1); ?> |
- |
+ ref_supplier); ?> |
date_delivery, 'day'); ?> |
rights->reception->lire) {
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 83d656196e2..f2fee83c291 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -119,7 +119,7 @@ $dol_no_mouse_hover = $conf->dol_no_mouse_hover;
$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0);
$borderwidth = 2;
-$userborderontable = 1;
+$userborderontable = getDolGlobalInt('THEME_ELDY_USEBORDERONTABLE');
// Case of option always editable
if (!isset($conf->global->THEME_ELDY_BACKBODY)) {
@@ -3676,8 +3676,10 @@ div.colorback
margin-top: 5px;
}
.liste_titre_bydiv {
+
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
+
}
table.liste, table.noborder, table.formdoc, div.noborder {
width: calc(100% - 2px); /* -2 to fix a bug. Without, a scroll appears due to overflow-x: auto; of div-table-responsive */
@@ -3690,12 +3692,15 @@ table.liste, table.noborder, table.formdoc, div.noborder {
border-top-style: solid;
border-bottom-width: 1px;
- border-bottom-color: #BBB;
+ border-bottom-color: #BBB;
border-bottom-style: solid;
+
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
-
+
+
margin: 0px 0px 20px 0px;
-webkit-border-radius: 0.1em;
@@ -4074,7 +4079,9 @@ tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td {
/*
table.nobottomiftotal tr.liste_total td {
background-color: #fff;
+
border-bottom: 0px !important;
+
}
*/
div.liste_titre .tagtd {
@@ -4099,10 +4106,11 @@ div.liste_titre {
border-top-style: solid;
}
div.liste_titre_bydiv {
+
border-top-width: px;
border-top-color: var(--colortopbordertitle1);
border-top-style: solid;
-
+
border-collapse: collapse;
display: table;
padding: 2px 0px 2px 0;
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 1cebeec3506..99913e6c997 100755
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -254,28 +254,6 @@ if (empty($reshook)) {
$result = $object->assignUser($user, $user->id, 1);
$object->add_contact($user->id, "SUPPORTTEC", 'internal');
}
-
- // Auto create fiche intervention
- if (!empty($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)) {
- $fichinter = new Fichinter($db);
- $fichinter->socid = $object->fk_soc;
- $fichinter->fk_project = $projectid;
- $fichinter->fk_contrat = $object->fk_contract;
- $fichinter->author = $user->id;
- $fichinter->model_pdf = 'soleil';
- $fichinter->origin = $object->element;
- $fichinter->origin_id = $object->id;
-
- // Extrafields
- $extrafields->fetch_name_optionals_label($fichinter->table_element);
- $array_options = $extrafields->getOptionalsFromPost($fichinter->table_element);
- $fichinter->array_options = $array_options;
-
- $id = $fichinter->create($user);
- if ($id <= 0) {
- setEventMessages($fichinter->error, null, 'errors');
- }
- }
}
if (!$error) {
diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php
index fa4c7231de5..16030f0f95c 100644
--- a/htdocs/user/bank.php
+++ b/htdocs/user/bank.php
@@ -78,8 +78,8 @@ if (empty($account->userid)) {
// Define value to know what current user can do on users
-$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
-$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
+$canadduser = (!empty($user->admin) || $user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write);
+$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read);
$permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer));
// Ok if user->rights->salaries->read or user->rights->hrm->read
@@ -230,6 +230,24 @@ if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) {
}
}
+// update ref_employee
+if ($action == 'setref_employee' && $canadduser && !$cancel) {
+ $object->ref_employee = (string) GETPOST('ref_employee', 'alphanohtml');
+ $result = $object->update($user);
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+}
+
+// update national_registration_number
+if ($action == 'setnational_registration_number' && $canadduser && !$cancel) {
+ $object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml');
+ $result = $object->update($user);
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+}
+
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
// update default_c_exp_tax_cat
if ($action == 'setdefault_c_exp_tax_cat' && $canadduser) {
@@ -263,7 +281,7 @@ llxHeader(null, $langs->trans("BankAccounts"));
$head = user_prepare_head($object);
-if ($id && $bankid && $action == 'edit' && $user->rights->user->user->creer) {
+if ($id && $bankid && $action == 'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write)) {
print ' |