Merge branch 'develop' into FIX---php-V8-expedition-card

This commit is contained in:
Anthony Berton 2022-06-27 11:19:22 +02:00 committed by GitHub
commit bc375ad007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 106 additions and 46 deletions

View File

@ -124,6 +124,12 @@ class Facture extends CommonInvoice
*/
public $fk_user_valid;
/**
* @var int ID
*/
public $fk_user_modif;
public $date; // Date invoice
public $datem;
@ -1935,7 +1941,7 @@ class Facture extends CommonInvoice
$sql .= ', f.datec as datec';
$sql .= ', f.date_valid as datev';
$sql .= ', f.tms as datem';
$sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc';
$sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.fk_user_modif, f.model_pdf, f.last_main_doc';
$sql .= ', f.fk_facture_source, f.fk_fac_rec_source';
$sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams';
$sql .= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
@ -2023,8 +2029,10 @@ class Facture extends CommonInvoice
$this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author; // deprecated
$this->user_valid = $obj->fk_user_valid; // deprecated
$this->fk_user_author = $obj->fk_user_author;
$this->user_modification = $obj->fk_user_modif; // deprecated
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_valid = $obj->fk_user_valid;
$this->fk_user_modif = $obj->fk_user_modif;
$this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated
$this->last_main_doc = $obj->last_main_doc;

View File

