Merge branch 'develop' into fix_dev_multicompany
This commit is contained in:
commit
c976a4baef
19 changed files with 137 additions and 110 deletions
|
|
@ -6,6 +6,7 @@ English Dolibarr ChangeLog
|
|||
|
||||
For users:
|
||||
----------
|
||||
NEW: Need PHP 7.2 as minimum version
|
||||
NEW: Module datapolicy moved as stable (for anonimization features)
|
||||
NEW: #31723 - Improve project overview: Hide paid orders (#35524)
|
||||
NEW: #35700 : Throw an error when validating a propal, order, supplier with a product no more in sale/purchase… (#35709)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||

|
||||

|
||||
[](https://php.net/)
|
||||
[](https://php.net/)
|
||||
[](https://github.com/Dolibarr/dolibarr)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/5521)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,15 +30,6 @@
|
|||
* \brief Page with expense reports journal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -47,6 +38,14 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("commercial", "compta", "bills", "other", "accountancy", "trips", "errors"));
|
||||
|
|
@ -383,6 +382,7 @@ if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'b
|
|||
$bookkeeping->label_compte = $account_label;
|
||||
|
||||
$bookkeeping->label_operation = $bookkeepingstatic->accountingLabelForOperation($userstatic->name, '', $account_label);
|
||||
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ require '../../main.inc.php';
|
|||
* @var string $conffile // $conffile is defined into filefunc.inc.php
|
||||
* @var string $dolibarr_main_prod
|
||||
* @var string $dolibarr_main_document_root
|
||||
* @var string $dolibarr_main_restrict_os_commands
|
||||
* @var string $dolibarr_main_restrict_eval_methods
|
||||
* @var string $dolibarr_main_restrict_ip
|
||||
* @var string $dolibarr_main_db_pass
|
||||
* @var string $dolibarr_main_db_encrypted_pass
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
|
@ -387,6 +392,15 @@ if (empty($dolibarr_main_restrict_os_commands)) {
|
|||
print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'mysqldump, mysql, pg_dump, pg_restore, mariadb, mariadb-dump, clamdscan').')</span>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>$dolibarr_main_restrict_eval_methods</strong>: ';
|
||||
if (empty($dolibarr_main_restrict_eval_methods)) {
|
||||
print $langs->trans("None");
|
||||
} else {
|
||||
print $dolibarr_main_restrict_eval_methods;
|
||||
}
|
||||
print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'getDolGlobalString,getDolGlobalInt,getDolCurrency,fetchNoCompute,hasRight,isModEnabled,isStringVarMatching,abs,min,max,round,dol_now,dol_concat,preg_match').')</span>';
|
||||
print '<br>';
|
||||
|
||||
if (!getDolGlobalString('SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF')) {
|
||||
print '<strong>$dolibarr_main_db_pass</strong>: ';
|
||||
if (!empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
|
||||
|
|
|
|||
|
|
@ -316,11 +316,11 @@ $dolibarr_main_restrict_os_commands='mariadb-dump, mariadb, mysqldump, mysql, pg
|
|||
// ==================================
|
||||
// A whitelist of functions and methods to restrict the commands you can execute in a custom calculated fields, like "computed fields" of
|
||||
// extrafields or string conditions of extrafields.
|
||||
// Default value: 'getDolGlobalString,getDolGlobalInt,getDolCurrency,fetchNoCompute,hasRight,isModEnabled,isStringVarMatching,abs,round,dol_now,preg_match'
|
||||
// Default value: 'getDolGlobalString, getDolGlobalInt, getDolCurrency, fetchNoCompute, hasRight, isModEnabled, isStringVarMatching, abs, round, dol_now, preg_match'
|
||||
// Examples:
|
||||
// $dolibarr_main_restrict_eval_methods='getDolGlobalString,getDolGlobalInt,getDolCurrency,fetchNoCompute,hasRight,isModEnabled,isStringVarMatching,abs,min,max,round,dol_now,dol_concat,preg_match';
|
||||
// $dolibarr_main_restrict_eval_methods='getDolGlobalString, getDolGlobalInt, getDolCurrency, fetchNoCompute, hasRight, isModEnabled, isStringVarMatching, abs, min, max, round, dol_now, dol_concat, preg_match';
|
||||
//
|
||||
$dolibarr_main_restrict_eval_methods='getDolGlobalString,getDolGlobalInt,getDolCurrency,fetchNoCompute,hasRight,isModEnabled,isStringVarMatching,abs,min,max,round,dol_now,preg_match';
|
||||
$dolibarr_main_restrict_eval_methods='getDolGlobalString, getDolGlobalInt, getDolCurrency, fetchNoCompute, hasRight, isModEnabled, isStringVarMatching, abs, min, max, round, dol_now, preg_match';
|
||||
|
||||
// dolibarr_main_disabled_modules
|
||||
// ==================================
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ if ($action == 'encrypt') {
|
|||
$sql .= " AND te.".$attributekey." IS NOT NULL";
|
||||
$sql .= " AND te.".$attributekey." <> ''";
|
||||
if ($extrafields->attributes[$elementtype]['entityid'][$attributekey] == $conf->entity) {
|
||||
$sql .= " AND t.entity = ".getEntity($arrayofelement['table_element'], 0);
|
||||
$sql .= " AND t.entity = ".getEntity($arrayofelement['element'], 0);
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
|
|
|
|||
|
|
@ -58,6 +58,13 @@ class CLeadStatus extends CommonDict
|
|||
*/
|
||||
public $percent;
|
||||
|
||||
/**
|
||||
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}>
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"),
|
||||
'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Label of status"),
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -69,14 +76,6 @@ class CLeadStatus extends CommonDict
|
|||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}>
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"),
|
||||
'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Label of status"),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
|
|
|
|||
|
|
@ -750,7 +750,9 @@ class DolGraph
|
|||
foreach ($this->data as $x) { // Loop on each x
|
||||
for ($i = 0; $i < $nbseries; $i++) { // Loop on each series
|
||||
if (is_null($max)) {
|
||||
$max = $x[$i + 1]; // $i+1 because the index 0 is the legend
|
||||
if (isset($x[$i + 1])) {
|
||||
$max = $x[$i + 1]; // $i+1 because the index 0 is the legend
|
||||
}
|
||||
} elseif ($max < $x[$i + 1]) {
|
||||
$max = $x[$i + 1];
|
||||
}
|
||||
|
|
@ -780,7 +782,9 @@ class DolGraph
|
|||
foreach ($this->data as $x) { // Loop on each x
|
||||
for ($i = 0; $i < $nbseries; $i++) { // Loop on each series
|
||||
if (is_null($min)) {
|
||||
$min = $x[$i + 1]; // $i+1 because the index 0 is the legend
|
||||
if (isset($x[$i + 1])) {
|
||||
$min = $x[$i + 1]; // $i+1 because the index 0 is the legend
|
||||
}
|
||||
} elseif ($min > $x[$i + 1]) {
|
||||
$min = $x[$i + 1];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9289,7 +9289,7 @@ class Form
|
|||
// If table need a multientity restriction
|
||||
if (!empty($objecttmp->ismultientitymanaged)) {
|
||||
if ($objecttmp->ismultientitymanaged == 1) {
|
||||
$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
|
||||
$sql .= " AND t.entity IN (" . getEntity($objecttmp->element) . ")";
|
||||
}
|
||||
if (!is_numeric($objecttmp->ismultientitymanaged)) {
|
||||
$sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]);
|
||||
|
|
|
|||
|
|
@ -244,7 +244,11 @@ if ($user->socid > 0) { // Protection if external user
|
|||
$extrafields->fetch_name_optionals_label('all'); // We load all extrafields definitions for all objects
|
||||
//$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
if (!empty($object->table_element)) {
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
} else {
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
$search_component_params = array('');
|
||||
$search_component_params_hidden = trim(GETPOST('search_component_params_hidden', 'alphanohtml'));
|
||||
|
|
@ -353,7 +357,11 @@ $arrayofgroupby = array();
|
|||
$arrayofyaxis = array();
|
||||
$arrayofvaluesforgroupby = array();
|
||||
|
||||
$features = $object->element;
|
||||
if (!empty($object->element)) {
|
||||
$features = $object->element;
|
||||
} else {
|
||||
$features = '';
|
||||
}
|
||||
if (!empty($object->element_for_permission)) {
|
||||
$features = $object->element_for_permission;
|
||||
} else {
|
||||
|
|
@ -516,28 +524,30 @@ if (count($search_groupby)) {
|
|||
}
|
||||
|
||||
$regs = array();
|
||||
if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val];
|
||||
if (is_null($valuetranslated)) {
|
||||
$valuetranslated = $langs->transnoentitiesnoconv("UndefinedKey");
|
||||
}
|
||||
$valuetranslated = $langs->trans($valuetranslated);
|
||||
} elseif (preg_match('/integer:([^:]+):([^:]+)$/', $object->fields[$gvalwithoutprefix]['type'], $regs)) {
|
||||
$classname = $regs[1];
|
||||
$classpath = $regs[2];
|
||||
dol_include_once($classpath);
|
||||
if (class_exists($classname)) {
|
||||
$tmpobject = new $classname($db);
|
||||
'@phan-var-force CommonObject $tmpobject';
|
||||
$tmpobject->fetch($obj->val);
|
||||
foreach ($tmpobject->fields as $fieldkey => $field) {
|
||||
if ($field['showoncombobox']) {
|
||||
$valuetranslated = $tmpobject->$fieldkey;
|
||||
//if ($valuetranslated == '-') $valuetranslated = $langs->transnoentitiesnoconv("Unknown")
|
||||
break;
|
||||
}
|
||||
if (isset($object->fields[$gvalwithoutprefix])) {
|
||||
if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val];
|
||||
if (is_null($valuetranslated)) {
|
||||
$valuetranslated = $langs->transnoentitiesnoconv("UndefinedKey");
|
||||
}
|
||||
$valuetranslated = $langs->trans($valuetranslated);
|
||||
} elseif (preg_match('/integer:([^:]+):([^:]+)$/', $object->fields[$gvalwithoutprefix]['type'], $regs)) {
|
||||
$classname = $regs[1];
|
||||
$classpath = $regs[2];
|
||||
dol_include_once($classpath);
|
||||
if (class_exists($classname)) {
|
||||
$tmpobject = new $classname($db);
|
||||
'@phan-var-force CommonObject $tmpobject';
|
||||
$tmpobject->fetch($obj->val);
|
||||
foreach ($tmpobject->fields as $fieldkey => $field) {
|
||||
if ($field['showoncombobox']) {
|
||||
$valuetranslated = $tmpobject->$fieldkey;
|
||||
//if ($valuetranslated == '-') $valuetranslated = $langs->transnoentitiesnoconv("Unknown")
|
||||
break;
|
||||
}
|
||||
}
|
||||
//$valuetranslated = $tmpobject->ref.'eee';
|
||||
}
|
||||
//$valuetranslated = $tmpobject->ref.'eee';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -545,7 +555,7 @@ if (count($search_groupby)) {
|
|||
}
|
||||
// Add also the possible NULL value if field is a parent field that is not a strict join
|
||||
$tmpfield = explode('.', $gval);
|
||||
if ($tmpfield[0] != 't' || (is_array($object->fields[$tmpfield[1]]) && empty($object->fields[$tmpfield[1]]['notnull']))) {
|
||||
if ($tmpfield[0] != 't' || (isset($object->fields[$tmpfield[1]]) && is_array($object->fields[$tmpfield[1]]) && empty($object->fields[$tmpfield[1]]['notnull']))) {
|
||||
dol_syslog("The group by field ".$gval." may be null (because field is null or it is a left join), so we add __NULL__ entry in list of possible values");
|
||||
//var_dump($gval); var_dump($object->fields);
|
||||
$arrayofvaluesforgroupby['g_'.$gkey]['__NULL__'] = $langs->transnoentitiesnoconv("NotDefined");
|
||||
|
|
@ -1270,10 +1280,14 @@ if ($mode == 'graph') {
|
|||
$dir = $conf->user->dir_temp;
|
||||
dol_mkdir($dir);
|
||||
// $customreportkey may be defined when using customreports.php as an include
|
||||
$filenamekey = $dir.'/customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
|
||||
$fileurlkey = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
|
||||
if (!empty($object->element)) {
|
||||
$filenamekey = $dir.'/customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
|
||||
$fileurlkey = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
|
||||
}
|
||||
|
||||
$px1->draw($filenamekey, $fileurlkey);
|
||||
if (isset($filenamekey) && isset($fileurlkey)) {
|
||||
$px1->draw($filenamekey, $fileurlkey);
|
||||
}
|
||||
|
||||
$texttoshow = $langs->trans("NoRecordFound");
|
||||
if (!GETPOSTISSET('search_measures') || !GETPOSTISSET('search_xaxis')) {
|
||||
|
|
|
|||
|
|
@ -11938,10 +11938,10 @@ function dol_eval_standard($s, $hideerrors = 1, $onlysimplestring = '1')
|
|||
|
||||
// Set $dolibarr_main_restrict_eval_methods_array
|
||||
if (!isset($dolibarr_main_restrict_eval_methods)) {
|
||||
$dolibarr_main_restrict_eval_methods = 'getDolGlobalString,getDolGlobalInt,getDolCurrency,fetchNoCompute,hasRight,isModEnabled,isStringVarMatching,abs,min,max,round,dol_now,preg_match';
|
||||
$dolibarr_main_restrict_eval_methods = 'getDolGlobalString, getDolGlobalInt, getDolCurrency, fetchNoCompute, hasRight, isModEnabled, isStringVarMatching, abs, min, max, round, dol_now, preg_match';
|
||||
}
|
||||
//print '$dolibarr_main_restrict_eval_methods = '.$dolibarr_main_restrict_eval_methods."\n";
|
||||
$dolibarr_main_restrict_eval_methods_array = explode(',', $dolibarr_main_restrict_eval_methods);
|
||||
$dolibarr_main_restrict_eval_methods_array = explode(',', str_replace(" ", "", $dolibarr_main_restrict_eval_methods));
|
||||
|
||||
// Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing
|
||||
// We must accept with 1: '1 && getDolGlobalInt("doesnotexist1") && getDolGlobalString("MAIN_FEATURES_LEVEL")'
|
||||
|
|
@ -14651,7 +14651,7 @@ function getElementProperties($elementType)
|
|||
$classpath = $module . '/class';
|
||||
$classfile = $module;
|
||||
$classname = preg_replace('/det$/', 'Line', $element);
|
||||
if (in_array($module, array('expedition', 'propale', 'facture', 'contrat', 'fichinter', 'commandefournisseur'))) {
|
||||
if (in_array($module, array('expedition', 'propale', 'facture', 'contrat', 'fichinter', 'supplier_order', 'commandefournisseur'))) {
|
||||
$classname = preg_replace('/det$/', 'Ligne', $element);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ if (empty($reshook)) {
|
|||
$product_type,
|
||||
$rang,
|
||||
$lines[$i]->special_code,
|
||||
$objecttmp->origin,
|
||||
$objecttmp->origin_type,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line,
|
||||
$lines[$i]->fk_fournprice,
|
||||
|
|
|
|||
|
|
@ -1273,13 +1273,15 @@ if (!defined('NOREQUIRETRAN')) {
|
|||
|
||||
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
|
||||
// accesskey is for Mac: CTRL + Option + key for all browsers
|
||||
|
||||
// Note: $con->browser->os and $conf->browser->name may not be defined if we are in CLI mode.
|
||||
$conf->browser->stringforfirstkey = $langs->trans("KeyboardShortcut");
|
||||
if ($conf->browser->os == 'macintosh') {
|
||||
if (!empty($conf->browser->os) && $conf->browser->os == 'macintosh') {
|
||||
$conf->browser->stringforfirstkey .= ' CTRL + Option +';
|
||||
} else {
|
||||
if ($conf->browser->name == 'chrome') {
|
||||
if (!empty($conf->browser->name) && $conf->browser->name == 'chrome') {
|
||||
$conf->browser->stringforfirstkey .= ' ALT +';
|
||||
} elseif ($conf->browser->name == 'firefox') {
|
||||
} elseif (!empty($conf->browser->name) && $conf->browser->name == 'firefox') {
|
||||
$conf->browser->stringforfirstkey .= ' ALT + SHIFT +';
|
||||
} else {
|
||||
$conf->browser->stringforfirstkey .= ' CTL +';
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ if ($action == 'addtime' && $user->hasRight('projet', 'lire') && GETPOST('formfi
|
|||
}
|
||||
}
|
||||
|
||||
if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
|
||||
if (!$updateoftaskdone && GETPOSTISSET($taskid.'progress')) { // Check to update progress if no update were done on task.
|
||||
$object->fetch($tmptaskid);
|
||||
//var_dump($object->progress);
|
||||
//var_dump(GETPOST($tmptaskid . 'progress', 'int')); exit;
|
||||
|
|
|
|||
|
|
@ -376,8 +376,8 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
|
|||
$currencyCodeType = strtoupper($object->currency);
|
||||
$paymentmethodstripeid = $object->payment_method;
|
||||
$customer_id = $object->customer;
|
||||
$invoice_id = "";
|
||||
$supplierinvoice_id = "";
|
||||
$invoice_id = 0;
|
||||
$supplierinvoice_id = 0;
|
||||
$salary_id = "";
|
||||
$paymentTypeCode = ""; // payment type according to Stripe
|
||||
$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
|
||||
|
|
@ -656,14 +656,16 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
|
|||
if (!$error) {
|
||||
if (getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION')) {
|
||||
// If option to send email after confirmation of direct debit is on, we send the email (template must exists
|
||||
$labeltouse = getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION'); // Example: 'InvoicePaymentSuccess'
|
||||
$labeltouse = getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION');
|
||||
// Example: $labeltouse = 'InvoicePaymentSuccess'
|
||||
|
||||
$invoice = new Facture($db);
|
||||
$invoice->fetch($invoice_id);
|
||||
$invoice->fetch_thirdparty();
|
||||
|
||||
// Set output language
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang(empty($invoice->thirdparty->default_lang) ? $mysoc->default_lang : $invoice->thirdparty->default_lang);
|
||||
$outputlangs->loadLangs(array("main", "members", "bills"));
|
||||
|
||||
// Get email content from template
|
||||
|
|
@ -672,16 +674,18 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
|
|||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail=new FormMail($db);
|
||||
|
||||
if (! empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
|
||||
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$appli = $mysoc->name;
|
||||
|
||||
$subject = '['.$appli.'] Invoice direct debit payment recevied';
|
||||
$msg = 'An invoice direct debit payment for invoice '.$invoice->ref.' has been recevied';
|
||||
if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
||||
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $invoice);
|
||||
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
|
|
@ -692,11 +696,12 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
|
|||
|
||||
if (is_array($invoice->linkedObjects['contrat']) && count($invoice->linkedObjects['contrat']) > 0) {
|
||||
//dol_sort_array($object->linkedObjects['facture'], 'date');
|
||||
foreach ($invoice->linkedObjects['contrat'] as $idcontract => $contract) {
|
||||
$substitutionarray['__CONTRACT_REF__']=$contract->ref_customer;
|
||||
$substitutionarray['__REFCLIENT__']=$contract->ref_customer; // For backward compatibility
|
||||
$substitutionarray['__REF_CLIENT__']=$contract->ref_customer;
|
||||
$substitutionarray['__REF_CUSTOMER__']=$contract->ref_customer;
|
||||
foreach ($invoice->linkedObjects['contrat'] as $contract) {
|
||||
/** @var Contrat $contract */
|
||||
$substitutionarray['__CONTRACT_REF__'] = $contract->ref_customer;
|
||||
$substitutionarray['__REFCLIENT__'] = $contract->ref_customer; // For backward compatibility
|
||||
$substitutionarray['__REF_CLIENT__'] = $contract->ref_customer;
|
||||
$substitutionarray['__REF_CUSTOMER__'] = $contract->ref_customer;
|
||||
$foundcontract = $contract;
|
||||
break;
|
||||
}
|
||||
|
|
@ -704,40 +709,31 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
|
|||
|
||||
dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__='.$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']);
|
||||
|
||||
$urlforsellyoursaasaccount = getRootUrlForAccount($foundcontract);
|
||||
if ($urlforsellyoursaasaccount) {
|
||||
$tmpforurl=preg_replace('/.*document.php/', '', $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']);
|
||||
if ($tmpforurl) {
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']=$urlforsellyoursaasaccount.'/source/document.php'.$tmpforurl;
|
||||
} else {
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']=$urlforsellyoursaasaccount;
|
||||
}
|
||||
}
|
||||
|
||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
|
||||
|
||||
// Attach a file ?
|
||||
$file='';
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
if (is_object($invoice)) {
|
||||
$invoicediroutput = $conf->invoice->dir_output;
|
||||
$fileparams = dol_most_recent_file($invoicediroutput . '/' . $invoice->ref, preg_quote($invoice->ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
$file = ''; // Disable attachment of invoice in emails
|
||||
|
||||
if ($file) {
|
||||
$listofpaths=array($file);
|
||||
$listofnames=array(basename($file));
|
||||
$listofmimes=array(dol_mimetype($file));
|
||||
}
|
||||
/*
|
||||
$invoicediroutput = $conf->invoice->dir_output;
|
||||
$fileparams = dol_most_recent_file($invoicediroutput . '/' . $invoice->ref, preg_quote($invoice->ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
$file = ''; // Disable attachment of invoice in emails
|
||||
|
||||
if ($file) {
|
||||
$listofpaths=array($file);
|
||||
$listofnames=array(basename($file));
|
||||
$listofmimes=array(dol_mimetype($file));
|
||||
}
|
||||
*/
|
||||
|
||||
$from = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
|
||||
|
||||
$trackid = 'inv'.$invoice->id;
|
||||
$moreinheader = 'X-Dolibarr-Info: doTakeStripePaymentForThirdParty'."\r\n";
|
||||
$moreinheader = 'X-Dolibarr-Info: public stripe ipn.php'."\r\n";
|
||||
$addr_cc = '';
|
||||
if (!empty($invoice->thirdparty->array_options['options_emailccinvoice'])) {
|
||||
dol_syslog("We add the recipient ".$invoice->thirdparty->array_options['options_emailccinvoice']." as CC", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -1917,7 +1917,6 @@ if ($action == 'create' && $permissiontoadd) {
|
|||
|
||||
$typeobject = '';
|
||||
if (!empty($object->origin) && $object->origin_id > 0) {
|
||||
$object->origin = 'CommandeFournisseur';
|
||||
$typeobject = $object->origin;
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
|
|
@ -1999,7 +1998,7 @@ if ($action == 'create' && $permissiontoadd) {
|
|||
$objectsrc = new Propal($db);
|
||||
$objectsrc->fetch($object->origin_object->id);
|
||||
}
|
||||
if ($typeobject == 'CommandeFournisseur' && $object->origin_object->id && isModEnabled("supplier_order")) {
|
||||
if (($typeobject == 'supplier_order' || $typeobject == 'CommandeFournisseur') && $object->origin_object->id && isModEnabled("supplier_order")) {
|
||||
$objectsrc = new CommandeFournisseur($db);
|
||||
$objectsrc->fetch($object->origin_object->id);
|
||||
}
|
||||
|
|
@ -2086,7 +2085,7 @@ if ($action == 'create' && $permissiontoadd) {
|
|||
print "</td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
if ($typeobject == 'CommandeFournisseur' && $object->origin_object->id && isModEnabled("propal")) {
|
||||
if (($typeobject == 'supplier_order' || $typeobject == 'CommandeFournisseur') && $object->origin_object->id && isModEnabled("propal")) {
|
||||
print '<tr><td>';
|
||||
print $langs->trans("SupplierOrder").'</td>';
|
||||
print '<td colspan="3">';
|
||||
|
|
@ -2477,26 +2476,25 @@ if ($action == 'create' && $permissiontoadd) {
|
|||
// Get list of products already sent for same source object into $alreadysent
|
||||
$alreadysent = array();
|
||||
|
||||
//$origin = 'commande_fournisseur';
|
||||
if (empty($origin)) {
|
||||
$origin = 'supplier_order';
|
||||
}
|
||||
|
||||
if ($origin && $origin_id > 0) {
|
||||
if ($origin_id > 0) {
|
||||
$sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end";
|
||||
$sql .= ", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
|
||||
$sql .= ", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
|
||||
//if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received";
|
||||
$sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
|
||||
$sql .= ', p.description as product_desc';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as ed";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."reception as e";
|
||||
$sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj";
|
||||
//if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line";
|
||||
$sql .= ", ".MAIN_DB_PREFIX.(($origin == 'supplier_order') ? 'commande_fournisseur' : $origin)."det as obj";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid";
|
||||
$sql .= " WHERE e.entity IN (".getEntity('reception').")";
|
||||
$sql .= " AND obj.fk_commande = ".((int) $origin_id);
|
||||
$sql .= " AND obj.rowid = ed.fk_elementdet";
|
||||
$sql .= " AND ed.fk_reception = e.rowid";
|
||||
$sql .= " AND ed.fk_reception !=".((int) $object->id);
|
||||
//if ($filter) $sql.= $filter;
|
||||
$sql .= " ORDER BY obj.fk_product";
|
||||
|
||||
dol_syslog("get list of reception lines", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ class Reception extends CommonObject
|
|||
$sql .= ", fk_incoterms, location_incoterms";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'(PROV)'";
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
$sql .= ", ".((int) $this->entity);
|
||||
$sql .= ", ".($this->ref_supplier ? "'".$this->db->escape($this->ref_supplier)."'" : "null");
|
||||
$sql .= ", '".$this->db->idate($this->date_creation)."'";
|
||||
$sql .= ", ".((int) $user->id);
|
||||
|
|
@ -746,7 +746,7 @@ class Reception extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!$error && $this->origin_id > 0) {
|
||||
// Change status of purchase order to "reception in process" or "totally received"
|
||||
$status = $this->getStatusDispatch();
|
||||
if ($status < 0) {
|
||||
|
|
|
|||
|
|
@ -322,7 +322,6 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, '', '', 'mod-reception page-
|
|||
if ($id > 0 || !empty($ref)) {
|
||||
$typeobject = '';
|
||||
if (!empty($object->origin) && $object->origin_id > 0) {
|
||||
$object->origin = 'CommandeFournisseur';
|
||||
$typeobject = $object->origin;
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
|
|
@ -418,7 +417,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
print "</td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
if ($typeobject == 'CommandeFournisseur' && $object->origin_object->id && isModEnabled("propal")) {
|
||||
if (($typeobject == 'supplier_order' || $typeobject == 'order_supplier') && $object->origin_object->id && isModEnabled("propal")) {
|
||||
print '<tr><td>';
|
||||
print $langs->trans("SupplierOrder").'</td>';
|
||||
print '<td colspan="3">';
|
||||
|
|
|
|||
|
|
@ -197,13 +197,13 @@ class Workstations extends DolibarrApi
|
|||
{
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
/** @var Workstation $object */
|
||||
|
||||
unset($object->statut);
|
||||
|
||||
unset($object->regeximgext);
|
||||
unset($object->price_by_qty);
|
||||
unset($object->prices_by_qty_id);
|
||||
unset($object->libelle);
|
||||
unset($object->product_id_already_linked);
|
||||
unset($object->reputations);
|
||||
unset($object->db);
|
||||
|
|
|
|||
Loading…
Reference in a new issue