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

This commit is contained in:
Laurent Destailleur 2026-02-23 12:23:34 +01:00
commit 06e67ee3da
35 changed files with 281 additions and 795 deletions

View file

@ -60,13 +60,13 @@ repos:
# Gitleaks is a SAST tool for detecting and preventing hardcoded secrets like passwords, api keys, and tokens in git repos
- repo: https://github.com/gitleaks/gitleaks.git
rev: v8.29.0
rev: v8.30.0
hooks:
- id: gitleaks
# Check github actions
- repo: https://github.com/rhysd/actionlint
rev: v1.7.10
rev: v1.7.11
hooks:
- id: actionlint
stages: [manual] # To run: pre-commit run -a --hook-stage=manual actionlint
@ -196,7 +196,7 @@ repos:
# Check format of yaml files
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
rev: v1.38.0
hooks:
- id: yamllint
args:
@ -257,7 +257,7 @@ repos:
# Check sql file syntax
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.3.1
rev: 4.0.4
hooks:
- id: sqlfluff-lint
stages: [pre-commit, manual] # manual needed for ci

File diff suppressed because one or more lines are too long

View file

@ -310,7 +310,7 @@ if ($result) {
}
// VAT Reverse charge
if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && (in_array($obj->country_code, $country_code_in_EEC) || getDolGlobalString('ACCOUNTING_REVERSE_CHARGE_ALSO_NON_EEC'))) {
$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);

View file

@ -282,6 +282,7 @@ if (getDolGlobalString('BARCODE_USE_ON_PRODUCT') && isModEnabled('product')) {
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
continue;
}
$modBarCode = new $file();
@ -349,6 +350,7 @@ if (getDolGlobalString('BARCODE_USE_ON_THIRDPARTY') && isModEnabled('societe'))
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
continue;
}
$modBarCode = new $file();

View file

