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; public $fk_user_valid;
/**
* @var int ID
*/
public $fk_user_modif;
public $date; // Date invoice public $date; // Date invoice
public $datem; public $datem;
@ -1935,7 +1941,7 @@ class Facture extends CommonInvoice
$sql .= ', f.datec as datec'; $sql .= ', f.datec as datec';
$sql .= ', f.date_valid as datev'; $sql .= ', f.date_valid as datev';
$sql .= ', f.tms as datem'; $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_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.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'; $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->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author; // deprecated $this->user_author = $obj->fk_user_author; // deprecated
$this->user_valid = $obj->fk_user_valid; // deprecated $this->user_valid = $obj->fk_user_valid; // deprecated
$this->user_modification = $obj->fk_user_modif; // deprecated
$this->fk_user_author = $obj->fk_user_author; $this->fk_user_author = $obj->fk_user_author;
$this->fk_user_valid = $obj->fk_user_valid; $this->fk_user_valid = $obj->fk_user_valid;
$this->fk_user_modif = $obj->fk_user_modif;
$this->model_pdf = $obj->model_pdf; $this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated $this->modelpdf = $obj->model_pdf; // deprecated
$this->last_main_doc = $obj->last_main_doc; $this->last_main_doc = $obj->last_main_doc;

View File

@ -51,12 +51,12 @@ if ($id > 0 || !empty($ref)) {
} }
// Security check // Security check
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $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,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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) 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 Jean-François Ferry <jfefe@aternatik.fr>
@ -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="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>'; 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="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="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(); $alreadypaid = $facstatic->getSommePaiement();
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>'; print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
print '</tr>'; print '</tr>';
@ -437,7 +437,7 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
$total_ttc = $totalam = $total_ht = 0; $total_ttc = $totalam = $total_ht = 0;
while ($i < $num && $i < $max) { while ($i < $num && $i < $max) {
$objp = $db->fetch_object($result); $obj = $db->fetch_object($result);
if ($i >= $max) { if ($i >= $max) {
$othernb += 1; $othernb += 1;
@ -447,24 +447,24 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) {
continue; continue;
} }
$donationstatic->id = $objp->rowid; $donationstatic->id = $obj->rowid;
$donationstatic->ref = $objp->rowid; $donationstatic->ref = $obj->rowid;
$donationstatic->lastname = $objp->lastname; $donationstatic->lastname = $obj->lastname;
$donationstatic->firstname = $objp->firstname; $donationstatic->firstname = $obj->firstname;
$donationstatic->date = $objp->date; $donationstatic->date = $obj->date;
$donationstatic->statut = $objp->status; $donationstatic->statut = $obj->status;
$donationstatic->status = $objp->status; $donationstatic->status = $obj->status;
$label = $donationstatic->getFullName($langs); $label = $donationstatic->getFullName($langs);
if ($objp->societe) { if ($obj->societe) {
$label .= ($label ? ' - ' : '').$objp->societe; $label .= ($label ? ' - ' : '').$obj->societe;
} }
print '<tr class="oddeven tdoverflowmax100">'; print '<tr class="oddeven tdoverflowmax100">';
print '<td>'.$donationstatic->getNomUrl(1).'</td>'; print '<td>'.$donationstatic->getNomUrl(1).'</td>';
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
print '<td class="nowrap right"><span class="amount">'.price($objp->amount).'</span></td>'; print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</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 '<td>'.$donationstatic->getLibStatut(3).'</td>';
print '</tr>'; print '</tr>';

View File

@ -169,7 +169,7 @@ abstract class CommonObject
public $canvas; public $canvas;
/** /**
* @var Project The related project * @var Project The related project object
* @see fetch_projet() * @see fetch_projet()
*/ */
public $project; public $project;
@ -188,12 +188,12 @@ abstract class CommonObject
/** /**
* @deprecated * @deprecated
* @see fk_project * @see $fk_project
*/ */
public $fk_projet; public $fk_projet;
/** /**
* @var Contact a related contact * @var Contact A related contact object
* @see fetch_contact() * @see fetch_contact()
*/ */
public $contact; public $contact;
@ -205,7 +205,7 @@ abstract class CommonObject
public $contact_id; public $contact_id;
/** /**
* @var Societe A related thirdparty * @var Societe A related thirdparty object
* @see fetch_thirdparty() * @see fetch_thirdparty()
*/ */
public $thirdparty; public $thirdparty;
@ -254,7 +254,7 @@ abstract class CommonObject
public $newref; public $newref;
/** /**
* @var int The object's status * @var int The object's status. Prefer use of status.
* @see setStatut() * @see setStatut()
*/ */
public $statut; public $statut;
@ -265,6 +265,7 @@ abstract class CommonObject
*/ */
public $status; public $status;
/** /**
* @var string * @var string
* @see getFullAddress() * @see getFullAddress()
@ -319,6 +320,7 @@ abstract class CommonObject
*/ */
public $region; public $region;
/** /**
* @var int * @var int
* @see fetch_barcode() * @see fetch_barcode()
@ -518,6 +520,24 @@ abstract class CommonObject
*/ */
public $date_modification; // Date last change (tms field) 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; public $next_prev_filter;
/** /**
@ -535,6 +555,7 @@ abstract class CommonObject
*/ */
public $alreadypaid; public $alreadypaid;
/** /**
* @var array List of child tables. To test if we can delete object. * @var array List of child tables. To test if we can delete object.
*/ */
@ -8402,8 +8423,6 @@ abstract class CommonObject
$photo = ''; $photo = '';
$file = $val['name']; $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 (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
if (image_format_supported($file) >= 0) { if (image_format_supported($file) >= 0) {
$nbphoto++; $nbphoto++;

View File

@ -42,6 +42,34 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; 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 * Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set * @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 // Load translation files required by the page
$langs->loadLangs(array('payment', 'stripe')); $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>'; $out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>';
$url = getOnlinePaymentUrl(0, $type, $ref); $url = getOnlinePaymentUrl(0, $type, $ref);

View File

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

View File

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

View File

@ -4633,7 +4633,7 @@ class Product extends CommonObject
); );
// Recursive call if there is childs to child // 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"; //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); $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"; print '</tr>'."\n";
$totalsell = 0; $totalsell = 0;
$total = 0;
if (count($prods_arbo)) { if (count($prods_arbo)) {
foreach ($prods_arbo as $value) { foreach ($prods_arbo as $value) {
$productstatic->fetch($value['id']); $productstatic->fetch($value['id']);
@ -680,7 +681,7 @@ if ($id > 0 || !empty($ref)) {
print '<td>'.$productstatic->getNomUrl(1, '', 24).'</td>'; print '<td>'.$productstatic->getNomUrl(1, '', 24).'</td>';
$labeltoshow = $objp->label; $labeltoshow = $objp->label;
if ($conf->global->MAIN_MULTILANGS && $objp->labelm) { if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->labelm)) {
$labeltoshow = $objp->labelm; $labeltoshow = $objp->labelm;
} }

View File

@ -2319,9 +2319,8 @@ class Ticket extends CommonObject
if (is_resource($handle)) { if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) { while (($file = readdir($handle)) !== false) {
if (!utf8_check($file)) { 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)) { if (dol_is_file($dir.$file)) {
return true; return true;
} }

View File

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