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

develop
This commit is contained in:
Laurent Destailleur 2024-01-20 17:55:39 +01:00
commit 18a6d9695c
37 changed files with 117 additions and 106 deletions

View File

@ -1,4 +1,5 @@
$objMod->dictionaries = $objMod->{"dictionnaries"}; // For backward compatibility
if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;id_entrepot='.$entrepotstatic->id.'&amp;action=transfert&amp;pdluoid='.$pdluo->id.'">';
$reponsesadd = str_split($obj->reponses);
$sql .= " SET reponses = '".$db->escape($reponsesadd)."'";

View File

@ -40,7 +40,7 @@ if (!$user->admin) {
accessforbidden();
}
$id = GETPOST('rowid', 'int');
$id = GETPOSTINT('rowid');
$action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optionscss', 'alphanohtml');

View File

@ -65,12 +65,12 @@ if (empty($reshook)) {
$apply_to = GETPOST('apply_to');
$fk_user = GETPOST('fk_user', 'int');
$fk_usergroup = GETPOST('fk_usergroup', 'int');
$restrictive = GETPOST('restrictive', 'int');
$fk_c_type_fees = GETPOST('fk_c_type_fees', 'int');
$restrictive = GETPOSTINT('restrictive');
$fk_c_type_fees = GETPOSTINT('fk_c_type_fees');
$code_expense_rules_type = GETPOST('code_expense_rules_type');
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$amount = price2num(GETPOST('amount'), 'MT', 2);
$amount = (float) price2num(GETPOST('amount'), 'MT', 2);
if (!empty($id)) {
$result = $object->fetch($id);

View File

@ -40,8 +40,8 @@ $title = (string) GETPOST("title", "alpha");
$url = (string) GETPOST("url", "alpha");
$urlsource = GETPOST("urlsource", "alpha");
$target = GETPOST("target", "int");
$userid = GETPOST("userid", "int");
$position = GETPOST("position", "int");
$userid = GETPOSTINT("userid");
$position = GETPOSTINT("position");
$backtopage = GETPOST('backtopage', 'alpha');

View File

@ -72,7 +72,7 @@ $addreminder = GETPOST('addreminder', 'alpha');
$offsetvalue = GETPOSTINT('offsetvalue');
$offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
$remindertype = GETPOST('selectremindertype', 'aZ09');
$modelmail = GETPOST('actioncommsendmodel_mail', 'int');
$modelmail = GETPOSTINT('actioncommsendmodel_mail');
$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed
$private = GETPOST('private', 'alphanohtml');
if ($complete == 'na' || $complete == -2) {
@ -368,7 +368,7 @@ if (empty($reshook) && $action == 'add') {
$hasPermissionOnLinkedObject = 1;
}
if ($hasPermissionOnLinkedObject) {
$object->fk_element = GETPOST("fk_element", 'int');
$object->fk_element = GETPOSTINT("fk_element");
$object->elementtype = GETPOST("elementtype", 'alpha');
}
}
@ -387,7 +387,7 @@ if (empty($reshook) && $action == 'add') {
}
$object->fk_project = GETPOSTISSET("projectid") ? GETPOST("projectid", 'int') : 0;
$taskid = GETPOST('taskid', 'int');
$taskid = GETPOSTINT('taskid');
if (!empty($taskid)) {
$taskProject = new Task($db);
if ($taskProject->fetch($taskid) > 0) {
@ -426,7 +426,7 @@ if (empty($reshook) && $action == 'add') {
if (!$error && getDolGlobalString('AGENDA_ENABLE_DONEBY')) {
if (GETPOST("doneby") > 0) {
$object->userdoneid = GETPOST("doneby", "int");
$object->userdoneid = GETPOSTINT("doneby");
}
}
@ -437,7 +437,7 @@ if (empty($reshook) && $action == 'add') {
}
if (GETPOST('socid', 'int') > 0) {
$object->socid = GETPOST('socid', 'int');
$object->socid = GETPOSTINT('socid');
$object->fetch_thirdparty();
$object->societe = $object->thirdparty; // For backward compatibility

View File

@ -218,7 +218,7 @@ if (empty($reshook)) {
// assujetissement a la TVA
if ($action == 'setassujtva' && $user->hasRight('societe', 'creer')) {
$object->fetch($id);
$object->tva_assuj = GETPOST('assujtva_value');
$object->tva_assuj = GETPOSTINT('assujtva_value');
$result = $object->update($object->id);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -131,7 +131,7 @@ class Commande extends CommonOrder
public $billed;
/**
* @var string Limit date payment
* @var int Deadline for payment
*/
public $date_lim_reglement;
/**

View File

@ -528,7 +528,7 @@ if (empty($reshook)) {
}
} elseif ($action == 'setrevenuestamp' && $usercancreate) {
$object->fetch($id);
$object->revenuestamp = GETPOST('revenuestamp');
$object->revenuestamp = (float) price2num(GETPOST('revenuestamp'));
$result = $object->update($user);
$object->update_price(1);
if ($result < 0) {
@ -1003,7 +1003,7 @@ if (empty($reshook)) {
} elseif ($action == 'add' && $usercancreate) {
// Insert new invoice in database
if ($socid > 0) {
$object->socid = GETPOST('socid', 'int');
$object->socid = GETPOSTINT('socid');
}
if (GETPOST('type', 'int') === '') {
@ -1104,7 +1104,7 @@ if (empty($reshook)) {
if (!empty($originentity)) {
$object->entity = $originentity;
}
$object->socid = GETPOST('socid', 'int');
$object->socid = GETPOSTINT('socid');
$object->subtype = GETPOST('subtype');
$object->ref = GETPOST('ref');
$object->date = $dateinvoice;
@ -1326,7 +1326,7 @@ if (empty($reshook)) {
}
if (!$error) {
$object->socid = GETPOST('socid', 'int');
$object->socid = GETPOSTINT('socid');
$object->type = GETPOST('type');
$object->subtype = GETPOST('subtype');
$object->ref = GETPOST('ref');
@ -1413,7 +1413,7 @@ if (empty($reshook)) {
}
if (!$error) {
$object->socid = GETPOST('socid', 'int');
$object->socid = GETPOSTINT('socid');
$object->type = GETPOST('type');
$object->subtype = GETPOST('subtype');
$object->ref = GETPOST('ref');

View File

@ -132,6 +132,9 @@ class FactureRec extends CommonInvoice
public $usenewprice = 0;
/**
* @var int Deadline for payment
*/
public $date_lim_reglement;
public $cond_reglement_code; // Code in llx_c_paiement
public $mode_reglement_code; // Code in llx_c_paiement

View File

@ -69,6 +69,9 @@ abstract class CommonInvoice extends CommonObject
*/
public $date;
/**
* @var int Deadline for payment
*/
public $date_lim_reglement;
public $cond_reglement_id; // Id in llx_c_paiement

View File

@ -941,7 +941,7 @@ class FormTicket
$stringtoprint .= '<option value="">&nbsp;</option>';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ";
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent WHERE ctcjoin.active > 0)", "'NOTPARENT'", "'PARENT'")." as isparent";
$sql .= " FROM ".$this->db->prefix()."c_ticket_category as ctc";
$sql .= " WHERE ctc.active > 0 AND ctc.entity = ".((int) $conf->entity);
if ($filtertype == 'public=1') {
@ -989,8 +989,8 @@ class FormTicket
if (count($arrayidused) == 1) {
return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">';
} else {
$stringtoprint .= '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'_select" class="maxwidth500 minwidth400">';
$stringtoprint .= '<input type="hidden" name="'.$htmlname.'_child_id" id="'.$htmlname.'_select_child_id" class="maxwidth500 minwidth400">';
$stringtoprint .= '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'_select" class="maxwidth500 minwidth400" value="'.GETPOST($htmlname).'">';
$stringtoprint .= '<input type="hidden" name="'.$htmlname.'_child_id" id="'.$htmlname.'_select_child_id" class="maxwidth500 minwidth400" '.GETPOST($htmlname).' value="'.GETPOST($htmlname."_child_id").'">';
}
$stringtoprint .= '</select>&nbsp;';
@ -1134,6 +1134,10 @@ class FormTicket
$stringtoprint .='$("#'.$htmlname.'_child_'.$use_multilevel.'").change(function() {
$("#ticketcategory_select").val($(this).val());
$("#ticketcategory_select_child_id").val($(this).attr("child_id"));
tmpvalselect = $("#ticketcategory_select").val();
if(tmpvalselect == "" && $("#ticketcategory_select_child_id").val() >= 1){
$("#ticketcategory_select_child_id").val($(this).attr("child_id")-1);
}
console.log($("#ticketcategory_select").val());
})';
$stringtoprint .='</script>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@netlogic.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,8 +31,8 @@
*
* @author Michael - https://www.php.net/manual/fr/function.empty.php#90767
* @param mixed $var Value to test
* @param int|null $allow_false Setting this to true will make the function consider a boolean value of false as NOT empty. This parameter is false by default.
* @param int|null $allow_ws Setting this to true will make the function consider a string with nothing but white space as NOT empty. This parameter is false by default.
* @param boolean $allow_false Setting this to true will make the function consider a boolean value of false as NOT empty. This parameter is false by default.
* @param boolean $allow_ws Setting this to true will make the function consider a string with nothing but white space as NOT empty. This parameter is false by default.
* @return boolean True of False
*/
function is_empty($var, $allow_false = false, $allow_ws = false)

View File

@ -1379,9 +1379,8 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
// phpcs:disable
// Complete the arrays &$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
// Note: "diction"."naries" to prevent codespell from detecting a spelling error.
if (empty($objMod->dictionaries) && !empty($objMod->{"dicton"."naries"})) {
$objMod->dictionaries = $objMod->{"diction"."naries"}; // For backward compatibility
if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) {
$objMod->dictionaries = $objMod->{"dictionnaries"}; // For backward compatibility
}
// phpcs:enable

View File

@ -5346,13 +5346,13 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
* This function must be called when a blocking technical error is encountered.
* However, one must try to call it only within php pages, classes must return their error through their property "error".
*
* @param DoliDB|string $db Database handler
* @param DoliDB|null $db Database handler
* @param string|string[] $error String or array of errors strings to show
* @param array $errors Array of errors
* @param string[]|null $errors Array of errors
* @return void
* @see dol_htmloutput_errors()
*/
function dol_print_error($db = '', $error = '', $errors = null)
function dol_print_error($db = null, $error = '', $errors = null)
{
global $conf, $langs, $argv;
global $dolibarr_main_prod;

View File

@ -587,12 +587,6 @@ class Cronjob extends CommonObject
$sql .= $this->db->plimit($limit + 1, $offset);
}
$sqlwhere = array();
if (count($sqlwhere) > 0) {
$sql .= " WHERE ".implode(' AND ', $sqlwhere);
}
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
@ -1330,7 +1324,7 @@ class Cronjob extends CommonObject
$error++;
} else {
dol_syslog(get_class($this)."::run_jobs END");
$this->lastoutput = dol_substr((empty($object->output) ? "" : $object->output."\n").$errmsg, 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1);
$this->lastoutput = dol_substr((empty($object->output) ? "" : $object->output."\n"), 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1);
$this->lastresult = var_export($result, true);
$retval = $this->lastresult;
}

0
htdocs/custom/README.md Normal file → Executable file
View File

View File

@ -212,6 +212,9 @@ class CommandeFournisseur extends CommonOrder
public $origin_id;
public $linked_objects = array();
/**
* @var int Deadline for payment
*/
public $date_lim_reglement;
public $receptions = array();

View File

@ -125,6 +125,9 @@ class FactureFournisseurRec extends CommonInvoice
public $cond_reglement_doc;
public $cond_reglement_id;
/**
* @var int Deadline for payment
*/
public $date_lim_reglement;
public $usenewprice = 0;

View File

@ -205,4 +205,6 @@ ALTER TABLE llx_c_tva ADD COLUMN type_vat smallint NOT NULL DEFAULT 0 AFTER fk_p
ALTER TABLE llx_categorie ADD COLUMN position integer DEFAULT 0 AFTER color;
ALTER TABLE llx_product DROP COLUMN onportal;
ALTER TABLE llx_product DROP COLUMN onportal;
ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtext;

View File

@ -29,7 +29,7 @@ CREATE TABLE llx_knowledgemanagement_knowledgerecord(
import_key varchar(14),
model_pdf varchar(255),
question text NOT NULL,
answer text,
answer longtext,
url varchar(255),
fk_ticket integer,
fk_c_ticket_category integer,

View File

@ -77,7 +77,7 @@ class PaymentLoan extends CommonObject
public $fk_typepayment;
/**
* @var int Payment ID
* @var string Payment ID (ex: 12345-chq1)
*/
public $num_payment;

View File

@ -152,9 +152,9 @@ if ($action == 'add_payment') {
$payment->amount_capital = $pay_amount_capital;
$payment->amount_insurance = $pay_amount_insurance;
$payment->amount_interest = $pay_amount_interest;
$payment->fk_bank = GETPOST('accountid', 'int');
$payment->fk_bank = GETPOSTINT('accountid');
$payment->paymenttype = GETPOST('paymenttype', 'int');
$payment->num_payment = GETPOST('num_payment');
$payment->num_payment = GETPOST('num_payment', 'alphanohtml');
$payment->note_private = GETPOST('note_private', 'restricthtml');
$payment->note_public = GETPOST('note_public', 'restricthtml');

View File

@ -42,7 +42,7 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$year = GETPOST('year', 'int') > 0 ? GETPOST('year', 'int') : $nowyear;
$year = GETPOSTINT('year') > 0 ? GETPOSTINT('year') : $nowyear;
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
$endyear = $year;

View File

@ -272,8 +272,8 @@ if (empty($reshook) && $action == 'add') {
$company->town = GETPOST('town');
$company->email = GETPOST('email');
$company->url = GETPOST('url');
$company->country_id = GETPOST('country_id', 'int');
$company->state_id = GETPOST('state_id', 'int');
$company->country_id = GETPOSTINT('country_id');
$company->state_id = GETPOSTINT('state_id');
$company->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
$resultat=$company->create($user);
@ -300,7 +300,7 @@ if (empty($reshook) && $action == 'add') {
$company->town = GETPOST('town');
}
if (empty($company->country_id)) {
$company->country_id = GETPOST('country_id', 'int');
$company->country_id = GETPOSTINT('country_id');
}
if (empty($company->email)) {
$company->email = GETPOST('email');
@ -309,7 +309,7 @@ if (empty($reshook) && $action == 'add') {
$company->url = GETPOST('url');
}
if (empty($company->state_id)) {
$company->state_id = GETPOST('state_id', 'int');
$company->state_id = GETPOSTINT('state_id');
}
if (empty($company->name_alias)) {
$company->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));

View File

@ -662,8 +662,8 @@ if ($action == 'charge' && isModEnabled('stripe')) {
$action = '';
}
}
} catch (\Stripe\Error\Card $e) {
// Since it's a decline, \Stripe\Error\Card will be caught
} catch (\Stripe\Exception\CardException $e) {
// Since it's a decline, \Stripe\Exception\Card will be caught
$body = $e->getJsonBody();
$err = $body['error'];
@ -679,21 +679,21 @@ if ($action == 'charge' && isModEnabled('stripe')) {
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\RateLimit $e) {
} catch (\Stripe\Exception\RateLimitException $e) {
// Too many requests made to the API too quickly
$error++;
$errormessage = "ErrorRateLimit ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\InvalidRequest $e) {
} catch (\Stripe\Exception\InvalidRequestException $e) {
// Invalid parameters were supplied to Stripe's API
$error++;
$errormessage = "ErrorInvalidRequest ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\Authentication $e) {
} catch (\Stripe\Exception\AuthenticationException $e) {
// Authentication with Stripe's API failed
// (maybe you changed API keys recently)
$error++;
@ -701,14 +701,14 @@ if ($action == 'charge' && isModEnabled('stripe')) {
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\ApiConnection $e) {
} catch (\Stripe\Exception\ApiConnectionException $e) {
// Network communication with Stripe failed
$error++;
$errormessage = "ErrorApiConnection ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\Base $e) {
} catch (\Stripe\Exception\ExceptionInterface $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
$error++;

View File

@ -228,8 +228,8 @@ if (empty($reshook) && $action == 'add') {
$thirdparty->address = GETPOST('address');
$thirdparty->zip = GETPOST('zip');
$thirdparty->town = GETPOST('town');
$thirdparty->country_id = GETPOST('country_id', 'int');
$thirdparty->state_id = GETPOST('state_id');
$thirdparty->country_id = GETPOSTINT('country_id');
$thirdparty->state_id = GETPOSTINT('state_id');
$thirdparty->client = $thirdparty::PROSPECT;
$thirdparty->code_client = 'auto';
$thirdparty->code_fournisseur = 'auto';

View File

@ -255,8 +255,8 @@ if (empty($reshook) && $action == 'add') {
$thirdparty->town = GETPOST("town");
$thirdparty->client = $thirdparty::PROSPECT;
$thirdparty->fournisseur = 0;
$thirdparty->country_id = GETPOST("country_id", 'int');
$thirdparty->state_id = GETPOST("state_id", 'int');
$thirdparty->country_id = GETPOSTINT("country_id");
$thirdparty->state_id = GETPOSTINT("state_id");
$thirdparty->email = ($emailcompany ? $emailcompany : $email);
// Load object modCodeTiers

View File

@ -256,8 +256,8 @@ if (empty($reshook) && $action == 'add') {
$thirdparty->town = GETPOST("town");
$thirdparty->client = $thirdparty::PROSPECT;
$thirdparty->fournisseur = 0;
$thirdparty->country_id = GETPOST("country_id", 'int');
$thirdparty->state_id = GETPOST("state_id", 'int');
$thirdparty->country_id = GETPOSTINT("country_id");
$thirdparty->state_id = GETPOSTINT("state_id");
$thirdparty->email = ($emailcompany ? $emailcompany : $email);
// Load object modCodeTiers

View File

@ -83,7 +83,7 @@ if (empty($origin_id)) {
$origin_id = GETPOST('originid', 'int'); // Id of order or propal
}
$ref = GETPOST('ref', 'alpha');
$line_id = GETPOST('lineid', 'int') ? GETPOST('lineid', 'int') : '';
$line_id = GETPOSTINT('lineid') ? GETPOSTINT('lineid') : 0;
$facid = GETPOST('facid', 'int');
$action = GETPOST('action', 'alpha');
@ -657,7 +657,7 @@ if (empty($reshook)) {
$line->id = $line_id;
$line->fk_entrepot = GETPOST($stockLocation, 'int');
$line->fk_entrepot = GETPOSTINT($stockLocation);
$line->qty = GETPOST($qty, 'int');
$line->comment = GETPOST($comment, 'alpha');

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.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
@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->loadLangs(array('resource', 'companies', 'other', 'main'));
// Get parameters
$id = GETPOST('id', 'int');
$id = GETPOSTINT('id');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$ref = GETPOST('ref', 'alpha');
@ -45,7 +45,7 @@ $zip = GETPOST('zipcode', 'alpha');
$town = GETPOST('town', 'alpha');
$description = GETPOST('description', 'restricthtml');
$confirm = GETPOST('confirm', 'aZ09');
$fk_code_type_resource = GETPOSTINT('fk_code_type_resource');
$fk_code_type_resource = GETPOST('fk_code_type_resource', 'aZ09');
$country_id = GETPOSTINT('country_id');
$state_id = GETPOSTINT('state_id');

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
/* Copyright (C) 2013-2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.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
@ -63,7 +63,7 @@ class Dolresource extends CommonObject
public $town;
/**
* @var int ID
* @var string ID
*/
public $fk_code_type_resource;
@ -104,7 +104,7 @@ class Dolresource extends CommonObject
public $tms;
/**
* Used by fetch_element_resource() to return an object
* Used by fetchElementResource() to return an object
*/
public $objelement;
@ -634,14 +634,14 @@ class Dolresource extends CommonObject
$error = 0;
// Clean parameters
if (isset($this->resource_id)) {
$this->resource_id = trim($this->resource_id);
if (!is_numeric($this->resource_id)) {
$this->resource_id = 0;
}
if (isset($this->resource_type)) {
$this->resource_type = trim($this->resource_type);
}
if (isset($this->element_id)) {
$this->element_id = trim($this->element_id);
if (!is_numeric($this->element_id)) {
$this->element_id = 0;
}
if (isset($this->element_type)) {
$this->element_type = trim($this->element_type);
@ -655,14 +655,13 @@ class Dolresource extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."element_resources SET";
$sql .= " resource_id=".(isset($this->resource_id) ? "'".$this->db->escape($this->resource_id)."'" : "null").",";
$sql .= " resource_type=".(isset($this->resource_type) ? "'".$this->db->escape($this->resource_type)."'" : "null").",";
$sql .= " element_id=".(isset($this->element_id) ? $this->element_id : "null").",";
$sql .= " element_type=".(isset($this->element_type) ? "'".$this->db->escape($this->element_type)."'" : "null").",";
$sql .= " busy=".(isset($this->busy) ? $this->busy : "null").",";
$sql .= " mandatory=".(isset($this->mandatory) ? $this->mandatory : "null").",";
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null');
$sql .= " resource_id = ".(isset($this->resource_id) ? (int) $this->resource_id : "null").",";
$sql .= " resource_type = ".(isset($this->resource_type) ? "'".$this->db->escape($this->resource_type)."'" : "null").",";
$sql .= " element_id = ".(isset($this->element_id) ? (int) $this->element_id : "null").",";
$sql .= " element_type = ".(isset($this->element_type) ? "'".$this->db->escape($this->element_type)."'" : "null").",";
$sql .= " busy = ".(isset($this->busy) ? (int) $this->busy : "null").",";
$sql .= " mandatory = ".(isset($this->mandatory) ? (int) $this->mandatory : "null").",";
$sql .= " tms = ".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null');
$sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();

View File

@ -314,7 +314,7 @@ class Salary extends CommonObject
$this->id = 0;
$this->tms = '';
$this->fk_user = '';
$this->fk_user = 0;
$this->datep = '';
$this->datev = '';
$this->amount = '';
@ -322,9 +322,9 @@ class Salary extends CommonObject
$this->datesp = '';
$this->dateep = '';
$this->note = '';
$this->fk_bank = '';
$this->fk_user_author = '';
$this->fk_user_modif = '';
$this->fk_bank = 0;
$this->fk_user_author = 0;
$this->fk_user_modif = 0;
}
/**

View File

@ -110,7 +110,7 @@ if (($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == '
$paiement->chid = $id; // deprecated
$paiement->datep = $datepaye;
$paiement->amounts = $amounts; // Tableau de montant
$paiement->fk_typepayment = GETPOST("paiementtype", 'alphanohtml');
$paiement->fk_typepayment = GETPOSTINT("paiementtype");
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'restricthtml');
$paiement->note_private = GETPOST("note", 'restricthtml');

View File

@ -339,11 +339,11 @@ class Stripe extends CommonObject
* @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
* @param int $status Status (0=test, 1=live)
* @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt
* @param int $mode automatic=automatic confirmation/payment when conditions are ok, manual=need to call confirm() on intent
* @param string $mode automatic=automatic confirmation/payment when conditions are ok, manual=need to call confirm() on intent
* @param boolean $confirmnow false=default, true=try to confirm immediately after create (if conditions are ok)
* @param string $payment_method 'pm_....' (if known)
* @param string $off_session If we use an already known payment method to pay when customer is not available during the checkout flow.
* @param string $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent
* @param int $off_session If we use an already known payment method to pay when customer is not available during the checkout flow.
* @param int $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent
* @param int $did ID of an existing line into llx_prelevement_demande (Dolibarr intent). If provided, no new line will be created.
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found and failed to create
*/
@ -603,7 +603,7 @@ class Stripe extends CommonObject
} else {
$_SESSION["stripe_payment_intent"] = $paymentintent;
}
} catch (Stripe\Error\Card $e) {
} catch (Stripe\Exception\CardException $e) {
$error++;
$this->error = $e->getMessage();
$this->code = $e->getStripeCode();
@ -1354,9 +1354,9 @@ class Stripe extends CommonObject
$return->message = $charge->id;
}
}
} catch (\Stripe\Error\Card $e) {
} catch (\Stripe\Exception\CardException $e) {
include DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
// Since it's a decline, \Stripe\Error\Card will be caught
// Since it's a decline, \Stripe\Exception\Card will be caught
$body = $e->getJsonBody();
$err = $body['error'];
@ -1372,24 +1372,24 @@ class Stripe extends CommonObject
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
} catch (\Stripe\Error\RateLimit $e) {
} catch (\Stripe\Exception\RateLimitException $e) {
// Too many requests made to the API too quickly
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
} catch (\Stripe\Error\InvalidRequest $e) {
} catch (\Stripe\Exception\InvalidRequestException $e) {
// Invalid parameters were supplied to Stripe's API
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
} catch (\Stripe\Error\Authentication $e) {
} catch (\Stripe\Exception\AuthenticationException $e) {
// Authentication with Stripe's API failed
// (maybe you changed API keys recently)
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
} catch (\Stripe\Error\ApiConnection $e) {
} catch (\Stripe\Exception\ApiConnectionException $e) {
// Network communication with Stripe failed
$error++;
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
} catch (\Stripe\Error\Base $e) {
} catch (\Stripe\Exception\ExceptionInterface $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
$error++;

View File

@ -33,13 +33,13 @@ global $conf;
global $stripearrayofkeysbyenv;
$stripearrayofkeysbyenv = array(
0=>array(
"secret_key" => !getDolGlobalString('STRIPE_TEST_SECRET_KEY') ? '' : $conf->global->STRIPE_TEST_SECRET_KEY,
"publishable_key" => !getDolGlobalString('STRIPE_TEST_PUBLISHABLE_KEY') ? '' : $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
array(
"secret_key" => getDolGlobalString('STRIPE_TEST_SECRET_KEY'),
"publishable_key" => getDolGlobalString('STRIPE_TEST_PUBLISHABLE_KEY')
),
1=>array(
"secret_key" => !getDolGlobalString('STRIPE_LIVE_SECRET_KEY') ? '' : $conf->global->STRIPE_LIVE_SECRET_KEY,
"publishable_key" => !getDolGlobalString('STRIPE_LIVE_PUBLISHABLE_KEY') ? '' : $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
array(
"secret_key" => getDolGlobalString('STRIPE_LIVE_SECRET_KEY'),
"publishable_key" => getDolGlobalString('STRIPE_LIVE_PUBLISHABLE_KEY')
)
);

View File

@ -574,7 +574,7 @@ if (empty($reshook)) {
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && $usercancreate) {
$langs->load('errors');

View File

@ -44,7 +44,7 @@ $result = restrictedArea($user, 'user', $id, 'user', $feature2);
$object = new User($db);
$result = $object->fetch($id);
if ($result <= 0) {
dol_print_error($object->error);
dol_print_error($db, $object->error);
exit;
}