@ -166,9 +166,9 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$sourcetype = $sourcesarray[$directivetype][$sourcecsp]["data-sourcetype"];
}
$securitycspstring = "";
if (isset($sourcetype) && $sourcetype == "data") {
if ($sourcetype == "data") {
$forceCSPArr[$directivecsp][] = "data:".$sourcedatacsp;
} elseif (isset($sourcetype) && $sourcetype == "input") {
} elseif ($sourcetype == "input") {
if (empty($forceCSPArr[$directivecsp])) {
$forceCSPArr[$directivecsp] = array();
}

View file

@ -147,6 +147,7 @@ if ($logsql) {
// Define request to get table description
$base = 0;
$sql = null;
$row = array();
if (preg_match('/mysql/i', $conf->db->type)) {
$sql = "SHOW TABLE STATUS LIKE '".$db->escape($db->escapeforlike($table))."'";
$base = 1;

View file

@ -53,10 +53,7 @@ if (!$user->admin) {
llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-system_phpinfo');
$title = 'InfoPHP';
if (isset($title)) {
print load_fiche_titre($langs->trans($title), '', 'title_setup');
}
print load_fiche_titre($langs->trans($title), '', 'title_setup');
// Check PHP setup is OK

View file

@ -34,6 +34,7 @@ require '../../main.inc.php';
* @var string $dolibarr_main_db_host
* @var string $dolibarr_main_db_name
* @var string $dolibarr_main_db_user
* @var string $dolibarr_main_db_pass
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager

View file

@ -54,7 +54,7 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;

View file

@ -302,7 +302,7 @@ class AssetDepreciationOptions extends CommonObject
$deprecation_options[$mode_key][$field_key] = $field_value;
// Validation of fields values
if (getDolGlobalInt('MAIN_FEATURE_LEVEL') >= 1 || getDolGlobalString('MAIN_ACTIVATE_VALIDATION_RESULT')) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || getDolGlobalString('MAIN_ACTIVATE_VALIDATION_RESULT')) {
if (!$error && !empty($field_info['validate']) && is_callable(array($this, 'validateField'))) {
if (!$this->validateField($mode_info['fields'], $field_key, $value)) {
$error++;

View file

@ -209,9 +209,9 @@ if (empty($reshook)) {
$diroutput = null;
$template = null;
$is2d = false;
$code = $forbarcode;
if (!$error && $stdobject !== null) {
$code = $forbarcode;
$generator = $stdobject->barcode_type_coder; // coder (loaded by fetchBarCode). Engine.
$encoding = strtoupper($stdobject->barcode_type_code); // code (loaded by fetchBarCode). Example 'ean', 'isbn', ...
@ -364,6 +364,7 @@ if (empty($reshook)) {
$result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, (string) $diroutput, (string) $template, dol_sanitizeFileName($outfile));
} catch (Exception $e) {
$mesg = $langs->trans('ErrorGeneratingBarcode');
$error++;
}
$conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE = $previousConf;

View file

@ -254,6 +254,11 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
}
if (!$error && $fh) {
$refinvoicefound = array();
$totalhtamount = array();
$totalvatamount = array();
$totalamount = array();
// Now restart request with all data, so without the limit(1) in sql request
$sql = "SELECT rowid, entity, date_creation, tms, user_fullname, action, module_source, pos_source, amounts_taxexcl, amounts, element, fk_object, date_object, ref_object,";
$sql .= " linktoref, linktype, signature, fk_user, object_data, object_version, object_format, debuginfo";
@ -291,11 +296,6 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$loweridinerror = 0;
$i = 0;
$refinvoicefound = array();
$totalhtamount = array();
$totalvatamount = array();
$totalamount = array();
while ($obj = $db->fetch_object($resql)) {
// We set here all data used into signature calculation (see checkSignature method) and more
@ -318,6 +318,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
}
$block_static->date_creation = $db->jdate($obj->date_creation, $tz); // jdate(date_creation) is UTC
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
$block_static->date_modification = $db->jdate($obj->tms, $tz); // jdate(tms) is UTC
$block_static->action = $obj->action;
@ -420,6 +421,9 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
}
// Now calculate cumulative total of all invoices validated
$totalhtamountalllines = array('BILL_VALIDATE' => 0, 'PAYMENT_CUSTOMER' => 0);
$totalvatamountalllines = array('BILL_VALIDATE' => 0, 'PAYMENT_CUSTOMER' => 0);
$totalamountalllines = array('BILL_VALIDATE' => 0, 'PAYMENT_CUSTOMER' => 0);
if (array_key_exists('BILL_VALIDATE', $totalhtamount)) {
foreach ($totalhtamount['BILL_VALIDATE'] as $val) { // Loop on each module
$totalhtamountalllines['BILL_VALIDATE'] += $val;
@ -444,7 +448,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
}
// Add a final line with cumulative total of invoices validated (BILL_VALIDATE)
$block_static->id = '';
$block_static->id = 0;
$block_static->date_creation = '';
$block_static->action = '';
$block_static->module_source = '*';
@ -452,7 +456,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$block_static->amounts_taxexcl = '';
$block_static->amounts = '';
$block_static->ref_object = '';
$block_static->date_object = '';
$block_static->date_object = 0;
$block_static->user_fullname = '';
$block_static->linktoref = '';
$block_static->linktype = '';
@ -463,7 +467,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$statusofrecord = '';
fwrite($fh, 'SUMMARY TURNOVER BILLED - '.$langs->transnoentitiesnoconv("Bills").' : '.$totalhtamountalllines['BILL_VALIDATE'].' '.$langs->trans("HT").' - '.$totalvatamountalllines['BILL_VALIDATE'].' '.$langs->trans("VAT").' - '.$totalamountalllines['BILL_VALIDATE'].' '.$langs->trans("HT").';'
.csvClean($block_static->id).';'
.csvClean('').';'
.csvClean($block_static->date_creation).';'
.csvClean($block_static->action).';'
.csvClean($block_static->module_source).';'
@ -471,11 +475,11 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
.csvClean($block_static->amounts_taxexcl).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->amounts).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->ref_object).';'
.csvClean($block_static->date_object).';'
.csvClean('').';'
.csvClean($block_static->user_fullname).';'
.csvClean($block_static->linktoref).';'
.csvClean($block_static->linktype).';'
.csvClean($obj->object_data).';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean('').';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean($block_static->object_version).';'
.csvClean($block_static->object_format).';'
.csvClean($block_static->signature).';'
@ -483,7 +487,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
// Add a final line with cumulative total of invoices validated (PAYMENT_CUSTOMER_CREATE)
$block_static->id = '';
$block_static->id = 0;
$block_static->date_creation = '';
$block_static->action = '';
$block_static->module_source = '*';
@ -491,7 +495,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$block_static->amounts_taxexcl = '';
$block_static->amounts = '';
$block_static->ref_object = '';
$block_static->date_object = '';
$block_static->date_object = 0;
$block_static->user_fullname = '';
$block_static->linktoref = '';
$block_static->linktype = '';
@ -501,7 +505,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$statusofrecord = '';
fwrite($fh, 'SUMMARY TURNOVER PAID - '.$langs->transnoentitiesnoconv("Payments").' : '.$totalamountalllines['PAYMENT_CUSTOMER'].';'
.csvClean($block_static->id).';'
.csvClean('').';'
.csvClean($block_static->date_creation).';'
.csvClean($block_static->action).';'
.csvClean($block_static->module_source).';'
@ -509,11 +513,11 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
.csvClean($block_static->amounts_taxexcl).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->amounts).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->ref_object).';'
.csvClean($block_static->date_object).';'
.csvClean('').';'
.csvClean($block_static->user_fullname).';'
.csvClean($block_static->linktoref).';'
.csvClean($block_static->linktype).';'
.csvClean($obj->object_data).';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean('').';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean($block_static->object_version).';'
.csvClean($block_static->object_format).';'
.csvClean($block_static->signature).';'
@ -596,7 +600,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
// Add a final line with perpetual total for invoice validations
$block_static->id = '';
$block_static->id = 0;
$block_static->date_creation = '';
$block_static->action = '';
$block_static->module_source = '*';
@ -604,7 +608,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$block_static->amounts_taxexcl = '';
$block_static->amounts = '';
$block_static->ref_object = '';
$block_static->date_object = '';
$block_static->date_object = 0;
$block_static->user_fullname = '';
$block_static->linktoref = '';
$block_static->linktype = '';
@ -615,7 +619,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$statusofrecord = '';
fwrite($fh, 'SUMMARY LIFETIME BILLED - '.$langs->transnoentitiesnoconv("Invoices").' : '.$totalhtamountalllines['BILL_VALIDATE'].' '.$langs->trans("HT")." - ".($foundoldformat ? '' : ($totalamountalllines['BILL_VALIDATE'] - $totalhtamountalllines['BILL_VALIDATE']).' '.$langs->transnoentitiesnoconv("VAT")).' - '.$totalamountalllines['BILL_VALIDATE'].' '.$langs->trans("TTC").";"
.csvClean($block_static->id).';'
.csvClean('').';'
.csvClean($block_static->date_creation).';'
.csvClean($block_static->action).';'
.csvClean($block_static->module_source).';'
@ -623,11 +627,11 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
.csvClean($block_static->amounts_taxexcl).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->amounts).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->ref_object).';'
.csvClean($block_static->date_object).';'
.csvClean('').';'
.csvClean($block_static->user_fullname).';'
.csvClean($block_static->linktoref).';'
.csvClean($block_static->linktype).';'
.csvClean($obj->object_data).';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean('').';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean($block_static->object_version).';'
.csvClean($block_static->object_format).';'
.csvClean($block_static->signature).';'
@ -636,15 +640,15 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
// Add a final line with perpetual total for customer payments
$block_static->id = '';
$block_static->id = 0;
$block_static->date_creation = '';
$block_static->action = '';
$block_static->module_source = '*';
$block_static->pos_source = '*';
$block_static->amounts_taxtecl = '';
$block_static->amounts_taxexcl = '';
$block_static->amounts = '';
$block_static->ref_object = '';
$block_static->date_object = '';
$block_static->date_object = 0;
$block_static->user_fullname = '';
$block_static->linktoref = '';
$block_static->linktype = '';
@ -655,7 +659,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
$statusofrecord = '';
fwrite($fh, 'SUMMARY LIFETIME PAID - '.$langs->transnoentitiesnoconv("Payments").' : '.($totalamountlifetime['PAYMENT_CUSTOMER_CREATE'] + $totalamountlifetime['PAYMENT_CUSTOMER_DELETE']).";"
.csvClean($block_static->id).';'
.csvClean('').';'
.csvClean($block_static->date_creation).';'
.csvClean($block_static->action).';'
.csvClean($block_static->module_source).';'
@ -663,11 +667,11 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
.csvClean($block_static->amounts_taxexcl).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->amounts).';' // Can be 1.20000000 with 8 digits. TODO Clean to have 8 digits in V1
.csvClean($block_static->ref_object).';'
.csvClean($block_static->date_object).';'
.csvClean('').';'
.csvClean($block_static->user_fullname).';'
.csvClean($block_static->linktoref).';'
.csvClean($block_static->linktype).';'
.csvClean($obj->object_data).';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean('').';' // We must use the string (so $obj->object_data) and not the array decoded with dolDecodeBlockedData
.csvClean($block_static->object_version).';'
.csvClean($block_static->object_format).';'
.csvClean($block_static->signature).';'
@ -877,6 +881,7 @@ if ($action == 'check' || $action == 'checkconfirmed') {
$linetech = $lineactioncode = '';
$lineamountht = $lineamountttc = 0;
$lineref = '';
$statusline = '';
if ($numline < 2) {
// First line, we continue
@ -1030,7 +1035,7 @@ if ($action == 'check' || $action == 'checkconfirmed') {
}
fclose($handle);
} else {
setEventMessage('Failed to open file '.GETPOST('urlfile'), null, 'errors');
setEventMessages('Failed to open file '.GETPOST('urlfile'), null, 'errors');
}
print '<br><br>';

View file

@ -884,6 +884,7 @@ class BlockedLog
if (is_array($object->amounts) && !empty($object->amounts)) {
// Loop on each invoice the payment is part of to set the linktoref and the module_source and pos_source
$originofpayment = null;
$terminalofpayment = '';
$paymentpartnumber = 0;
foreach ($object->amounts as $objid => $amount) {
if (empty($amount)) {
@ -1149,6 +1150,7 @@ class BlockedLog
}
$this->date_creation = $this->db->jdate($obj->date_creation, $tz); // jdate(date_creation)is UTC
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
$this->date_modification = $this->db->jdate($obj->tms, $tz); // jdate(tms) is UTC

View file

@ -416,6 +416,10 @@ if (empty($reshook) && $action == 'add' && $usercancreate) {
if (GETPOST("elementtype", 'alpha')) {
$elProp = getElementProperties(GETPOST("elementtype", 'alpha'));
$modulecodetouseforpermissioncheck = $elProp['module'];
// Keep permission check aligned with rights class aliases (see restrictedArea()).
if ($modulecodetouseforpermissioncheck == 'productbatch') {
$modulecodetouseforpermissioncheck = 'produit';
}
$submodulecodetouseforpermissioncheck = $elProp['subelement'];
$hasPermissionOnLinkedObject = 0;
@ -993,6 +997,10 @@ if (empty($reshook) && $action == 'update' && $usercancreate) {
if (GETPOST("elementtype", 'alpha')) {
$elProp = getElementProperties(GETPOST("elementtype", 'alpha'));
$modulecodetouseforpermissioncheck = $elProp['module'];
// Keep permission check aligned with rights class aliases (see restrictedArea()).
if ($modulecodetouseforpermissioncheck == 'productbatch') {
$modulecodetouseforpermissioncheck = 'produit';
}
$hasPermissionOnLinkedObject = 0;
if ($user->hasRight($modulecodetouseforpermissioncheck, 'read')) {
@ -1851,7 +1859,12 @@ if ($action == 'create') {
$hasPermissionOnLinkedObject = 0;
$elProp = getElementProperties($origin);
if ($user->hasRight($elProp['module'], 'read') || $user->hasRight($elProp['module'], $elProp['element'], 'read')) {
$modulecodetouseforpermissioncheck = $elProp['module'];
// Keep permission check aligned with rights class aliases (see restrictedArea()).
if ($modulecodetouseforpermissioncheck == 'productbatch') {
$modulecodetouseforpermissioncheck = 'produit';
}
if ($user->hasRight($modulecodetouseforpermissioncheck, 'read') || $user->hasRight($modulecodetouseforpermissioncheck, $elProp['element'], 'read')) {
$hasPermissionOnLinkedObject = 1;
}
//var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject);

View file

@ -2097,24 +2097,7 @@ if (empty($reshook)) {
$result = $object->set_demand_reason($user, GETPOSTINT('demand_reason_id'));
} elseif ($action == 'setconditions' && $usercancreate) {
// Terms of payment
$sql = "SELECT code ";
$sql .= "FROM " . $db->prefix() . "c_payment_term";
$sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int'));
$result = $db->query($sql);
if ($result) {
$obj = $db->fetch_object($result);
if ($obj->code == 'DEP30PCTDEL') {
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTFLOAT('cond_reglement_id_deposit_percent'));
} else {
$object->deposit_percent = 0;
$object->update($user);
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), $object->deposit_percent);
}
}
//} elseif ($action == 'setremisepercent' && $usercancreate) {
// $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2));
//} elseif ($action == 'setremiseabsolue' && $usercancreate) {
// $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2));
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTFLOAT('cond_reglement_id_deposit_percent'));
} elseif ($action == 'setmode' && $usercancreate) {
// Payment choice
$result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id'));
@ -2345,7 +2328,6 @@ if ($action == 'create') {
$fk_account = GETPOSTINT('fk_account');
}
}
// Warehouse default if null
if ($soc->fk_warehouse > 0) {
$warehouse_id = $soc->fk_warehouse;

View file

@ -1801,6 +1801,9 @@ class Commande extends CommonOrder
$this->line->total_localtax2 = (float) $total_localtax2;
$this->line->total_ttc = (float) $total_ttc;
$this->line->special_code = $special_code;
if (empty($qty) && empty($special_code)) {
$this->line->special_code = 3;
}
$this->line->origin = $origin;
$this->line->origin_id = $origin_id;
$this->line->fk_parent_line = $fk_parent_line;
@ -3162,8 +3165,11 @@ class Commande extends CommonOrder
if (empty($remise_percent)) {
$remise_percent = 0;
}
if (empty($special_code) || $special_code == 3) {
$special_code = 0;
if (empty($qty) && empty($special_code)) {
$special_code = 3; // Set option tag
}
if (!empty($qty) && $special_code == 3) {
$special_code = 0; // Remove option tag
}
if (empty($ref_ext)) {
$ref_ext = '';

View file

@ -6,7 +6,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -136,7 +136,7 @@ if ($object->id > 0) {
$datestart = dol_time_plus_duree($dateend, -1, 'm', 0);
} elseif (empty($object->day_close) && empty($object->month_close)) { // Full year
$dateend = dol_mktime((int) $object->hour_close, (int) $object->min_close, (int) $object->sec_close, 12, 31, $object->year_close, 'gmt');
$datestart = dol_time_plus_duree($datestart, -1, 'y', 0);
$datestart = dol_time_plus_duree($dateend, -1, 'y', 0);
} else {
$dateend = dol_mktime((int) $object->hour_close, (int) $object->min_close, (int) $object->sec_close, $object->month_close, $object->day_close, $object->year_close, 'gmt');
$datestart = dol_time_plus_duree($dateend, -1, 'd', 0);
@ -803,7 +803,7 @@ if ($action == "create" || $action == "start") {
$object->fetch($id);
print $object->opening;
} else {
print (GETPOSTISSET('opening') ? price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash']));
print(GETPOSTISSET('opening') ? price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash']));
}
print '">';
print '</td>';

View file

@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
/**
* API class for invoices
*
* @since 5.0.0 Initial implementation
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
@ -68,6 +69,8 @@ class Invoices extends DolibarrApi
*
* Return an array with invoice information
*
* @since 3.8.0 Initial implementation
*
* @param int $id ID of invoice
* @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
@ -92,6 +95,8 @@ class Invoices extends DolibarrApi
*
* Return an array with invoice information
*
* @since 12.0.0 Initial implementation
*
* @param string $ref Ref of object
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses
* @return Object Object with cleaned properties
@ -110,6 +115,8 @@ class Invoices extends DolibarrApi
*
* Return an array with invoice information
*
* @since 12.0.0 Initial implementation
*
* @param string $ref_ext External reference of object
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses
* @return Object Object with cleaned properties
@ -188,6 +195,8 @@ class Invoices extends DolibarrApi
*
* Get a list of invoices
*
* @since 5.0.0 Initial implementation
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
@ -342,6 +351,8 @@ class Invoices extends DolibarrApi
/**
* Create invoice object
*
* @since 3.8.0 Initial implementation
*
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
@ -397,6 +408,8 @@ class Invoices extends DolibarrApi
/**
* Create an invoice using an existing order.
*
* @since 7.0.0 Initial implementation
*
* @param int $orderid Id of the order
* @return Object Object with cleaned properties
*
@ -442,6 +455,8 @@ class Invoices extends DolibarrApi
/**
* Create an invoice using a contract.
*
* @since 20.0.0 Initial implementation
*
* @param int $contractid Id of the contract
* @return Object Object with cleaned properties
*
@ -483,6 +498,8 @@ class Invoices extends DolibarrApi
/**
* Get lines of an invoice
*
* @since 7.0.0 Initial implementation
*
* @param int $id Id of invoice
* @return array Array of lines
* @phan-return CommonInvoiceLine[]
@ -515,6 +532,8 @@ class Invoices extends DolibarrApi
/**
* Update a line to a given invoice
*
* @since 6.0.3 Initial implementation
*
* @param int $id Id of invoice to update
* @param int $lineid Id of line to update
* @param array $request_data InvoiceLine data
@ -589,6 +608,8 @@ class Invoices extends DolibarrApi
/**
* Add a contact type of given invoice
*
* @since 10.0.0 Initial implementation
*
* @param int $id Id of invoice to update
* @param int $contactid Id of contact to add
* @param string $type Type (code in dictionary) of the contact (BILLING, SHIPPING, CUSTOMER + possibly your own)
@ -716,6 +737,8 @@ class Invoices extends DolibarrApi
*
* Return an array with contact information
*
* @since 23.0.0 Initial implementation
*
* @param int $id ID of invoice
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER)
* @return array<int,mixed> Array with contact and user associated
@ -750,6 +773,8 @@ class Invoices extends DolibarrApi
/**
* Delete a contact type of given invoice
*
* @since 10.0.0 Initial implementation
*
* @param int $id Id of invoice to update
* @param int $contactid Row key of the contact in the array contact_ids.
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
@ -795,6 +820,8 @@ class Invoices extends DolibarrApi
/**
* Deletes a line of a given invoice
*
* @since 7.0.0 Initial implementation
*
* @param int $id Id of invoice
* @param int $lineid Id of the line to delete
* @return Object Object with cleaned properties
@ -838,6 +865,8 @@ class Invoices extends DolibarrApi
/**
* Update invoice
*
* @since 3.8.0 Initial implementation
*
* @param int $id Id of invoice to update
* @param array $request_data Datas
* @phan-param ?array<string,string> $request_data
@ -902,6 +931,8 @@ class Invoices extends DolibarrApi
/**
* Delete invoice
*
* @since 3.8.0 Initial implementation
*
* @param int $id Invoice ID
* @return array
* @phan-return array{success:array{code:int,message:string}}
@ -942,6 +973,8 @@ class Invoices extends DolibarrApi
/**
* Add a line to a given invoice
*
* @since 7.0.0 Initial implementation
*
* Example of POST query :
* {
* "desc": "Desc", "subprice": "1.00000000", "qty": "1", "tva_tx": "20.000", "localtax1_tx": "0.000", "localtax2_tx": "0.000",
@ -1036,6 +1069,8 @@ class Invoices extends DolibarrApi
/**
* Adds a contact to an invoice
*
* @since 8.0.0 Initial implementation
*
* @param int $id Order ID
* @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if source = 'internal') to link
* @param string $type_contact Type of contact (code). Must a code found into table llx_c_type_contact. For example: BILLING
@ -1088,6 +1123,8 @@ class Invoices extends DolibarrApi
/**
* Sets an invoice as draft
*
* @since 7.0.0 Initial implementation
*
* @param int $id Order ID
* @param int $idwarehouse Warehouse ID
* @return Object Object with cleaned properties
@ -1133,6 +1170,8 @@ class Invoices extends DolibarrApi
/**
* Validate an invoice
*
* @since 6.0.0 Initial implementation
*
* If you get a bad value for param notrigger check that ou provide this in body
* {
* "idwarehouse": 0,
@ -1189,6 +1228,8 @@ class Invoices extends DolibarrApi
/**
* Sets an invoice as paid
*
* @since 7.0.0 Initial implementation
*
* @param int $id Order ID
* @param string $close_code Code filled if we classify to 'Paid completely' when payment is not complete (for escompte for example)
* @param string $close_note Comment defined if we classify to 'Paid' when payment is not complete (for escompte for example)
@ -1241,6 +1282,8 @@ class Invoices extends DolibarrApi
/**
* Sets an invoice as unpaid
*
* @since 7.0.0 Initial implementation
*
* @param int $id Order ID
* @return Object Object with cleaned properties
*
@ -1290,6 +1333,8 @@ class Invoices extends DolibarrApi
/**
* Get discount from invoice
*
* @since 13.0.0 Initial implementation
*
* @param int $id Id of invoice
* @return Object Object with cleaned properties
*
@ -1328,6 +1373,8 @@ class Invoices extends DolibarrApi
/**
* Create a discount (credit available) for a credit note or a deposit.
*
* @since 10.0.0 Initial implementation
*
* @param int $id Invoice ID
* @return Object Object with cleaned properties
*
@ -1523,6 +1570,8 @@ class Invoices extends DolibarrApi
*
* Note that this consume the discount.
*
* @since 7.0.0 Initial implementation
*
* @param int $id Id of invoice
* @param int $discountid Id of discount
* @return int
@ -1568,6 +1617,8 @@ class Invoices extends DolibarrApi
*
* Note that this consume the credit note.
*
* @since 7.0.0 Initial implementation
*
* @param int $id Id of invoice
* @param int $discountid Id of a discount coming from a credit note
* @return int
@ -1613,6 +1664,8 @@ class Invoices extends DolibarrApi
/**
* Get list of payments of a given invoice
*
* @since 7.0.0 Initial implementation
*
* @param int $id Id of invoice
* @return array
* @phan-return array<array{amount:int|float,date:int,num:string,ref:string,ref_ext?:string,fk_bank_line?:int,type:string}>
@ -1655,6 +1708,8 @@ class Invoices extends DolibarrApi
/**
* Add payment line to a specific invoice with the remain to pay as amount.
*
* @since 7.0.0 Initial implementation
*
* @param int $id Id of invoice
* @param string $datepaye {@from body} Payment date
* @param int $paymentid {@from body} Payment mode Id {@min 1}
@ -1775,6 +1830,8 @@ class Invoices extends DolibarrApi
* Warning: Take care that all invoices are owned by the same customer.
* Example of value for parameter arrayofamounts: {"1": {"amount": "99.99", "multicurrency_amount": ""}, "2": {"amount": "", "multicurrency_amount": "10"}}
*
* @since 8.0.0 Initial implementation
*
* @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
* @phan-param array<string,array{amount:string,multicurrency_amount:string}> $arrayofamounts
* @phpstan-param array<string,array{amount:string,multicurrency_amount:string}> $arrayofamounts
@ -1925,6 +1982,8 @@ class Invoices extends DolibarrApi
/**
* Update a payment
*
* @since 13.0.0 Initial implementation
*
* @param int $id Id of payment
* @param string $num_payment Payment number
*
@ -2026,6 +2085,8 @@ class Invoices extends DolibarrApi
*
* Return an array with invoice information
*
* @since 16.0.0 Initial implementation
*
* @param int $id ID of template invoice
* @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses
* @return Object Object with cleaned properties
@ -2045,6 +2106,8 @@ class Invoices extends DolibarrApi
*
* Get a list of template invoices
*
* @since 23.0.0 Initial implementation
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list

View file

@ -494,8 +494,12 @@ if ($search_total_ttc) {
if ($search_service) {
$param .= '&amp;search_service='.urlencode($search_service);
}
if ($search_status) {
$param .= '&amp;search_status='.urlencode($search_status);
if ($search_status != '') {
if ($filter == 'expired' || $filter == 'notexpired') {
$param .= '&amp;search_status='.urlencode($search_status.'&filter='.$filter);
} else {
$param .= '&amp;search_status='.urlencode($search_status);
}
}
if ($search_option) {
$param .= "&amp;search_option=".urlencode($search_option);

View file

@ -3465,7 +3465,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed = 1;
}
$original_file = $conf->accounting->dir_output.'/'.$original_file;
} elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) {
} elseif (($modulepart == 'expedition' || $modulepart == 'shipment' || $modulepart == 'shipping') && !empty($conf->expedition->dir_output)) {
// Wrapping pour les expedition
if ($fuser->hasRight('expedition', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;

View file

@ -15648,8 +15648,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
}
// Be sure we don't have output buffering enabled to have readfile working correctly
while (ob_get_level()) {
ob_end_flush();
$level = ob_get_level();
ob_start();
while (ob_get_level() > $level) {
ob_end_clean();
}
// Solution 0

View file

@ -1037,10 +1037,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if ($this->version == 'dolibarr' || $this->version == 'dolibarr_deprecated') {
return 'core';
}
if (!empty($this->version) && !in_array($this->version, array('experimental', 'development')) && empty($this->version_core)) {
if (!empty($this->version) && !in_array($this->version, array('experimental', 'development')) && empty($this->version_if_core)) {
return 'external';
}
if (!empty($this->editor_name) || !empty($this->editor_url) && empty($this->version_core)) {
if (!empty($this->editor_name) || !empty($this->editor_url) && empty($this->version_if_core)) {
return 'external';
}
if ($this->numero >= 100000) {

View file

@ -348,13 +348,14 @@ class pdf_espadon extends ModelePdfExpedition
if (!empty($notetoshow) || !empty($object->tracking_number)) {
$tab_top -= 2;
$tab_topbeforetrackingnumber = $tab_top;
$height_trackingnumber = 0;
// Tracking number
if (!empty($object->tracking_number)) {
$height_trackingnumber = 4;
$tracking_block_start_y = $tab_top;
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber") . " : " . $object->tracking_number, 0, 1, false, true, 'L');
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber") . " : " . $object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
$object->getUrlTrackingStatus((string) $object->tracking_number);
@ -373,12 +374,15 @@ class pdf_espadon extends ModelePdfExpedition
$label .= $object->tracking_url;
}
$height_trackingnumber += 4;
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L');
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L');
}
}
$tab_top = $pdf->GetY();
$height_trackingnumber = $tab_top - $tracking_block_start_y;
if ($height_trackingnumber < 4) {
$height_trackingnumber = 4;
}
}
// Notes

View file

@ -57,7 +57,7 @@ class modBlockedLog extends DolibarrModules
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = constant('DOLCERT_VERSION');
$this->version_core = 1;
$this->version_if_core = 1;
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.

View file

@ -235,8 +235,8 @@ class modStock extends DolibarrModules
);
$this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon
$this->export_aggregate_array[$r] = array(); // TODO Not used yet
$keyforselect = 'warehouse';
$keyforelement = 'warehouse';
$keyforselect = 'entrepot';
$keyforelement = 'entrepot';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';

View file

@ -163,3 +163,5 @@ TOTP=TOTP (Time-base One-Time Password)
UserRemovedFromGroup=User removed from group
UserSetInGroup=User set in group
ColorGroup=Color of group
NotHolidayApprover=Not allowed to approve holiday
NotExpenseReportApprover=Not allowed to approve expense report

View file

@ -163,3 +163,5 @@ TOTP=TOTP (mot de passe à usage unique basé sur le temps)
UserRemovedFromGroup=utilisateur supprimé du groupe
UserSetInGroup=utilisateur défini dans le groupe
ColorGroup=Couleur du groupe
NotHolidayApprover=N'est pas autorisé à valider des congés
NotExpenseReportApprover=N'est pas autorisé à valider des notes de frais

View file

@ -438,8 +438,8 @@ class Products extends DolibarrApi
$result = $this->product->update($id, DolibarrApiAccess::$user, 1, 'update', $updatetype);
// If price mode is 1 price per product
if ($result > 0 && getDolGlobalString('PRODUCT_PRICE_UNIQ')) {
// If price mode is 1 price per product or price by client
if ($result > 0 && (getDolGlobalString('PRODUCT_PRICE_UNIQ') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES'))) {
// We update price only if it was changed
$pricemodified = false;
if ($this->product->price_base_type != $oldproduct->price_base_type) {

View file

@ -517,16 +517,23 @@ if ($usevirtualstock) {
$sqlProductionToProduce = '0';
}
$parameters = array();
$sqlHookVirtualStock = "0";
$reshook = $hookmanager->executeHooks('printFieldListHavingVirtualStock', $parameters); // Note that $action and $object may have been modified by hook
if (!empty($hookmanager->resPrint)) {
$sqlHookVirtualStock = $hookmanager->resPrint;
}
$sql .= ' HAVING (';
$sql .= " (" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ") + ".$sqlHookVirtualStock."))";
$sql .= ' OR';
if ($includeproductswithoutdesiredqty == 'on') {
$sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
} else {
$sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
}
$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ") + ".$sqlHookVirtualStock."))";
$sql .= ")";
if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
$sql .= " AND (";
@ -540,7 +547,7 @@ if ($usevirtualstock) {
} else {
$sql .= $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
}
$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . "))";
$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ") + ".$sqlHookVirtualStock.")";
$sql .= ")";
$alertchecked = 'checked';
}

View file

@ -5,6 +5,7 @@
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Jessica Kowal <jessicakowal69@gmail.com>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2026 William Mead <william@m34d.com>
*
* 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
@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/timespent.class.php';
/**
* API class for projects
*
* @since 5.0.0 Initial implementation
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
@ -63,6 +65,8 @@ class Tasks extends DolibarrApi
*
* Return an array with task information
*
* @since 5.0.0 Initial implementation
*
* @param int $id ID of task
* @param int $includetimespent 0=Return only task. 1=Include a summary of time spent, 2=Include details of time spent lines
* @return array|mixed data without useless information
@ -101,17 +105,20 @@ class Tasks extends DolibarrApi
*
* Get a list of tasks
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @return array Array of project objects
* @since 5.0.0 Initial implementation
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0
* @return array Array of project objects
* @phan-return Task[]
* @phpstan-return Task[]
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '', $pagination_data = false)
{
global $db, $conf;
@ -155,6 +162,9 @@ class Tasks extends DolibarrApi
}
}
//this query will return total tasks with the filters given
$sqlTotals = str_replace('SELECT t.rowid', 'SELECT count(t.rowid) as total', $sql);
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
@ -184,12 +194,31 @@ class Tasks extends DolibarrApi
throw new RestException(503, 'Error when retrieve task list : ' . $this->db->lasterror());
}
//if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit)
if ($pagination_data) {
$totalsResult = $this->db->query($sqlTotals);
$total = $this->db->fetch_object($totalsResult)->total;
$tmp = $obj_ret;
$obj_ret = [];
$obj_ret['data'] = $tmp;
$obj_ret['pagination'] = [
'total' => (int) $total,
'page' => $page, //count starts from 0
'page_count' => ceil((int) $total / $limit),
'limit' => $limit
];
}
return $obj_ret;
}
/**
* Create task object
*
* @since 5.0.0 Initial implementation
*
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
@ -273,6 +302,8 @@ class Tasks extends DolibarrApi
/**
* Get time spent of a task
*
* @since 23.0.0 Initial implementation
*
* @param int $id Id of task
* @return array<int,mixed> Array of timespent lines
*
@ -306,6 +337,8 @@ class Tasks extends DolibarrApi
/**
* Get roles a user is assigned to a task with
*
* @since 5.0.0 Initial implementation
*
* @param int $id Id of task
* @param int $userid Id of user (0 = connected user)
* @return array Array of roles
@ -483,6 +516,8 @@ class Tasks extends DolibarrApi
/**
* Update task general fields (won't touch time spent of task)
*
* @since 5.0.0 Initial implementation
*
* @param int $id Id of task to update
* @param array $request_data Data
* @phan-param ?array<string,string> $request_data
@ -532,6 +567,8 @@ class Tasks extends DolibarrApi
/**
* Delete task
*
* @since 5.0.0 Initial implementation
*
* @param int $id Task ID
*
* @return array
@ -568,6 +605,8 @@ class Tasks extends DolibarrApi
/**
* Get time spent of a task
*
* @since 23.0.0 Initial implementation
*
* @param int $id Id of task
* @param int $timespent_id Id of timespent
*
@ -609,6 +648,8 @@ class Tasks extends DolibarrApi
* You can test this API with the following input message
* { "date": "2016-12-31 23:15:00", "duration": 1800, "user_id": 1, "note": "My time test" }
*
* @since 5.0.0 Initial implementation
*
* @param int $id Task ID
* @param datetime|string $date Date (YYYY-MM-DD HH:MI:SS in GMT)
* @param int $duration Duration in seconds (3600 = 1h)
@ -677,6 +718,8 @@ class Tasks extends DolibarrApi
* You can test this API with the following input message
* { "date": "2016-12-31 23:15:00", "duration": 1800, "user_id": 1, "note": "My time test" }
*
* @since 17.0.0 Initial implementation
*
* @param int $id Task ID
* @param int $timespent_id Time spent ID (llx_element_time.rowid)
* @param datetime $date Date (YYYY-MM-DD HH:MI:SS in GMT)
@ -731,6 +774,8 @@ class Tasks extends DolibarrApi
/**
* Delete time spent for a task of a project.
*
* @since 17.0.0 Initial implementation
*
* @param int $id Task ID
* @param int $timespent_id Time spent ID (llx_element_time.rowid)
*
@ -992,6 +1037,8 @@ class Tasks extends DolibarrApi
*
* Return an array with contact information
*
* @since 23.0.0 Initial implementation
*
* @param int $id ID of task
* @param string $type Type of the contact
* @return array<int,mixed> Array with cleaned properties
@ -1026,6 +1073,8 @@ class Tasks extends DolibarrApi
/**
* Adds a contact to a task
*
* @since 23.0.0 Initial implementation
*
* @param int $id Task ID
* @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if source = 'internal') to link
* @param string $type_contact Type of contact (code). Must a code found into table llx_c_type_contact. For example: BILLING
@ -1073,6 +1122,8 @@ class Tasks extends DolibarrApi
/**
* Delete a contact type of given task
*
* @since 23.0.0 Initial implementation
*
* @param int $id Id of task to update
* @param int $contactid Row key of the contact in the array contact_ids.
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).

View file

@ -191,6 +191,18 @@ dol_syslog("***** Stripe IPN was called with event->type=".$event->type." servic
sleep(2);
// Hook to allow external modules to handle Stripe webhook events
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('stripeipn'));
$parameters = array('event' => $event, 'servicestatus' => $servicestatus, 'service' => $service);
$reshook = $hookmanager->executeHooks('stripeWebhookEvent', $parameters, $event->data->object, $event->type);
if ($reshook > 0) {
// A hook handled the event entirely, stop processing
http_response_code(200);
return;
}
if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_PAYOUT')) {
// When a payout is created by Stripe to transfer money to your account
dol_syslog("object = ".formatLogObject($event->data));

View file

@ -70,6 +70,7 @@ $idproduct = GETPOSTINT('idproduct');
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
$placeid = 0; // $placeid is ID of invoice
$mobilepage = GETPOST('mobilepage', 'alpha');
$batch = ''; // Default no batch if missing
// Terminal is stored into $_SESSION["takeposterminal"];
@ -227,6 +228,7 @@ if (empty($reshook)) {
$sql .= ")";
$sql .= " AND status = 1";
$refcashcontrol = 0;
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025-2026 MDW <mdeweerd@users.noreply.github.com>
*
* 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,7 +133,7 @@ if ($action == "send" && $user->hasRight('takepos', 'run')) {
print 'Failed to send email: '.$mail->error;
http_response_code('500');
http_response_code(500);
} else {
$result = $mail->sendfile();
if ($result) {
@ -143,19 +143,17 @@ if ($action == "send" && $user->hasRight('takepos', 'run')) {
$object->context['email_to'] = $sendto;
$object->context['email_msgid'] = $mail->msgid;
// Same code than into actions_sendmail.inc.php
if ($triggersendname == 'BILL_SENTBYMAIL' && $object instanceof Facture) {
/* @var Facture $object */
// Same code as in actions_sendmail.inc.php
// if ($triggersendname === 'BILL_SENTBYMAIL' && $object instanceof Facture) { // Always true ($triggersendname is set above, and $object = $invoice = Facture object
// If sending email for invoice, we increase the counter of invoices sent by email
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET email_sent_counter = email_sent_counter + 1";
$sql .= " WHERE rowid = ".((int) $object->id);
// If sending email for invoice, we increase the counter of invoices sent by email
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET email_sent_counter = email_sent_counter + 1";
$sql .= " WHERE rowid = ".((int) $object->id);
$resql = $db->query($sql);
if ($resql) {
$object->email_sent_counter += 1;
}
$resql = $db->query($sql);
if ($resql) {
$object->email_sent_counter += 1;
}
// }
$result = $object->call_trigger($triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable
if ($result < 0) {
@ -170,12 +168,12 @@ if ($action == "send" && $user->hasRight('takepos', 'run')) {
print "\n";
print 'If template ask to join file, it may include the file '.implode(',', $joinFile);
} else {
http_response_code('500');
http_response_code(500);
}
} else {
print 'Failed to send email: '.$mail->error;
http_response_code('500');
http_response_code(500);
}
}

View file

@ -10,6 +10,7 @@
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2026 Charlene Benke <charlene@patas-monkey.com>
*
* 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
@ -420,6 +421,20 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
} else {
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
}
if (isModEnabled('holiday')) {
$holidayapprover = new Holiday($db);
$arrayApprover = $holidayapprover->fetch_users_approver_holiday();
if (!in_array((string) $object->fk_user, $arrayApprover)) {
print '<br><span class="opacitymedium">('.$langs->trans("NotHolidayApprover").')</span>';
}
}
if (isModEnabled('expensereport')) {
$expensereportapprover = new ExpenseReport($db);
$arrayApprover = $expensereportapprover->fetch_users_approver_expensereport();
if (!in_array((string) $object->fk_user, $arrayApprover)) {
print '<br><span class="opacitymedium">('.$langs->trans("NotExpenseReportApprover").')</span>';
}
}
}
print '</td>';
print "</tr>\n";

View file

@ -61,7 +61,7 @@ processes = -1
#verbose = 1
#exclude_rules = "LT01,CP01,RF04"
# RF04 | Keywords should not be used as identifiers. (rowid, login, position, ...)
exclude_rules = "LT01,LT02,LT05,LT12,LT13,LT14,CP01,CP02,CP04,CP05,RF04"
exclude_rules = "LT01,LT02,LT05,LT12,LT13,LT14,LT15,CP01,CP02,CP04,CP05,RF04"
dialect = "mysql"
# Default byte limit is 20000, must set limit - some files are too big.
large_file_skip_byte_limit = 100000