mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 09:08:09 +01:00
clean code (#36260)
* clean code * clean code * clean code * clean code * fix $val might not be defined * fix phpstan errors reported * fix phpstan errors reported * fix phpstan errors reported * fix phpstan errors reported * fix phpstan errors reported * fix phpstan errors reported * ignore phpstan reported for later * clean code * clean code * clean code * clean * test
This commit is contained in:
@@ -150,6 +150,12 @@ parameters:
|
||||
count: 3
|
||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$obj might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always false\.$#'
|
||||
identifier: if.alwaysFalse
|
||||
@@ -840,18 +846,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/admin/spip.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always true\.$#'
|
||||
identifier: if.alwaysTrue
|
||||
count: 2
|
||||
path: ../../../htdocs/admin/stocktransfer.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$setupnotempty in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
count: 1
|
||||
path: ../../../htdocs/admin/stocktransfer.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always true\.$#'
|
||||
identifier: if.alwaysTrue
|
||||
@@ -3594,6 +3588,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/compta/resultat/clientfourn.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$annee might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/compta/resultat/index.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$description might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
@@ -4380,12 +4380,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/core/actions_massactions.inc.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$listofobjectthirdparties in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
count: 1
|
||||
path: ../../../htdocs/core/actions_massactions.inc.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$triggername in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
@@ -4416,6 +4410,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/core/actions_setmoduleoptions.inc.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$tmpdir might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/core/actions_setmoduleoptions.inc.php
|
||||
|
||||
-
|
||||
message: '#^Loose comparison using \=\= between ''directory'' and ''directory'' will always evaluate to true\.$#'
|
||||
identifier: equal.alwaysTrue
|
||||
@@ -5112,12 +5112,6 @@ parameters:
|
||||
count: 2
|
||||
path: ../../../htdocs/core/class/cleadstatus.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonDict\:\:\$id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/core/class/cleadstatus.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Comment\:\:\$description \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
@@ -5448,42 +5442,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/core/class/conf.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonDict\:\:\$id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/core/class/cproductnature.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Cstate\:\:\$code_departement \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 4
|
||||
path: ../../../htdocs/core/class/cstate.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Cstate\:\:\$name \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/core/class/cstate.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Cstate\:\:\$nom \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/core/class/cstate.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Cstate\:\:\$rowid \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/core/class/cstate.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonDict\:\:\$id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/core/class/ctypent.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Ctypent\:\:\$libelle \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
@@ -5520,12 +5484,6 @@ parameters:
|
||||
count: 4
|
||||
path: ../../../htdocs/core/class/cunits.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonDict\:\:\$id \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/core/class/cunits.class.php
|
||||
|
||||
-
|
||||
message: '#^Constructor of class DolEditor has an unused parameter \$notused\.$#'
|
||||
identifier: constructor.unusedParameter
|
||||
@@ -6594,6 +6552,12 @@ parameters:
|
||||
count: 2
|
||||
path: ../../../htdocs/core/lib/agenda.lib.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$s might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/core/lib/bank.lib.php
|
||||
|
||||
-
|
||||
message: '#^Left side of && is always true\.$#'
|
||||
identifier: booleanAnd.leftAlwaysTrue
|
||||
@@ -7386,6 +7350,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$fac might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
|
||||
|
||||
-
|
||||
message: '#^Access to constant TYPE_NON on an unknown class Sprain\\SwissQrBill\\DataGroup\\Element\\PaymentReference\.$#'
|
||||
identifier: class.notFound
|
||||
@@ -12246,6 +12216,12 @@ parameters:
|
||||
count: 4
|
||||
path: ../../../htdocs/product/stats/card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$year might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 3
|
||||
path: ../../../htdocs/product/stats/card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
@@ -12540,6 +12516,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/product/stock/movement_list.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$productlabelselected might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/product/stock/movement_list.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$socid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
||||
@@ -106,7 +106,7 @@ class Adherent extends CommonObject
|
||||
public $civility_code;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @var string Human readable civility
|
||||
*/
|
||||
public $civility;
|
||||
|
||||
@@ -210,7 +210,7 @@ class Adherent extends CommonObject
|
||||
public $datevalid;
|
||||
|
||||
/**
|
||||
* @var string gender
|
||||
* @var ?string gender
|
||||
*/
|
||||
public $gender;
|
||||
|
||||
@@ -268,7 +268,7 @@ class Adherent extends CommonObject
|
||||
public $first_subscription_date_end;
|
||||
|
||||
/**
|
||||
* @var int|string|null date
|
||||
* @var null|float|string amount
|
||||
*/
|
||||
public $first_subscription_amount;
|
||||
|
||||
@@ -288,7 +288,7 @@ class Adherent extends CommonObject
|
||||
public $last_subscription_date_end;
|
||||
|
||||
/**
|
||||
* @var null|float|string date, null until set
|
||||
* @var null|float|string amount, null until set
|
||||
*/
|
||||
public $last_subscription_amount;
|
||||
|
||||
@@ -810,7 +810,9 @@ class Adherent extends CommonObject
|
||||
// Clean parameters
|
||||
$this->lastname = trim($this->lastname) ? trim($this->lastname) : trim($this->lastname);
|
||||
$this->firstname = trim($this->firstname) ? trim($this->firstname) : trim($this->firstname);
|
||||
$this->gender = trim($this->gender);
|
||||
if (isset($this->gender)) {
|
||||
$this->gender = trim($this->gender);
|
||||
}
|
||||
// $this->address = ($this->address ? $this->address : $this->address);
|
||||
// $this->zip = ($this->zip ? $this->zip : $this->zip);
|
||||
// $this->town = ($this->town ? $this->town : $this->town);
|
||||
@@ -3097,10 +3099,10 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Load type info information in the member object
|
||||
* Load type info information in the member object
|
||||
*
|
||||
* @param int $id Id of member to load
|
||||
* @return void
|
||||
* @param int $id Id of member to load
|
||||
* @return void
|
||||
*/
|
||||
public function info($id)
|
||||
{
|
||||
@@ -3200,7 +3202,7 @@ class Adherent extends CommonObject
|
||||
global $conf;
|
||||
|
||||
//Only valid members
|
||||
if ($this->statut != self::STATUS_VALIDATED) {
|
||||
if ($this->status != self::STATUS_VALIDATED) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->datefin) {
|
||||
|
||||
@@ -63,7 +63,6 @@ $arrayofparameters = array(
|
||||
);
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
|
||||
/*
|
||||
@@ -113,6 +112,7 @@ if ($action == 'updateMask') {
|
||||
|
||||
$module = new $classname($db);
|
||||
'@phan-var-force ModelePDFStockTransfer $module';
|
||||
/** @var ModelePDFStockTransfer $module */
|
||||
|
||||
if ($module->write_file($tmpobject, $langs) > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
|
||||
@@ -181,309 +181,248 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'stock');
|
||||
$head = stocktransferAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'settings', '', -1, "stocktransfer@stocktransfer");
|
||||
|
||||
|
||||
/*if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td></td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($key).'"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
} else {
|
||||
if (!empty($arrayofparameters))
|
||||
{
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td></td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
$setupnotempty++;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td>'.getDolGlobalString($key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
$moduledir = 'stocktransfer';
|
||||
$myTmpObjects = array();
|
||||
$myTmpObjects[$moduledir] = array('includerefgeneration' => 1, 'includedocgeneration' => 1, 'class' => 'StockTransfer');
|
||||
|
||||
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
if ($myTmpObjectArray['includerefgeneration']) {
|
||||
// Orders Numbering model
|
||||
$setupnotempty++;
|
||||
// Orders Numbering model
|
||||
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
|
||||
|
||||
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
clearstatcache();
|
||||
|
||||
clearstatcache();
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
'@phan-var-force ModeleNumRefStockTransfer $module';
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
continue;
|
||||
}
|
||||
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($module->isEnabled()) {
|
||||
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||
print $module->info($langs);
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
} elseif ($tmp == 'NotConfigured') {
|
||||
print $langs->trans($tmp);
|
||||
} else {
|
||||
print $tmp;
|
||||
}
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.$file.'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$nameofclass = $myTmpObjectArray['class'];
|
||||
$mytmpinstance = new $nameofclass($db);
|
||||
$mytmpinstance->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
|
||||
$nextval = $module->getNextValue($mytmpinstance);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
|
||||
$nextval = $langs->trans($nextval);
|
||||
}
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</table></div><br>\n";
|
||||
|
||||
// Document templates generators
|
||||
$type = strtolower($myTmpObjectKey);
|
||||
|
||||
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
|
||||
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$db->escape($type)."'";
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows) {
|
||||
$array = $db->fetch_array($resql);
|
||||
if (is_array($array)) {
|
||||
array_push($def, $array[0]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$realpath = $reldir."core/modules/".$moduledir.$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
$filelist = array();
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
'@phan-var-force ModeleNumRefStockTransfer $module';
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
continue;
|
||||
}
|
||||
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($module->isEnabled()) {
|
||||
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||
print $module->info($langs);
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
} elseif ($tmp == 'NotConfigured') {
|
||||
print $langs->trans($tmp);
|
||||
} else {
|
||||
print $tmp;
|
||||
}
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.$file.'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$nameofclass = $myTmpObjectArray['class'];
|
||||
$mytmpinstance = new $nameofclass($db);
|
||||
$mytmpinstance->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
|
||||
$nextval = $module->getNextValue($mytmpinstance);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
|
||||
$nextval = $langs->trans($nextval);
|
||||
}
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</table></div><br>\n";
|
||||
}
|
||||
arsort($filelist);
|
||||
|
||||
if ($myTmpObjectArray['includedocgeneration']) {
|
||||
// Document templates generators
|
||||
$setupnotempty++;
|
||||
$type = strtolower($myTmpObjectKey);
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
if (file_exists($dir.'/'.$file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$db->escape($type)."'";
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows) {
|
||||
$array = $db->fetch_array($resql);
|
||||
if (is_array($array)) {
|
||||
array_push($def, $array[0]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
'@phan-var-force ModelePDFStockTransfer $module';
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$realpath = $reldir."core/modules/".$moduledir.$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
$filelist = array();
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
if (file_exists($dir.'/'.$file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
'@phan-var-force ModelePDFStockTransfer $module';
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
$modulequalified = 0;
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
} else {
|
||||
print $module->description;
|
||||
}
|
||||
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
||||
$modulequalified = 0;
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.urlencode($name).'&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
} else {
|
||||
print $module->description;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.urlencode($name).'&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = strtoupper($myTmpObjectKey).'_ADDON_PDF';
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode($myTmpObjectKey).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf') {
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td class="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'generic').'</a>';
|
||||
} else {
|
||||
print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = strtoupper($myTmpObjectKey).'_ADDON_PDF';
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode($myTmpObjectKey).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf') {
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td class="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'generic').'</a>';
|
||||
} else {
|
||||
print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -491,14 +430,14 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table></div>';
|
||||
}
|
||||
|
||||
print '</table></div>';
|
||||
}
|
||||
|
||||
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("OtherOptions", $myTmpObjectKey), '', '');
|
||||
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
@@ -527,11 +466,6 @@ print '</td></tr>';
|
||||
print '</table></div>';
|
||||
|
||||
|
||||
|
||||
if (empty($setupnotempty)) {
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
|
||||
// Page end
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -91,7 +92,9 @@ class Ccountry extends CommonDict
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if (empty($this->id)) {
|
||||
return -1;
|
||||
}
|
||||
// Clean parameters
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
@@ -117,11 +120,11 @@ class Ccountry extends CommonDict
|
||||
$sql .= "label,";
|
||||
$sql .= "active";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->rowid) ? 'NULL' : "'".$this->db->escape($this->rowid)."'").",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
|
||||
$sql .= " ".(!isset($this->code_iso) ? 'NULL' : "'".$this->db->escape($this->code_iso)."'").",";
|
||||
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape((string) $this->active)."'");
|
||||
$sql .= (int) $this->id;
|
||||
$sql .= ", ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'");
|
||||
$sql .= ", ".(!isset($this->code_iso) ? 'NULL' : "'".$this->db->escape($this->code_iso)."'");
|
||||
$sql .= ", ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'");
|
||||
$sql .= ", ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape((string) $this->active)."'");
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
@@ -188,12 +191,12 @@ class Ccountry extends CommonDict
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->id = (int) $obj->rowid;
|
||||
$this->code = $obj->code;
|
||||
$this->code_iso = $obj->code_iso;
|
||||
$this->label = $obj->label;
|
||||
$this->eec = $obj->eec;
|
||||
$this->active = $obj->active;
|
||||
$this->active = (int) $obj->active;
|
||||
$this->favorite = $obj->favorite;
|
||||
$this->numeric_code = $obj->numeric_code;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Florian HENRY <florian.henry@scopen.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Florian HENRY <florian.henry@scopen.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -78,6 +79,9 @@ class CLeadStatus extends CommonDict
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
if (empty($this->id)) {
|
||||
return -1;
|
||||
}
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".$this->db->prefix().$this->table_element."(";
|
||||
$sql .= "rowid,";
|
||||
@@ -87,8 +91,8 @@ class CLeadStatus extends CommonDict
|
||||
$sql .= "percent,";
|
||||
$sql .= "active";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->id) ? 'NULL' : ((int) $this->id)).",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : ((int) $this->code)).",";
|
||||
$sql .= (int) $this->id . ",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape(trim($this->code))."'").",";
|
||||
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape(trim($this->label))."'").",";
|
||||
$sql .= " ".(!isset($this->position) ? 'NULL' : (int) $this->position).",";
|
||||
$sql .= " ".(!isset($this->percent) ? 'NULL' : (float) $this->percent).",";
|
||||
@@ -146,12 +150,12 @@ class CLeadStatus extends CommonDict
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->id = (int) $obj->rowid;
|
||||
$this->code = $obj->code;
|
||||
$this->label = $obj->label;
|
||||
$this->position = $obj->position;
|
||||
$this->percent = $obj->percent;
|
||||
$this->active = $obj->active;
|
||||
$this->active = (int) $obj->active;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@@ -1201,7 +1201,7 @@ class Conf extends stdClass
|
||||
}
|
||||
if (isset($this->projet)) {
|
||||
$this->projet->warning_delay = (getDolGlobalInt('MAIN_DELAY_PROJECT_TO_CLOSE', 7) * 86400);
|
||||
$this->projet->task = new StdClass();
|
||||
$this->projet->task = new stdClass();
|
||||
$this->projet->task->warning_delay = (getDolGlobalInt('MAIN_DELAY_TASKS_TODO', 7) * 86400);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Florian HENRY <florian.henry@scopen.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Florian HENRY <florian.henry@scopen.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -68,8 +69,9 @@ class CProductNature extends CommonDict
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($this->id)) {
|
||||
return -1;
|
||||
}
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".$this->db->prefix().$this->table_element."(";
|
||||
$sql .= "rowid,";
|
||||
@@ -77,7 +79,7 @@ class CProductNature extends CommonDict
|
||||
$sql .= "label,";
|
||||
$sql .= "active";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->id) ? 'NULL' : ((int) $this->id)).",";
|
||||
$sql .= (int) $this->id . ",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : ((int) $this->code)).",";
|
||||
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape(trim($this->label))."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : ((int) $this->active)).",";
|
||||
@@ -110,8 +112,6 @@ class CProductNature extends CommonDict
|
||||
*/
|
||||
public function fetch($id, $code = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.code,";
|
||||
@@ -134,7 +134,7 @@ class CProductNature extends CommonDict
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->id = (int) $obj->rowid;
|
||||
$this->code = $obj->code;
|
||||
$this->label = $obj->label;
|
||||
$this->active = $obj->active;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -31,24 +32,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondict.class.php';
|
||||
*/
|
||||
class Cstate extends CommonDict
|
||||
{
|
||||
/**
|
||||
* @var int The ID of the state
|
||||
*/
|
||||
public $rowid;
|
||||
|
||||
/**
|
||||
* @var string The code of the state
|
||||
* @deprecated Use $code
|
||||
* (ex: LU0011, MA12, 07, 0801, etc.)
|
||||
*/
|
||||
public $code_departement;
|
||||
|
||||
/**
|
||||
* @var string The name of the state
|
||||
* @var ?string The name of the state
|
||||
*/
|
||||
public $name = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @var ?string
|
||||
* @deprecated
|
||||
* @see $name
|
||||
*/
|
||||
@@ -77,20 +74,20 @@ class Cstate extends CommonDict
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if (empty($this->id)) {
|
||||
return -1;
|
||||
}
|
||||
// Clean parameters
|
||||
if (isset($this->code_departement)) {
|
||||
$this->code_departement = trim($this->code_departement);
|
||||
}
|
||||
if (isset($this->nom)) {
|
||||
$this->nom = trim($this->nom);
|
||||
if (isset($this->name)) {
|
||||
$this->name = trim($this->name);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = (int) $this->active;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_departements(";
|
||||
$sql .= "rowid,";
|
||||
@@ -98,9 +95,9 @@ class Cstate extends CommonDict
|
||||
$sql .= "nom,";
|
||||
$sql .= "active";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->rowid) ? 'NULL' : "'".$this->db->escape((string) $this->rowid)."'").",";
|
||||
$sql .= (int) $this->id . ",";
|
||||
$sql .= " ".(!isset($this->code_departement) ? 'NULL' : "'".$this->db->escape($this->code_departement)."'").",";
|
||||
$sql .= " ".(!isset($this->nom) ? 'NULL' : "'".$this->db->escape($this->nom)."'").",";
|
||||
$sql .= " ".(!isset($this->name) ? 'NULL' : "'".$this->db->escape($this->name)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape((string) $this->active)."'");
|
||||
$sql .= ")";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -65,13 +66,12 @@ class Ctypent extends CommonDict
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->id)) {
|
||||
$this->id = (int) $this->id;
|
||||
if (empty($this->id)) {
|
||||
return -1;
|
||||
}
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
@@ -97,10 +97,10 @@ class Ctypent extends CommonDict
|
||||
$sql .= "active,";
|
||||
$sql .= "module";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->id) ? 'NULL' : "'".$this->db->escape((string) $this->id)."'").",";
|
||||
$sql .= (int) $this->id . ",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
|
||||
$sql .= " ".(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape((string) $this->active)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : (int) $this->active).",";
|
||||
$sql .= " ".(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'");
|
||||
$sql .= ")";
|
||||
|
||||
@@ -163,11 +163,11 @@ class Ctypent extends CommonDict
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->id;
|
||||
$this->id = (int) $obj->id;
|
||||
$this->code = $obj->code;
|
||||
$this->libelle = $obj->label;
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->active = $obj->active;
|
||||
$this->active = (int) $obj->active;
|
||||
$this->module = $obj->module;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -164,19 +164,13 @@ class Ctyperesource extends CommonDict
|
||||
if ($numrows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->id = (int) $obj->rowid;
|
||||
|
||||
$this->code = $obj->code;
|
||||
$this->label = $obj->label;
|
||||
$this->active = $obj->active;
|
||||
$this->active = (int) $obj->active;
|
||||
}
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// fetch optionals attributes and labels
|
||||
// $this->fetch_optionals();
|
||||
|
||||
// $this->fetch_lines();
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
@@ -92,8 +92,8 @@ class CUnits extends CommonDict
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->id)) {
|
||||
$this->id = (int) $this->id;
|
||||
if (empty($this->id)) {
|
||||
return -1;
|
||||
}
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
@@ -126,7 +126,7 @@ class CUnits extends CommonDict
|
||||
$sql .= "unit_type,";
|
||||
$sql .= "scale";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->id) ? 'NULL' : "'".$this->db->escape((string) $this->id)."'").",";
|
||||
$sql .= (int) $this->id . ",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
|
||||
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").",";
|
||||
$sql .= " ".(!isset($this->short_label) ? 'NULL' : "'".$this->db->escape($this->short_label)."'").",";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -651,7 +651,7 @@ class DoliDBSqlite3 extends DoliDB
|
||||
*/
|
||||
public function escape($stringtoencode)
|
||||
{
|
||||
return Sqlite3::escapeString($stringtoencode);
|
||||
return SQLite3::escapeString($stringtoencode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -622,6 +622,7 @@ function isASecretKey($keyname)
|
||||
*/
|
||||
function num2Alpha($n)
|
||||
{
|
||||
$r = '';
|
||||
for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) {
|
||||
$r = chr($n % 26 + 0x41) . $r;
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Call hook printUnderHeaderPDFline
|
||||
$parameters = array(
|
||||
'object' => $object,
|
||||
'i' => $i,
|
||||
// 'i' => $i, // we aren't in lines
|
||||
'pdf' => &$pdf,
|
||||
'outputlangs' => $outputlangs,
|
||||
'hidedetails' => $hidedetails
|
||||
|
||||
@@ -579,7 +579,7 @@ class pdf_octopus extends ModelePDFFactures
|
||||
// Call hook printUnderHeaderPDFline
|
||||
$parameters = array(
|
||||
'object' => $object,
|
||||
'i' => $i,
|
||||
// 'i' => $i, // we aren't in lines
|
||||
'pdf' => &$pdf,
|
||||
'outputlangs' => $outputlangs,
|
||||
'hidedetails' => $hidedetails
|
||||
|
||||
@@ -510,7 +510,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Call hook printUnderHeaderPDFline
|
||||
$parameters = array(
|
||||
'object' => $object,
|
||||
'i' => $i,
|
||||
// 'i' => $i, // we aren't in lines
|
||||
'pdf' => &$pdf,
|
||||
'outputlangs' => $outputlangs,
|
||||
'hidedetails' => $hidedetails
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2022-2024 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -133,21 +134,26 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Order classify billed proposal
|
||||
if ($action == 'ORDER_CLASSIFY_BILLED') {
|
||||
if ($action == 'ORDER_CLASSIFY_BILLED' && $object instanceof Commande) {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (isModEnabled("propal") && !empty($conf->workflow->enabled) && getDolGlobalString('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL')) {
|
||||
$object->fetchObjectLinked(0, 'propal', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects['propal'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) {
|
||||
/** @var Propal $element */
|
||||
if ($element->status == Propal::STATUS_SIGNED || $element->status == Propal::STATUS_BILLED) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
/** @var Propal $element */
|
||||
$ret = $element->classifyBilled($user);
|
||||
if ($ret < 0) {
|
||||
$this->setErrorsFromObject($element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +162,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// classify billed order & billed propososal
|
||||
if ($action == 'BILL_VALIDATE') {
|
||||
if ($action == 'BILL_VALIDATE' && $object instanceof Facture) {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// First classify billed the order to allow the proposal classify process
|
||||
@@ -165,14 +171,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['commande'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) {
|
||||
/** @var Commande $element */
|
||||
if ($element->status == Commande::STATUS_VALIDATED || $element->status == Commande::STATUS_SHIPMENTONPROCESS || $element->status == Commande::STATUS_CLOSED) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
/** @var Commande $element */
|
||||
$ret = $element->classifyBilled($user);
|
||||
if ($ret < 0) {
|
||||
$this->setErrorsFromObject($element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,14 +195,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['propal'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) {
|
||||
/** @var Propal $element */
|
||||
if ($element->status == Propal::STATUS_SIGNED || $element->status == Propal::STATUS_BILLED) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
/** @var Propal $element */
|
||||
$ret = $element->classifyBilled($user);
|
||||
if ($ret < 0) {
|
||||
$this->setErrorsFromObject($element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,6 +219,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['shipping'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['shipping'] as $element) {
|
||||
/** @var Expedition $element */
|
||||
if ($element->statut == Expedition::STATUS_VALIDATED) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
@@ -210,6 +227,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if (price2num($totalonlinkedelements, 'MT') == price2num($object->total_ht, 'MT')) {
|
||||
foreach ($object->linkedObjects['shipping'] as $element) {
|
||||
/** @var Expedition $element */
|
||||
$ret = $element->setClosed();
|
||||
$this->errors = $element->errors;
|
||||
if ($ret < 0) {
|
||||
@@ -225,13 +243,15 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['shipping'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['shipping'] as $element) {
|
||||
if ($element->statut == Expedition::STATUS_VALIDATED || $element->statut == Expedition::STATUS_CLOSED) {
|
||||
/** @var Expedition $element */
|
||||
if ($element->status == Expedition::STATUS_VALIDATED || $element->status == Expedition::STATUS_CLOSED) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if (price2num($totalonlinkedelements, 'MT') == price2num($object->total_ht, 'MT')) {
|
||||
foreach ($object->linkedObjects['shipping'] as $element) {
|
||||
/** @var Expedition $element */
|
||||
$ret = $element->setBilled();
|
||||
if ($ret < 0) {
|
||||
return (int) $ret;
|
||||
@@ -251,7 +271,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
$totalHTInvoices = 0;
|
||||
$areAllInvoicesValidated = true;
|
||||
foreach ($orderLinked->linkedObjects['facture'] as $key => $invoice) {
|
||||
if ($invoice->statut == Facture::STATUS_VALIDATED || $invoice->statut == Facture::STATUS_CLOSED || $object->id == $invoice->id) {
|
||||
/** @var Facture $invoice */
|
||||
if ($invoice->status == Facture::STATUS_VALIDATED || $invoice->status == Facture::STATUS_CLOSED || $object->id == $invoice->id) {
|
||||
$totalHTInvoices += (float) $invoice->total_ht;
|
||||
} else {
|
||||
$areAllInvoicesValidated = false;
|
||||
@@ -285,13 +306,15 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['order_supplier'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['order_supplier'] as $element) {
|
||||
if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) {
|
||||
/** @var CommandeFournisseur $element */
|
||||
if ($element->status == CommandeFournisseur::STATUS_ACCEPTED || $element->status == CommandeFournisseur::STATUS_ORDERSENT || $element->status == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['order_supplier'] as $element) {
|
||||
/** @var CommandeFournisseur $element */
|
||||
$ret = $element->classifyBilled($user);
|
||||
if ($ret < 0) {
|
||||
return $ret;
|
||||
@@ -307,13 +330,15 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['supplier_proposal'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['supplier_proposal'] as $element) {
|
||||
if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_CLOSE) {
|
||||
/** @var SupplierProposal $element */
|
||||
if ($element->status == SupplierProposal::STATUS_SIGNED || $element->status == SupplierProposal::STATUS_CLOSE) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['supplier_proposal'] as $element) {
|
||||
/** @var SupplierProposal $element */
|
||||
$ret = $element->classifyBilled($user);
|
||||
if ($ret < 0) {
|
||||
return $ret;
|
||||
@@ -353,15 +378,18 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['reception'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['reception'] as $element) {
|
||||
if ($element->statut == Reception::STATUS_VALIDATED || $element->statut == Reception::STATUS_CLOSED) {
|
||||
/** @var Reception $element */
|
||||
if ($element->status == Reception::STATUS_VALIDATED || $element->status == Reception::STATUS_CLOSED) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if ($totalonlinkedelements == $object->total_ht) {
|
||||
foreach ($object->linkedObjects['reception'] as $element) {
|
||||
/** @var Reception $element */
|
||||
$ret = $element->setBilled();
|
||||
if ($ret < 0) {
|
||||
$this->setErrorsFromObject($element);
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
@@ -381,14 +409,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (!empty($object->linkedObjects['commande'])) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) {
|
||||
/** @var Commande $element */
|
||||
if ($element->status == Commande::STATUS_VALIDATED || $element->status == Commande::STATUS_SHIPMENTONPROCESS || $element->status == Commande::STATUS_CLOSED) {
|
||||
$totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
/** @var Commande $element */
|
||||
$ret = $element->classifyBilled($user);
|
||||
if ($ret < 0) {
|
||||
$this->setErrorsFromObject($element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,7 +512,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// If we validate or close a shipment
|
||||
if (($action == 'RECEPTION_VALIDATE') || ($action == 'RECEPTION_CLOSED')) {
|
||||
if ((($action == 'RECEPTION_VALIDATE') || ($action == 'RECEPTION_CLOSED')) && $object instanceof Reception) {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
if ((isModEnabled("fournisseur") || isModEnabled("supplier_order")) && isModEnabled("reception") && isModEnabled('workflow') &&
|
||||
@@ -553,7 +586,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'TICKET_CREATE') {
|
||||
if ($action == 'TICKET_CREATE' && $object instanceof Ticket) {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
// Auto link ticket to contract
|
||||
if (isModEnabled('contract') && isModEnabled('ticket') && isModEnabled('workflow') && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT') && getDolGlobalString('TICKET_PRODUCT_CATEGORY') && !empty($object->fk_soc)) {
|
||||
|
||||
@@ -653,7 +653,7 @@ if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAI
|
||||
// Forge the line to show into the open object box
|
||||
$labeltoshow = $board->label.' ('.$board->nbtodo.')';
|
||||
if ($board->total > 0) {
|
||||
$labeltoshow .= ' - '.price($board->total, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
$labeltoshow .= ' - '.price($board->total, 0, $langs, 1, -1, -1, getDolCurrency());
|
||||
}
|
||||
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text info-box-text-a">';
|
||||
$openedDashBoard .= $infoName;
|
||||
@@ -663,7 +663,7 @@ if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAI
|
||||
$openedDashBoard .= '<span class="classfortooltip'.($nbtodClass ? ' '.$nbtodClass : '').'" title="'.$labeltoshow.'">';
|
||||
$openedDashBoard .= $board->nbtodo;
|
||||
if ($board->total > 0 && getDolGlobalString('MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX')) {
|
||||
$openedDashBoard .= ' : '.price($board->total, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
$openedDashBoard .= ' : '.price($board->total, 0, $langs, 1, -1, -1, getDolCurrency());
|
||||
}
|
||||
$openedDashBoard .= '</span>';
|
||||
$openedDashBoard .= '</a>';
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* buildzip.php
|
||||
*
|
||||
* Copyright (c) 2023-2025 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@@ -304,7 +305,7 @@ foreach ($listOfModuleContent as $moduleContent) {
|
||||
}
|
||||
|
||||
$z = new ZipArchive();
|
||||
$z->open($outzip, ZIPARCHIVE::CREATE);
|
||||
$z->open($outzip, ZipArchive::CREATE);
|
||||
zipDir($tmpdir, $z, $tmpdir . '/');
|
||||
$z->close();
|
||||
delTree($tmpdir);
|
||||
|
||||
@@ -876,7 +876,7 @@ if (isModEnabled('stock')) {
|
||||
print '<!-- Begin PROFIT table -->';
|
||||
print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy');
|
||||
|
||||
PRINT '<div class="div-table-responsive">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="left" width="200">';
|
||||
@@ -945,6 +945,7 @@ foreach ($listofreferent as $key => $value) {
|
||||
if (is_array($elementarray) && count($elementarray) > 0) {
|
||||
$total_ht = 0;
|
||||
$total_ttc = 0;
|
||||
$i = 0;
|
||||
|
||||
// Loop on each object for the current element type
|
||||
$num = count($elementarray);
|
||||
@@ -1386,6 +1387,7 @@ foreach ($listofreferent as $key => $value) {
|
||||
if (is_array($elementarray) && count($elementarray) > 0) {
|
||||
$total_ht = 0;
|
||||
$total_ttc = 0;
|
||||
$i = 0;
|
||||
|
||||
$total_ht_by_third = 0;
|
||||
$total_ttc_by_third = 0;
|
||||
|
||||
@@ -3202,8 +3202,8 @@ class Ticket extends CommonObject
|
||||
} else {
|
||||
$langs->load("other");
|
||||
if ($mailfile->error) {
|
||||
setEventMessages($langs->trans('ErrorFailedToSendMail', $from, $receiver), null, 'errors');
|
||||
dol_syslog($langs->trans('ErrorFailedToSendMail', $from, $receiver).' : '.$mailfile->error);
|
||||
setEventMessages($langs->trans('ErrorFailedToSendMail', $from, $receiverstring), null, 'errors');
|
||||
dol_syslog($langs->trans('ErrorFailedToSendMail', $from, $receiverstring).' : '.$mailfile->error);
|
||||
} else {
|
||||
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'errors');
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -592,13 +592,13 @@ print $hookmanager->resPrint;
|
||||
$key = 'nb_of_values';
|
||||
if (!empty($arrayfields[$key]['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
print '<input type="text" class="flat maxwidth50" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
print '</td>';
|
||||
}
|
||||
$key = 'nb_products';
|
||||
if (!empty($arrayfields[$key]['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
print '<input type="text" class="flat maxwidth50" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
|
||||
@@ -1099,7 +1099,7 @@ if ($action == 'addcontainer' && $usercanedit) {
|
||||
|
||||
$pagecsscontent .= $contentforlessc."\n";
|
||||
//$pagecsscontent.=$tmpgeturl['content']."\n";
|
||||
} catch (exception $e) {
|
||||
} catch (Exception $e) {
|
||||
//echo "failed to compile lessc";
|
||||
dol_syslog("Failed to compile the CSS from URL ".$urltograbbis." with lessc: ".$e->getMessage(), LOG_WARNING);
|
||||
$pagecsscontent .= $tmpgeturl['content']."\n";
|
||||
|
||||
@@ -53,9 +53,13 @@ parameters:
|
||||
# checkAlwaysTrueCheckTypeFunctionCall: false
|
||||
# checkAlwaysTrueInstanceof: false
|
||||
# checkAlwaysTrueStrictComparison: false
|
||||
polluteScopeWithLoopInitialAssignments: false
|
||||
polluteScopeWithAlwaysIterableForeach: false
|
||||
polluteScopeWithBlock: false
|
||||
checkClassCaseSensitivity: true
|
||||
checkFunctionArgumentTypes: true
|
||||
checkFunctionNameCase: true
|
||||
checkInternalClassCaseSensitivity: true
|
||||
checkArgumentsPassedByReference: true
|
||||
checkMaybeUndefinedVariables: true
|
||||
checkNullables: false
|
||||
@@ -65,8 +69,6 @@ parameters:
|
||||
reportMaybes: false
|
||||
reportMaybesInMethodSignatures: false
|
||||
reportStaticMethodSignatures: false
|
||||
polluteScopeWithLoopInitialAssignments: true
|
||||
polluteScopeWithAlwaysIterableForeach: true
|
||||
reportMagicMethods: false
|
||||
reportMagicProperties: false
|
||||
treatPhpDocTypesAsCertain: false
|
||||
|
||||
Reference in New Issue
Block a user