Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2022-10-06 16:03:50 +02:00
19 changed files with 133 additions and 72 deletions

View File

@@ -441,26 +441,40 @@ class AccountingJournal extends CommonObject
$langs->loadLangs(array("assets")); $langs->loadLangs(array("assets"));
// Clean parameters // Clean parameters
if (empty($type)) $type = 'view'; if (empty($type)) {
if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; $type = 'view';
}
if (empty($in_bookkeeping)) {
$in_bookkeeping = 'notyet';
}
$sql = ""; $sql = "";
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS (";
$sql .= " SELECT DISTINCT fk_docdet"; $sql .= " SELECT DISTINCT fk_docdet";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " WHERE doc_type = 'asset'"; $sql .= " WHERE doc_type = 'asset'";
$sql .= ")"; $sql .= ")";
} }*/
$sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht";
$sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat";
$sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset";
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { // FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; $sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
} }*/
$sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing
// Compatibility with Mysql 5.7
if ($in_bookkeeping == 'already') {
$sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
} elseif ($in_bookkeeping == 'notyet') {
$sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
}
$sql .= " AND ad.ref != ''"; // not reversal lines $sql .= " AND ad.ref != ''"; // not reversal lines
if ($date_start && $date_end) { if ($date_start && $date_end) {
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'"; $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'";
@@ -470,9 +484,10 @@ class AccountingJournal extends CommonObject
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'"; $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
} }
// Already in bookkeeping or not // Already in bookkeeping or not
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { // FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL"; $sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL";
} }*/
$sql .= " ORDER BY ad.depreciation_date"; $sql .= " ORDER BY ad.depreciation_date";
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);

View File

