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

This commit is contained in:
Laurent Destailleur 2022-03-07 15:27:07 +01:00
commit 84b951c2f9
28 changed files with 95 additions and 37 deletions

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedopjectblock.tpl.php -->\n";
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -8,7 +8,7 @@
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
@ -201,7 +201,7 @@ $tabsql = array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
@ -1093,6 +1093,45 @@ if ($action == 'disable_favorite') {
}
}
// Is in EEC - Activate
if ($action == 'activate_eec') {
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];
} else {
$rowidcol = "rowid";
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
if (!$result) {
dol_print_error($db);
}
}
// Is in EEC - Disable
if ($action == 'disable_eec') {
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];
} else {
$rowidcol = "rowid";
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
if (!$result) {
dol_print_error($db);
}
}
/*
* View
@ -1452,6 +1491,7 @@ if ($id) {
if ($id == 4) {
$tdsoffields .= '<td></td>';
$tdsoffields .= '<td></td>';
}
$tdsoffields .= '<td>';
$tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">';
@ -1496,6 +1536,7 @@ if ($id) {
if ($id == 4) {
print '<td></td>';
print '<td></td>';
}
print '<td colspan="3" class="center">';
if ($action != 'edit') {
@ -1569,6 +1610,7 @@ if ($id) {
}
if ($id == 4) {
print '<td></td>';
print '<td></td>';
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre right" colspan="2">';
@ -1592,10 +1634,10 @@ if ($id) {
// Determines the name of the field in relation to the possible names
// in data dictionaries
$showfield = 1; // By defaut
$showfield = 1; // By default
$cssprefix = '';
$sortable = 1;
$valuetoshow = ucfirst($value); // By defaut
$valuetoshow = ucfirst($value); // By default
$valuetoshow = $langs->trans($valuetoshow); // try to translate
// Special cases
@ -1794,8 +1836,9 @@ if ($id) {
print getTitleFieldOfList($newvaluetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $value : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
}
}
// Favorite - Only activated on country dictionary
// Favorite & EEC - Only activated on country dictionary
if ($id == 4) {
print getTitleFieldOfList($langs->trans("InEEC"), 0, $_SERVER["PHP_SELF"], "eec", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder, '', 0, $langs->trans("CountryIsInEEC"));
print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
}
@ -2089,10 +2132,19 @@ if ($id) {
}
$url .= '&';
// Favorite
// Favorite & EEC
// Only activated on country dictionary
if ($id == 4) {
print '<td class="nowrap center">';
// Is in EEC
if ($iserasable) {
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->eec].'_eec&token='.newToken().'">'.$actl[$obj->eec].'</a>';
} else {
print $langs->trans("AlwaysActive");
}
print '</td>';
print '<td class="nowrap center">';
// Favorite
if ($iserasable) {
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->favorite].'_favorite&token='.newToken().'">'.$actl[$obj->favorite].'</a>';
} else {

View File

@ -41,7 +41,7 @@ https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?DOLAPIKEY=**a
Develop an API
--------------
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples https://restler3.luracast.com/examples/index.html
Github contains also useful information : https://github.com/Luracast/Restler

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
global $user;
global $noMoreLinkedObjectBlockAfter;

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedobjectblock.tpl.php -->\n";
global $user, $db;
global $noMoreLinkedObjectBlockAfter;

View File

@ -30,7 +30,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
global $user;
global $noMoreLinkedObjectBlockAfter;

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblock.tpl.php -->\n";
global $user;
global $noMoreLinkedObjectBlockAfter;

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedopjectblockForRec.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblockForRec.tpl.php -->\n";
global $user;

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE contrat/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE contrat/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -642,14 +642,14 @@ class dolReceiptPrinter extends Printer
case 'DOL_PRINT_OBJECT_LINES':
foreach ($object->lines as $line) {
if ($line->fk_product) {
$spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - 10 - 1;
$spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - strlen($line->subprice) - 10 - 1;
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
$this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
$this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n");
$this->printer->text($line->ref . $spaces . $line->qty . str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT) . ' ' . str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT) . "\n");
$this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n \n");
} else {
$spacestoadd = $nbcharactbyline - strlen($line->description) - strlen($line->qty) - 10 - 1;
$spacestoadd = $nbcharactbyline - strlen($line->description) - strlen($line->qty) - strlen($line->subprice) - 10 - 1;
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
$this->printer->text($line->description.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
$this->printer->text($line->description.$spaces.$line->qty.' '.str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT).' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
}
}
break;

View File

@ -19,7 +19,7 @@
*
*/
print "<!-- BEGIN PHP TEMPLATE don/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE don/tpl/linkedobjectblock.tpl.php -->\n";
global $user;
global $noMoreLinkedObjectBlockAfter;

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
echo "<!-- BEGIN PHP TEMPLATE eventorganization/tpl/linkedopjectblock.tpl.php -->\n";
echo "<!-- BEGIN PHP TEMPLATE eventorganization/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE expedition/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE expedition/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE expensereport/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE expensereport/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -22,7 +22,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE fichinter/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE fichinter/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE fourn/commande/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE fourn/commande/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -25,7 +25,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE fourn/facture/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE fourn/facture/tpl/linkedobjectblock.tpl.php -->\n";
global $user;