@ -51,12 +51,12 @@ if ($id > 0 || !empty($ref)) {
}
// Security check
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) {
$socid = $user->socid;
}
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $fieldid, $isdraft);
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
/*

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
@ -237,7 +237,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
}
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
@ -367,7 +367,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
}
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
$alreadypaid = $facstatic->getSommePaiement();
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
print '</tr>';
@ -437,7 +437,7 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
$total_ttc = $totalam = $total_ht = 0;
while ($i < $num && $i < $max) {
$objp = $db->fetch_object($result);
$obj = $db->fetch_object($result);
if ($i >= $max) {
$othernb += 1;
@ -447,24 +447,24 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
continue;
}
$donationstatic->id = $objp->rowid;
$donationstatic->ref = $objp->rowid;
$donationstatic->lastname = $objp->lastname;
$donationstatic->firstname = $objp->firstname;
$donationstatic->date = $objp->date;
$donationstatic->statut = $objp->status;
$donationstatic->status = $objp->status;
$donationstatic->id = $obj->rowid;
$donationstatic->ref = $obj->rowid;
$donationstatic->lastname = $obj->lastname;
$donationstatic->firstname = $obj->firstname;
$donationstatic->date = $obj->date;
$donationstatic->statut = $obj->status;
$donationstatic->status = $obj->status;
$label = $donationstatic->getFullName($langs);
if ($objp->societe) {
$label .= ($label ? ' - ' : '').$objp->societe;
if ($obj->societe) {
$label .= ($label ? ' - ' : '').$obj->societe;
}
print '<tr class="oddeven tdoverflowmax100">';
print '<td>'.$donationstatic->getNomUrl(1).'</td>';
print '<td>'.$label.'</td>';
print '<td class="nowrap right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->dm), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->dm), 'day', 'tzuserrel').'</td>';
print '<td>'.$donationstatic->getLibStatut(3).'</td>';
print '</tr>';

View File

@ -169,13 +169,13 @@ abstract class CommonObject
public $canvas;
/**
* @var Project The related project
* @var Project The related project object
* @see fetch_projet()
*/
public $project;
/**
* @var int The related project ID
* @var int The related project ID
* @see setProject(), project
*/
public $fk_project;
@ -188,24 +188,24 @@ abstract class CommonObject
/**
* @deprecated
* @see fk_project
* @see $fk_project
*/
public $fk_projet;
/**
* @var Contact a related contact
* @var Contact A related contact object
* @see fetch_contact()
*/
public $contact;
/**
* @var int The related contact ID
* @var int The related contact ID
* @see fetch_contact()
*/
public $contact_id;
/**
* @var Societe A related thirdparty
* @var Societe A related thirdparty object
* @see fetch_thirdparty()
*/
public $thirdparty;
@ -254,7 +254,7 @@ abstract class CommonObject
public $newref;
/**
* @var int The object's status
* @var int The object's status. Prefer use of status.
* @see setStatut()
*/
public $statut;
@ -265,6 +265,7 @@ abstract class CommonObject
*/
public $status;
/**
* @var string
* @see getFullAddress()
@ -319,6 +320,7 @@ abstract class CommonObject
*/
public $region;
/**
* @var int
* @see fetch_barcode()
@ -518,6 +520,24 @@ abstract class CommonObject
*/
public $date_modification; // Date last change (tms field)
/**
* @var string User id of author
* @deprecated
*/
public $user_author;
/**
* @var string User id of validation
* @deprecated
*/
public $user_valid;
/**
* @var string User id of last modifier
* @deprecated
*/
public $user_modification;
public $next_prev_filter;
/**
@ -535,6 +555,7 @@ abstract class CommonObject
*/
public $alreadypaid;
/**
* @var array List of child tables. To test if we can delete object.
*/
@ -8402,8 +8423,6 @@ abstract class CommonObject
$photo = '';
$file = $val['name'];
//if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
//if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
if (image_format_supported($file) >= 0) {
$nbphoto++;

View File

@ -42,6 +42,34 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
if (!function_exists('utf8_encode')) {
/**
* Implement utf8_encode for PHP that does not support it.
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
*/
function utf8_encode($elements)
{
return mb_convert_encoding($elements, 'UTF-8', 'ISO-8859-1');
}
}
if (!function_exists('utf8_decode')) {
/**
* Implement utf8_decode for PHP that does not support it.
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
*/
function utf8_decode($elements)
{
return mb_convert_encoding($elements, 'ISO-8859-1', 'UTF-8');
}
}
/**
* Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set

View File

@ -182,7 +182,7 @@ function showOnlinePaymentUrl($type, $ref)
// Load translation files required by the page
$langs->loadLangs(array('payment', 'stripe'));
$servicename = $langs->transnoentitiesnoconv('Online');
$servicename = ''; // Link is a generic link for all payments services (paypal, stripe, ...)
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>';
$url = getOnlinePaymentUrl(0, $type, $ref);

View File

@ -65,6 +65,9 @@ class mod_lot_advanced extends ModeleNumRefBatch
$form = new Form($db);
// We get cursor rule
$mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : '';
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
@ -80,13 +83,13 @@ class mod_lot_advanced extends ModeleNumRefBatch
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskLot" value="'.$conf->global->LOT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskLot" value="'.$mask.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
// Option to enable custom masks per product
$texte .= '<td class="right">';
if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) {
if (!empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS)) {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
@ -139,7 +142,7 @@ class mod_lot_advanced extends ModeleNumRefBatch
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// We get cursor rule
$mask = $conf->global->LOT_ADVANCED_MASK;
$mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : '';
if (!$mask) {
$this->error = 'NotConfigured';

View File

@ -65,6 +65,9 @@ class mod_sn_advanced extends ModeleNumRefBatch
$form = new Form($db);
// We get cursor rule
$mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : '';
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
@ -80,13 +83,13 @@ class mod_sn_advanced extends ModeleNumRefBatch
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskSN" value="'.$conf->global->SN_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskSN" value="'.$mask.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
// Option to enable custom masks per product
$texte .= '<td class="right">';
if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) {
if (!empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)) {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
@ -139,7 +142,7 @@ class mod_sn_advanced extends ModeleNumRefBatch
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// We get cursor rule
$mask = $conf->global->SN_ADVANCED_MASK;
$mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : '';
if (!$mask) {
$this->error = 'NotConfigured';

View File

@ -54,7 +54,7 @@ if (!empty($conf->commande->enabled)) {
}
if (isModEnabled('facture')) {
print '<div id="invoice"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("bills");
@ -76,7 +76,7 @@ if (isModEnabled('facture')) {
}
if (!empty($conf->contrat->enabled)) {
print '<div id="contractline"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("contracts");
@ -98,7 +98,7 @@ if (!empty($conf->contrat->enabled)) {
}
if (!empty($conf->adherent->enabled)) {
print '<div id="membersubscription"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("members");
@ -120,7 +120,7 @@ if (!empty($conf->adherent->enabled)) {
}
if (!empty($conf->don->enabled)) {
print '<div id="donation"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$langs->load("members");

View File

@ -4633,7 +4633,7 @@ class Product extends CommonObject
);
// Recursive call if there is childs to child
if (isset($desc_pere['childs']) and is_array($desc_pere['childs'])) {
if (isset($desc_pere['childs']) && is_array($desc_pere['childs'])) {
//print 'YYY We go down for '.$desc_pere[3]." -> \n";
$this->fetch_prod_arbo($desc_pere['childs'], $compl_path.$desc_pere[3]." -> ", $desc_pere[1] * $multiply, $level + 1, $id, $ignore_stock_load);
}

View File

@ -380,6 +380,7 @@ if ($id > 0 || !empty($ref)) {
print '</tr>'."\n";
$totalsell = 0;
$total = 0;
if (count($prods_arbo)) {
foreach ($prods_arbo as $value) {
$productstatic->fetch($value['id']);
@ -418,7 +419,7 @@ if ($id > 0 || !empty($ref)) {
$unitline = price2num(($fourn_unitprice * (1 - ($fourn_remise_percent / 100)) - $fourn_remise), 'MU');
$totalline = price2num($value['nb'] * ($fourn_unitprice * (1 - ($fourn_remise_percent / 100)) - $fourn_remise), 'MT');
$total += $totalline;
$total += $totalline;
print '<td class="right nowraponall">';
print ($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : '').'<span class="amount">'.price($unitline, '', '', 0, 0, -1, $conf->currency)).'</span>';
@ -680,7 +681,7 @@ if ($id > 0 || !empty($ref)) {
print '<td>'.$productstatic->getNomUrl(1, '', 24).'</td>';
$labeltoshow = $objp->label;
if ($conf->global->MAIN_MULTILANGS && $objp->labelm) {
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->labelm)) {
$labeltoshow = $objp->labelm;
}

View File

@ -2319,9 +2319,8 @@ class Ticket extends CommonObject
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (!utf8_check($file)) {
$file = utf8_encode($file);
$file = utf8_encode($file); // To be sure data is stored in UTF8 in memory
}
// To be sure data is stored in UTF8 in memory
if (dol_is_file($dir.$file)) {
return true;
}

View File

@ -885,7 +885,6 @@ if ($action == 'addcontainer' && $usercanedit) {
} else {
// Clean some comment
//$tmpgeturl['content'] = dol_string_is_good_iso($tmpgeturl['content'], 1);
//$tmpgeturl['content'] = utf8_encode(utf8_decode($tmpgeturl['content']));
//$tmpgeturl['content'] = mb_convert_encoding($tmpgeturl['content'], 'UTF-8', 'UTF-8');
//$tmpgeturl['content'] = remove_bs($tmpgeturl['content']);
//$tmpgeturl['content'] = str_replace('$screen-md-max', 'auto', $tmpgeturl['content']);