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

Conflicts:
	htdocs/comm/index.php
	htdocs/core/class/html.form.class.php
	htdocs/core/lib/accounting.lib.php
	htdocs/core/lib/website2.lib.php
	htdocs/fourn/class/fournisseur.commande.class.php
	htdocs/fourn/class/paiementfourn.class.php
	htdocs/public/ticket/view.php
This commit is contained in:
Laurent Destailleur
2021-04-09 14:17:41 +02:00
13 changed files with 89 additions and 43 deletions

View File

@@ -984,6 +984,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$orderstatic->id = $obj->commandeid;
$orderstatic->ref = $obj->ref;
$orderstatic->ref_client = $obj->ref_client;
$orderstatic->statut = $obj->fk_statut;
$orderstatic->total_ht = $obj->total_ht;
$orderstatic->total_tva = $obj->total_tva;
$orderstatic->total_ttc = $obj->total_ttc;

View File

@@ -461,7 +461,7 @@ abstract class CommonDocGenerator
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
$array_key.'_total_ttc'=>price2num($object->total_ttc),
$array_key.'_multicurrency_code' => price2num($object->multicurrency_code),
$array_key.'_multicurrency_code' => $object->multicurrency_code,
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),

View File

@@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* 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) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2021 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
@@ -277,8 +277,8 @@ function getDefaultDatesForTransfer()
// Period by default on transfer (0: previous month | 1: current month | 2: fiscal year)
$periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER);
if ($periodbydefaultontransfer == 2) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql = "SELECT date_start, date_end FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
@@ -288,6 +288,9 @@ function getDefaultDatesForTransfer()
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y');
if ($conf->global->SOCIETE_FISCAL_MONTH_START > dol_print_date(dol_now(), '%m')) {
$year_start = $year_start - 1;
}
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1) {

View File

@@ -104,10 +104,12 @@ function dolSavePageAlias($filealias, $object, $objectpage)
}
} elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
// Save also alias into all language subdirectories if it is a main language
if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR)) {
if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR) && !empty($object->otherlang)) {
$dirname = dirname($filealias);
$filename = basename($filealias);
foreach (explode(',', $object->otherlang) as $sublang) {
// Avoid to erase main alias file if $sublang is empty string
if (empty(trim($sublang))) continue;
$filealiassub = $dirname.'/'.$sublang.'/'.$filename;
$aliascontent = '<?php'."\n";

View File

@@ -72,7 +72,7 @@ class SupplierOrders extends DolibarrApi
throw new RestException(404, 'Supplier order not found');
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -269,7 +269,7 @@ class SupplierOrders extends DolibarrApi
throw new RestException(404, 'Supplier order not found');
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -303,7 +303,7 @@ class SupplierOrders extends DolibarrApi
throw new RestException(404, 'Supplier order not found');
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -348,7 +348,7 @@ class SupplierOrders extends DolibarrApi
throw new RestException(404, 'Order not found');
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

View File

@@ -2708,7 +2708,7 @@ class CommandeFournisseur extends CommonOrder
if ($qty < $this->line->packaging) {
$qty = $this->line->packaging;
} else {
if (($qty % $this->line->packaging) > 0) {
if (! empty($this->line->packaging) && ($qty % $this->line->packaging) > 0) {
$coeff = intval($qty / $this->line->packaging) + 1;
$qty = $this->line->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');

View File

@@ -83,7 +83,7 @@ class PaiementFourn extends Paiement
* Load payment object
*
* @param int $id Id if payment to get
* @param string $ref Ref of payment to get (currently ref = id but this may change in future)
* @param string $ref Ref of payment to get
* @param int $fk_bank Id of bank line associated to payment
* @return int <0 if KO, -2 if not found, >0 if OK
*/
@@ -101,9 +101,9 @@ class PaiementFourn extends Paiement
if ($id > 0) {
$sql .= ' AND p.rowid = '.((int) $id);
} elseif ($ref) {
$sql .= ' AND p.rowid = '.$ref;
} elseif ($fk_bank) {
$sql .= ' AND p.fk_bank = '.$fk_bank;
$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
} elseif ($fk_bank > 0) {
$sql .= ' AND p.fk_bank = '.((int) $fk_bank);
}
//print $sql;

View File

@@ -524,6 +524,10 @@ if ($search_user > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' WHERE f.fk_soc = s.rowid';
$sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')';
if (!$user->rights->societe->client->voir && !$socid) {
@@ -686,10 +690,19 @@ if (!$search_all) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ",ef.".$key : '');
}
}
// Add GroupBy from hooks
$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall);
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
} else {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
// Add HAVING from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= !empty($hookmanager->resPrint) ? (' HAVING 1=1 ' . $hookmanager->resPrint) : '';
$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
@@ -832,6 +845,10 @@ if ($resql) {
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(

View File

@@ -655,11 +655,11 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1062, 'PCMN-BASE', 'FINAN', '578', '1060', 'Caisses - timbres ( 0 - fiscaux ; 1 - postaux)', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1063, 'PCMN-BASE', 'FINAN', '58', '1355', 'Virements internes', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1064, 'PCMN-BASE', 'EXPENSE', '60', '1356', 'Approvisionnements et marchandises', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'PCMN-BASE', 'EXPENSE', 'PRODUCT', '600', '1064', 'Achats de matières premières', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'PCMN-BASE', 'EXPENSE', 'PRODUCT', '601', '1064', 'Achats de fournitures', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'PCMN-BASE', 'EXPENSE', 'SERVICE', '602', '1064', 'Achats de services, travaux et études', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'PCMN-BASE', 'EXPENSE', '600', '1064', 'Achats de matières premières', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'PCMN-BASE', 'EXPENSE', '601', '1064', 'Achats de fournitures', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'PCMN-BASE', 'EXPENSE', '602', '1064', 'Achats de services, travaux et études', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1068, 'PCMN-BASE', 'EXPENSE', '603', '1064', 'Sous-traitances générales', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'PCMN-BASE', 'EXPENSE', 'PRODUCT', '604', '1064', 'Achats de marchandises', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'PCMN-BASE', 'EXPENSE', '604', '1064', 'Achats de marchandises', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1070, 'PCMN-BASE', 'EXPENSE', '605', '1064', 'Achats d''immeubles destinés à la revente', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1071, 'PCMN-BASE', 'EXPENSE', '608', '1064', 'Remises , ristournes et rabais obtenus sur achats', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1072, 'PCMN-BASE', 'EXPENSE', '609', '1064', 'Variations de stocks', 1);
@@ -849,24 +849,24 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1256, 'PCMN-BASE', 'EXPENSE', '695', '1250', 'Administrateurs ou gérants', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1257, 'PCMN-BASE', 'EXPENSE', '696', '1250', 'Autres allocataires', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1258, 'PCMN-BASE', 'INCOME', '70', '1357', 'Chiffre d''affaires', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1260, 'PCMN-BASE', 'INCOME', 'PRODUCT', '700', '1258', 'Ventes de marchandises', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1261, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7000', '1260', 'Ventes en Belgique', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1262, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7001', '1260', 'Ventes dans les pays membres de la C.E.E.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1263, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7002', '1260', 'Ventes à l''exportation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1264, 'PCMN-BASE', 'INCOME', 'PRODUCT', '701', '1258', 'Ventes de produits finis', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1265, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7010', '1264', 'Ventes en Belgique', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1266, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7011', '1264', 'Ventes dans les pays membres de la C.E.E.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1267, 'PCMN-BASE', 'INCOME', 'PRODUCT', '7012', '1264', 'Ventes à l''exportation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1260, 'PCMN-BASE', 'INCOME', '700', '1258', 'Ventes de marchandises', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1261, 'PCMN-BASE', 'INCOME', '7000', '1260', 'Ventes en Belgique', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1262, 'PCMN-BASE', 'INCOME', '7001', '1260', 'Ventes dans les pays membres de la C.E.E.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1263, 'PCMN-BASE', 'INCOME', '7002', '1260', 'Ventes à l''exportation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1264, 'PCMN-BASE', 'INCOME', '701', '1258', 'Ventes de produits finis', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1265, 'PCMN-BASE', 'INCOME', '7010', '1264', 'Ventes en Belgique', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1266, 'PCMN-BASE', 'INCOME', '7011', '1264', 'Ventes dans les pays membres de la C.E.E.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1267, 'PCMN-BASE', 'INCOME', '7012', '1264', 'Ventes à l''exportation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1268, 'PCMN-BASE', 'INCOME', '702', '1258', 'Ventes de déchets et rebuts', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1269, 'PCMN-BASE', 'INCOME', '7020', '1268', 'Ventes en Belgique', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1270, 'PCMN-BASE', 'INCOME', '7021', '1268', 'Ventes dans les pays membres de la C.E.E.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1271, 'PCMN-BASE', 'INCOME', '7022', '1268', 'Ventes à l''exportation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1272, 'PCMN-BASE', 'INCOME', '703', '1258', 'Ventes d''emballages récupérables', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1273, 'PCMN-BASE', 'INCOME', '704', '1258', 'Facturations des travaux en cours (associations momentanées)', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1274, 'PCMN-BASE', 'INCOME', 'SERVICE', '705', '1258', 'Prestations de services', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1275, 'PCMN-BASE', 'INCOME', 'SERVICE', '7050', '1274', 'Prestations de services en Belgique', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1276, 'PCMN-BASE', 'INCOME', 'SERVICE', '7051', '1274', 'Prestations de services dans les pays membres de la C.E.E.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1277, 'PCMN-BASE', 'INCOME', 'SERVICE', '7052', '1274', 'Prestations de services en vue de l''exportation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1274, 'PCMN-BASE', 'INCOME', '705', '1258', 'Prestations de services', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1275, 'PCMN-BASE', 'INCOME', '7050', '1274', 'Prestations de services en Belgique', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1276, 'PCMN-BASE', 'INCOME', '7051', '1274', 'Prestations de services dans les pays membres de la C.E.E.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1277, 'PCMN-BASE', 'INCOME', '7052', '1274', 'Prestations de services en vue de l''exportation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1278, 'PCMN-BASE', 'INCOME', '706', '1258', 'Pénalités et dédits obtenus par l''entreprise', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1279, 'PCMN-BASE', 'INCOME', '708', '1258', 'Remises, ristournes et rabais accordés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1280, 'PCMN-BASE', 'INCOME', '7080', '1279', 'Sur ventes de marchandises', 1);

View File

@@ -55,7 +55,7 @@ $langs->loadLangs(array("companies", "other", "ticket"));
// Get parameters
$track_id = GETPOST('track_id', 'alpha');
$action = GETPOST('action', 'aZ09');
$email = GETPOST('email', 'alpha');
$email = strtolower(GETPOST('email', 'alpha'));
if (GETPOST('btn_view_ticket_list')) {
unset($_SESSION['track_id_customer']);
@@ -65,7 +65,7 @@ if (isset($_SESSION['track_id_customer'])) {
$track_id = $_SESSION['track_id_customer'];
}
if (isset($_SESSION['email_customer'])) {
$email = $_SESSION['email_customer'];
$email = strtolower($_SESSION['email_customer']);
}
$object = new Ticket($db);
@@ -105,7 +105,7 @@ if ($action == "view_ticketlist") {
// vérifie si l'adresse email est bien dans les contacts du ticket
$contacts = $object->liste_contact(-1, 'external');
foreach ($contacts as $contact) {
if ($contact['email'] == $email) {
if (strtolower($contact['email']) == $email) {
$display_ticket_list = true;
$_SESSION['email_customer'] = $email;
$_SESSION['track_id_customer'] = $track_id;
@@ -116,7 +116,7 @@ if ($action == "view_ticketlist") {
}
if ($object->fk_soc > 0) {
$object->fetch_thirdparty();
if ($email == $object->thirdparty->email) {
if ($email == strtolower($object->thirdparty->email)) {
$display_ticket_list = true;
$_SESSION['email_customer'] = $email;
$_SESSION['track_id_customer'] = $track_id;
@@ -125,14 +125,14 @@ if ($action == "view_ticketlist") {
if ($object->fk_user_create > 0) {
$tmpuser = new User($db);
$tmpuser->fetch($object->fk_user_create);
if ($email == $tmpuser->email) {
if ($email == strtolower($tmpuser->email)) {
$display_ticket_list = true;
$_SESSION['email_customer'] = $email;
$_SESSION['track_id_customer'] = $track_id;
}
}
$emailorigin = CMailFile::getValidAddress($object->origin_email, 2);
$emailorigin = strtolower(CMailFile::getValidAddress($object->origin_email, 2));
if ($email == $emailorigin) {
$display_ticket_list = true;
$_SESSION['email_customer'] = $email;

View File

@@ -57,7 +57,7 @@ $langs->loadLangs(array("companies", "other", "ticket"));
$track_id = GETPOST('track_id', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$action = GETPOST('action', 'aZ09');
$email = GETPOST('email', 'alpha');
$email = GETPOST('email', 'email');
if (GETPOST('btn_view_ticket')) {
unset($_SESSION['email_customer']);
@@ -106,14 +106,14 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
if ($ret && $object->dao->id > 0) {
// Check if emails provided is the one of author
$emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2);
if ($emailofticket == $email) {
if (strtolower($emailofticket) == strtolower($email)) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
} else {
// Check if emails provided is inside list of contacts
$contacts = $object->dao->liste_contact(-1, 'external');
foreach ($contacts as $contact) {
if ($contact['email'] == $email) {
if (strtolower($contact['email']) == strtolower($email)) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
break;
@@ -134,7 +134,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
if ($object->dao->fk_user_create > 0) {
$tmpuser = new User($db);
$tmpuser->fetch($object->dao->fk_user_create);
if ($email == $tmpuser->email) {
if (strtolower($email) == strtolower($tmpuser->email)) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
}
@@ -143,7 +143,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create) {
$tmpuser = new User($db);
$tmpuser->fetch($object->dao->fk_user_assign);
if ($email == $tmpuser->email) {
if (strtolower($email) == strtolower($tmpuser->email)) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
}

View File

@@ -184,6 +184,11 @@ class Website extends CommonObject
$tmparray = explode(',', $this->otherlang);
if (is_array($tmparray)) {
foreach ($tmparray as $key => $val) {
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
if (empty(trim($val))) {
unset($tmparray[$key]);
continue;
}
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
}
$this->otherlang = join(',', $tmparray);
@@ -496,6 +501,11 @@ class Website extends CommonObject
$tmparray = explode(',', $this->otherlang);
if (is_array($tmparray)) {
foreach ($tmparray as $key => $val) {
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
if (empty(trim($val))) {
unset($tmparray[$key]);
continue;
}
$tmparray[$key] = preg_replace('/[_-].*$/', '', trim($val)); // en_US or en-US -> en
}
$this->otherlang = join(',', $tmparray);

View File

@@ -590,6 +590,8 @@ if ($action == 'addsite' && $usercanedit) {
if (!$error) {
$arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml'));
foreach ($arrayotherlang as $key => $val) {
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
if (empty(trim($val))) continue;
$arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only
}
@@ -1297,6 +1299,8 @@ if ($action == 'updatecss' && $usercanedit) {
if (!$error) {
$arrayotherlang = explode(',', GETPOST('WEBSITE_OTHERLANG', 'alphanohtml'));
foreach ($arrayotherlang as $key => $val) {
// It possible we have empty val here if postparam WEBSITE_OTHERLANG is empty or set like this : 'en,,sv' or 'en,sv,'
if (empty(trim($val))) continue;
$arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only
}
@@ -1740,6 +1744,10 @@ if ($action == 'updatemeta' && $usercanedit) {
$filename = basename($fileoldalias);
$sublangs = explode(',', $object->otherlang);
foreach ($sublangs as $sublang) {
// Under certain conditions $sublang can be an empty string
// ($object->otherlang with empty string or with string like this 'en,,sv')
// if is the case we try to re-delete the main alias file. Avoid it.
if (empty(trim($sublang))) continue;
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
dol_delete_file($fileoldaliassub);
}
@@ -1759,6 +1767,10 @@ if ($action == 'updatemeta' && $usercanedit) {
$filename = basename($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
$sublangs = explode(',', $object->otherlang);
foreach ($sublangs as $sublang) {
// Under certain conditions $ sublang can be an empty string
// ($object->otherlang with empty string or with string like this 'en,,sv')
// if is the case we try to re-delete the main alias file. Avoid it.
if (empty(trim($sublang))) continue;
$fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename;
dol_delete_file($fileoldaliassub);
}
@@ -2772,6 +2784,7 @@ if (!GETPOST('hide_websitemenu')) {
$onlylang[$website->lang] = $website->lang.' ('.$langs->trans("Default").')';
}
foreach (explode(',', $website->otherlang) as $langkey) {
if (empty(trim($langkey))) continue;
$onlylang[$langkey] = $langkey;
}
$textifempty = $langs->trans("Default");