View File

@ -272,4 +272,7 @@ ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128);
ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation;
-- Set default ticket type to OTHER if no default exists
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
UPDATE llx_c_country SET eec=0 WHERE eec IS NULL;
ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL;

View File

@ -24,8 +24,8 @@ create table llx_c_country
rowid integer PRIMARY KEY,
code varchar(2) NOT NULL,
code_iso varchar(3) ,
label varchar(128) NOT NULL,
eec integer ,
label varchar(128) NOT NULL,
eec tinyint DEFAULT 0 NOT NULL,
active tinyint DEFAULT 1 NOT NULL,
favorite tinyint DEFAULT 0 NOT NULL
)ENGINE=innodb;

View File

@ -22,7 +22,7 @@ if (empty($conf) || !is_object($conf)) {
}
print "<!-- BEGIN PHP TEMPLATE mymodule/core/tpl/linkedopjectblock_myobject.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE mymodule/core/tpl/linkedobjectblock_myobject.tpl.php -->\n";
global $user;

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
print "<!-- BEGIN PHP TEMPLATE mrp/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE mrp/tpl/linkedobjectblock.tpl.php -->\n";
global $user, $db;
global $noMoreLinkedObjectBlockAfter;

View File

@ -272,7 +272,7 @@ class Product extends CommonObject
public $fk_default_bom;
/**
* We must manage lot/batch number, sell-by date and so on : '1':yes '0':no
* We must manage lot/batch number, sell-by date and so on : '0':no, '1':yes, '2": yes with unique serial number
*
* @var int
*/

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array('projects', 'other'));
$hookmanager->initHooks(array('projectcarddocument'));
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');

View File

@ -62,6 +62,8 @@ if (GETPOST('actioncode', 'array')) {
}
$search_agenda_label = GETPOST('search_agenda_label');
$hookmanager->initHooks(array('projectcardinfo'));
// Security check
$id = GETPOST("id", 'int');
$socid = 0;

View File

@ -25,7 +25,7 @@ if (empty($conf) || !is_object($conf)) {
?>
<!-- BEGIN PHP TEMPLATE reception/tpl/linkedopjectblock.tpl.php -->
<!-- BEGIN PHP TEMPLATE reception/tpl/linkedobjectblock.tpl.php -->
<?php

View File

@ -59,8 +59,8 @@ $backtopage = GETPOST('$backtopage', 'alpha');
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$sortfield = GETPOST('sortfield', 'aZ09comma') ? GETPOST('sortfield', 'aZ09comma') : "a.datep";
$sortorder = GETPOST('sortorder', 'aZ09comma') ? GETPOST('sortorder', 'aZ09comma') : "desc";
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);

View File

@ -21,7 +21,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
print "<!-- BEGIN PHP TEMPLATE ticket/tpl/linkedopjectblock.tpl.php -->\n";
print "<!-- BEGIN PHP TEMPLATE ticket/tpl/linkedobjectblock.tpl.php -->\n";
global $user;