@@ -290,19 +290,21 @@ print '<td class="right">' . $langs->trans("Debit") . '</td>';
print '<td class="right">' . $langs->trans("Credit") . '</td>'; print '<td class="right">' . $langs->trans("Credit") . '</td>';
print "</tr>\n"; print "</tr>\n";
foreach ($journal_data as $element_id => $element) { if (is_array($journal_data) && !empty($journal_data)) {
foreach ($element['blocks'] as $lines) { foreach ($journal_data as $element_id => $element) {
foreach ($lines as $line) { foreach ($element['blocks'] as $lines) {
print '<tr class="oddeven">'; foreach ($lines as $line) {
print '<td>' . $line['date'] . '</td>'; print '<tr class="oddeven">';
print '<td>' . $line['piece'] . '</td>'; print '<td>' . $line['date'] . '</td>';
print '<td>' . $line['account_accounting'] . '</td>'; print '<td>' . $line['piece'] . '</td>';
print '<td>' . $line['subledger_account'] . '</td>'; print '<td>' . $line['account_accounting'] . '</td>';
print '<td>' . $line['label_operation'] . '</td>'; print '<td>' . $line['subledger_account'] . '</td>';
if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>'; print '<td>' . $line['label_operation'] . '</td>';
print '<td class="right nowraponall">' . $line['debit'] . '</td>'; if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>';
print '<td class="right nowraponall">' . $line['credit'] . '</td>'; print '<td class="right nowraponall">' . $line['debit'] . '</td>';
print '</tr>'; print '<td class="right nowraponall">' . $line['credit'] . '</td>';
print '</tr>';
}
} }
} }
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* *
@@ -30,11 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('companies', 'products', 'admin')); $langs->loadLangs(array('companies', 'products', 'admin'));
if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$currencycode = GETPOST('currencycode', 'alpha'); $currencycode = GETPOST('currencycode', 'alpha');
if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
@@ -49,25 +46,36 @@ $mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$cu
$valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int'); $valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int');
$valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int'); $valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int');
$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int'); $valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...'
$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2); $valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
if ($action == 'update') { if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
if ($action == 'update' && !$cancel) {
$error = 0; $error = 0;
$MAXDEC = 8; $MAXDEC = 8;
if ($_POST[$mainmaxdecimalsunit] > $MAXDEC if ($valmainmaxdecimalsunit > $MAXDEC
|| $_POST[$mainmaxdecimalstot] > $MAXDEC || $valmainmaxdecimalstot > $MAXDEC
|| $_POST[$mainmaxdecimalsshown] > $MAXDEC) { || $valmainmaxdecimalsshown > $MAXDEC) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors'); setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
$action = 'edit';
} }
if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0 if ($valmainmaxdecimalsunit < 0
|| $_POST[$mainmaxdecimalstot] < 0 || $valmainmaxdecimalstot < 0
|| $_POST[$mainmaxdecimalsshown] < 0) { || $valmainmaxdecimalsshown < 0) {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
$action = 'edit';
} }
if ($valmainroundingruletot) { if ($valmainroundingruletot) {
@@ -75,9 +83,23 @@ if ($action == 'update') {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors'); setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
$action = 'edit';
} }
} }
if ((float) $valmainmaxdecimalsshown == 0) {
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
$action = 'edit';
}
if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) {
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorValueForTooLow", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
$action = 'edit';
}
if (!$error) { if (!$error) {
dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
@@ -144,24 +166,25 @@ if ($action == 'edit') {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'"></td></tr>'; print '</td><td><input class="flat right" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsunit) ? GETPOST($mainmaxdecimalsunit) : getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT', 0)).'"></td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainmaxdecimalstot.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'"></td></tr>'; print '</td><td><input class="flat right" name="'.$mainmaxdecimalstot.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalstot) ? GETPOST($mainmaxdecimalstot) : getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)).'"></td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
print '<td><input class="flat" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'"></td></tr>'; print '<td><input class="flat right" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsshown) ? GETPOST($mainmaxdecimalsshown) : getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')).'"></td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (!empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'"></td></tr>'; print '</td><td><input class="flat right" name="'.$mainroundingruletot.'" size="3" value="'.(GETPOSTISSET($mainroundingruletot) ? GETPOST($mainroundingruletot) : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'"></td></tr>';
print '</table>'; print '</table>';
print '<br>';
print '<div class="center">'; print '<div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">'; print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
@@ -170,7 +193,7 @@ if ($action == 'edit') {
} else { } else {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
@@ -191,7 +214,7 @@ if ($action == 'edit') {
print '</div>'; print '</div>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().''.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }

View File

@@ -122,7 +122,7 @@ if (empty($conf->global->MAIN_MODULE_API)) {
// Test if explorer is not disabled // Test if explorer is not disabled
if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED)) { if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED)) {
$langs->load("admin"); $langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled"); dol_syslog("Call Dolibarr API interfaces with module API REST disabled");
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>'; print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
//session_destroy(); //session_destroy();
exit(0); exit(0);
@@ -155,6 +155,10 @@ preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg);
$refreshcache = (empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false); $refreshcache = (empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) { if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) {
$refreshcache = true; $refreshcache = true;
if (!is_writable($conf->api->dir_temp)) {
print 'Erreur temp dir api/temp not writable';
exit(0);
}
} }
$api = new DolibarrApi($db, '', $refreshcache); $api = new DolibarrApi($db, '', $refreshcache);

View File

@@ -119,13 +119,23 @@ class AdvanceTargetingMailing extends CommonObject
'3' => $langs->trans('ThirdParty'), '3' => $langs->trans('ThirdParty'),
'4' => $langs->trans('ContactsWithThirdpartyFilter') '4' => $langs->trans('ContactsWithThirdpartyFilter')
); );
$this->type_statuscommprospect = array(
-1 => $langs->trans("StatusProspect-1"), require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
0 => $langs->trans("StatusProspect0"), $customerStatic = new Client($this->db);
1 => $langs->trans("StatusProspect1"), $customerStatic->loadCacheOfProspStatus();
2 => $langs->trans("StatusProspect2"), if (!empty($customerStatic->cacheprospectstatus)) {
3 => $langs->trans("StatusProspect3") foreach ($customerStatic->cacheprospectstatus as $dataProspectSt) {
); $this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label'];
}
} else {
$this->type_statuscommprospect = array(
-1 => $langs->trans("StatusProspect-1"),
0 => $langs->trans("StatusProspect0"),
1 => $langs->trans("StatusProspect1"),
2 => $langs->trans("StatusProspect2"),
3 => $langs->trans("StatusProspect3")
);
}
} }
/** /**

View File

@@ -355,7 +355,7 @@ class FormAdvTargetEmailing extends Form
$out = ''; $out = '';
$sql = "SELECT c.rowid, c.name, c.fk_element"; $sql = "SELECT c.rowid, c.name, c.fk_element";
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as c";
$sql .= " WHERE type_element = '".$this->db->escape($type_element)."'"; $sql .= " WHERE type_element = '".$this->db->escape($type_element)."'";
$sql .= " ORDER BY c.name"; $sql .= " ORDER BY c.name";

View File

@@ -1228,6 +1228,15 @@ class Contact extends CommonObject
$this->db->begin(); $this->db->begin();
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) { if (!$error) {
// Get all rowid of element_contact linked to a type that is link to llx_socpeople // Get all rowid of element_contact linked to a type that is link to llx_socpeople
$sql = "SELECT ec.rowid"; $sql = "SELECT ec.rowid";
@@ -1318,15 +1327,6 @@ class Contact extends CommonObject
} }
} }
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) { if (!$error) {
$this->db->commit(); $this->db->commit();
return 1; return 1;

View File

@@ -28,9 +28,10 @@ if (!defined('NOREQUIREHTML')) {
if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1'); define('NOREQUIREAJAX', '1');
} }
if (!defined('NOREQUIRESOC')) { // Needed to create other objects with workflow
/*if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1'); define('NOREQUIRESOC', '1');
} }*/
// Do not check anti CSRF attack test // Do not check anti CSRF attack test
if (!defined('NOREQUIREMENU')) { if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1'); define('NOREQUIREMENU', '1');

View File

@@ -9137,7 +9137,7 @@ abstract class CommonObject
// Clean and check mandatory // Clean and check mandatory
foreach ($keys as $key) { foreach ($keys as $key) {
// If field is an implicit foreign key field // If field is an implicit foreign key field (so type = 'integer:...')
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') { if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') {
$values[$key] = ''; $values[$key] = '';
} }
@@ -9157,7 +9157,7 @@ abstract class CommonObject
$values[$key] = $this->quote($this->fields[$key]['default'], $this->fields[$key]); $values[$key] = $this->quote($this->fields[$key]['default'], $this->fields[$key]);
} }
// If field is an implicit foreign key field // If field is an implicit foreign key field (so type = 'integer:...')
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) { if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) {
if (isset($this->fields[$key]['default'])) { if (isset($this->fields[$key]['default'])) {
$values[$key] = ((int) $this->fields[$key]['default']); $values[$key] = ((int) $this->fields[$key]['default']);

View File

@@ -6371,7 +6371,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle. // Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
if (($seller_country_code == $buyer_country_code) if (($seller_country_code == $buyer_country_code)
|| (in_array($seller_country_code, array('FR,MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined || (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined
//print 'VATRULE 2'; //print 'VATRULE 2';
return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice);
} }

View File

@@ -753,7 +753,10 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$result .= '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>'; $result .= '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>';
$result .= '<td>'.dol_print_date($db->jdate($obj->datec), 'day').'</td>'; $result .= '<td>'.dol_print_date($db->jdate($obj->datec), 'day').'</td>';
$result .= '<td class="right amount">'.price($obj->total_ttc).'</td>'; $result .= '<td class="right amount">'.price($obj->total_ttc).'</td>';
$result .= '<td class="right">'.$objectstatic->getLibStatut(5).'</td>';
// Load amount of existing payment of invoice (needed for complete status)
$payment = $objectstatic->getSommePaiement();
$result .= '<td class="right">'.$objectstatic->getLibStatut(5, $payment).'</td>';
$result .= '</tr>'; $result .= '</tr>';

View File

@@ -1562,7 +1562,7 @@ class pdf_sponge extends ModelePDFFactures
// Total remise // Total remise
$total_line_remise = 0; $total_line_remise = 0;
foreach ($object->lines as $i => $line) { foreach ($object->lines as $i => $line) {
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib $total_line_remise += (float) pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative // Gestion remise sous forme de ligne négative
if ($line->total_ht < 0) { if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht; $total_line_remise += -$line->total_ht;

View File

@@ -475,7 +475,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pageposafter = $pageposbefore; $pageposafter = $pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc); pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
$pageposafter = $pdf->getPage(); $pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY(); $posyafter = $pdf->GetY();

View File

@@ -1241,7 +1241,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); $object->multicurrency_tx = price2num(GETPOST('originmulticurrency_tx', 'alpha'));
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form

View File

@@ -19,7 +19,7 @@
CREATE TABLE llx_partnership( CREATE TABLE llx_partnership(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL, ref varchar(128) DEFAULT '(PROV)' NOT NULL,
status smallint NOT NULL DEFAULT '0', status smallint DEFAULT 0 NOT NULL,
fk_type integer DEFAULT 0 NOT NULL, fk_type integer DEFAULT 0 NOT NULL,
fk_soc integer, fk_soc integer,
fk_member integer, fk_member integer,

View File

@@ -59,6 +59,7 @@ MainAccountForSuppliersNotDefined=Main accounting account for vendors not define
MainAccountForUsersNotDefined=Main accounting account for users not defined in setup MainAccountForUsersNotDefined=Main accounting account for users not defined in setup
MainAccountForVatPaymentNotDefined=Main accounting account for VAT payment not defined in setup MainAccountForVatPaymentNotDefined=Main accounting account for VAT payment not defined in setup
MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscription payment not defined in setup MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscription payment not defined in setup
UserAccountNotDefined=Accounting account for user not defined in setup
AccountancyArea=Accounting area AccountancyArea=Accounting area
AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: AccountancyAreaDescIntro=Usage of the accountancy module is done in several step:

View File

@@ -295,6 +295,8 @@ ErrorThisPaymentModeIsNotSepa=This payment mode is not a bank account
ErrorStripeCustomerNotFoundCreateFirst=Stripe customer is not set for this thirdparty (or set to a value deleted on Stripe side). Create (or re-attach) it first. ErrorStripeCustomerNotFoundCreateFirst=Stripe customer is not set for this thirdparty (or set to a value deleted on Stripe side). Create (or re-attach) it first.
ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character + ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character +
ErrorTableNotFound=Table <b>%s</b> not found ErrorTableNotFound=Table <b>%s</b> not found
ErrorValueForTooLow=Value for <b>%s</b> is too low
ErrorValueCantBeNull=Value for <b>%s</b> can't be null
# Warnings # Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.

View File

@@ -118,7 +118,7 @@ class Partnership extends CommonObject
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,),
'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,),
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'', '0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '8'=>'Suspended', '9'=>'Terminated'),), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('-1'=>'', '0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '8'=>'Suspended', '9'=>'Terminated'),),
'url_to_check' => array('type'=>'varchar(255)', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1,), 'url_to_check' => array('type'=>'varchar(255)', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1,),
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',),
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,),

View File

@@ -4846,7 +4846,7 @@ class Product extends CommonObject
$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
$sql.= " ORDER BY pa.rang"; $sql.= " ORDER BY pa.rang";
dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.implode(',', $parents), LOG_DEBUG); dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG);
if ($level == 1) { if ($level == 1) {
$alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly