Merge branch 'develop' into ModuleBuilderFixes

This commit is contained in:
Laurent Destailleur 2023-03-18 02:39:02 +01:00 committed by GitHub
commit cf2d1a24d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
152 changed files with 3059 additions and 2923 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="7.0">
<component name="PhpProjectSharedConfiguration" php_language_level="7.0" />
<project version="7.1">
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
</project>

View File

@ -5,12 +5,13 @@ English Dolibarr ChangeLog
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
NEW: PHP 8.2 compatibility:
NEW: PHP 8.2 compatibility.
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Minimal PHP version is now PHP 7.1 instead of PHP 7.0
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
@ -18,6 +19,12 @@ Following changes may create regressions for some external modules, but were nec
* The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that.
***** ChangeLog for 17.0.1 compared to 17.0.0 *****
TODO
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
For users:
@ -223,6 +230,10 @@ Following changes may create regressions for some external modules, but were nec
* Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all)
* The property $url_last_version must be public if defined into module descriptor files;
***** ChangeLog for 16.0.5 compared to 16.0.4 *****
TODO
***** ChangeLog for 16.0.4 compared to 16.0.3 *****

View File

@ -1,28 +0,0 @@
README
------
Scripts in this directory can be used to reload or save a demo database.
Install of package "dialog" is required.
*** Init demo
The script initdemo.sh will erase current database with data into mysqldump_dolibarr_x.y.z.sql and copy files into documents_demo into officiel document directory.
Do a chmod 700 initdemo.sh
then run ./initdemo.sh to launch Graphic User Interface.
After loading the demo files, admin login may be:
- admin / admin
or
- admin / adminadmin
*** Save demo
The script savedemo.sh will save current database into a database dump file.
*** Update demo
The goal of script updatedemo.php is to update dates into the demo data so samples are up to date.

32
dev/initdemo/README.md Normal file
View File

@ -0,0 +1,32 @@
README
======
Scripts in this directory can be used to reload or save a demo database.
Install of package "dialog" is required.
Init demo
-------------
The script initdemo.sh will erase current database with data intodev/initdemo/mysqldump_dolibarr_x.y.z.sql and copy files into documents_demo into officiel document directory.
Do a chmod 700 initdemo.sh
then run ./initdemo.sh to launch Graphic User Interface.
After loading the demo files, admin login may be:
- admin / admin
or
- admin / adminadmin
Update demo
-------------
The goal of script dev/initdemo/updatedemo.php is to update dates into the demo data so samples are up to date.
Save demo
-------------
The script dev/initdemo.savedemo.sh will save current database into a database dump file.

File diff suppressed because one or more lines are too long

View File

@ -290,6 +290,7 @@ export list="
--ignore-table=$base.llx_monmodule_abcdef
--ignore-table=$base.llx_notes
--ignore-table=$base.llx_packages
--ignore-table=$base.llx_packages_extrafields
--ignore-table=$base.llx_pos_cash
--ignore-table=$base.llx_pos_control_cash
--ignore-table=$base.llx_pos_facture
@ -305,6 +306,19 @@ export list="
--ignore-table=$base.llx_residence
--ignore-table=$base.llx_residence_building
--ignore-table=$base.llx_residence_building_links
--ignore-table=$base.llx_scaninvoices_filestoimport
--ignore-table=$base.llx_scaninvoices_filestoimport_extrafields
--ignore-table=$base.llx_scaninvoices_settings
--ignore-table=$base.llx_scaninvoices_settings_extrafields
--ignore-table=$base.llx_sellyoursaas_blacklistcontent
--ignore-table=$base.llx_sellyoursaas_blacklistdir
--ignore-table=$base.llx_sellyoursaas_blacklistfrom
--ignore-table=$base.llx_sellyoursaas_blacklistip
--ignore-table=$base.llx_sellyoursaas_blacklistmail
--ignore-table=$base.llx_sellyoursaas_blacklistto
--ignore-table=$base.llx_sellyoursaas_deploymentserver
--ignore-table=$base.llx_sellyoursaas_stats
--ignore-table=$base.llx_sellyoursaas_whitelistip
--ignore-table=$base.llx_societe_rib2
--ignore-table=$base.llx_sellyoursaas_cancellation
--ignore-table=$base.llx_ticketsup

View File

@ -60,6 +60,8 @@ if ($action == 'update') {
$amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2);
$minamount = GETPOST('MEMBER_MIN_AMOUNT');
$publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC');
$showtable = GETPOST('MEMBER_SHOW_TABLE');;
$showvoteallowed = GETPOST('MEMBER_SHOW_VOTE_ALLOWED');
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int');
$forcemorphy = GETPOST('MEMBER_NEWFORM_FORCEMORPHY', 'aZ09');
@ -68,6 +70,8 @@ if ($action == 'update') {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", !$showtable, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show"
$res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", !$showvoteallowed, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show"
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
if ($forcetype < 0) {
$res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
@ -246,6 +250,22 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", (!empty($conf->global->MEMBER_COUNTERS_ARE_PUBLIC) ? $conf->global->MEMBER_COUNTERS_ARE_PUBLIC : 0), 1);
print "</td></tr>\n";
// Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0)
$skiptable = (!empty($conf->global->MEMBER_SKIP_TABLE) ? $conf->global->MEMBER_SKIP_TABLE : 0);
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("MembersShowMembershipTypesTable");
print '</td><td>';
print $form->selectyesno("MEMBER_SHOW_TABLE", !$skiptable, 1); // Reverse the logic "hide -> show" for retrocompatibility
print "</td></tr>\n";
// Show "vote allowed" setting for membership types
$hidevoteallowed = (!empty($conf->global->MEMBER_HIDE_VOTE_ALLOWED) ? $conf->global->MEMBER_HIDE_VOTE_ALLOWED : 0);
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("MembersShowVotesAllowed");
print '</td><td>';
print $form->selectyesno("MEMBER_SHOW_VOTE_ALLOWED", !$hidevoteallowed, 1); // Reverse the logic "hide -> show" for retrocompatibility
print "</td></tr>\n";
// Jump to an online payment page
print '<tr class="oddeven" id="trpayment"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");

View File

@ -345,19 +345,19 @@ $sql .= " d.note_private, d.note_public, d.import_key,";
$sql .= " s.nom,";
$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
$sql .= " t.libelle as type, t.subscription,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " state.code_departement as state_code, state.nom as state_name";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -224,7 +224,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -226,19 +226,17 @@ print "<br>\n";
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
foreach ($object->fields as $key => $val) {
$sql .= "t.".$key.", ";
}
$sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -1181,7 +1181,11 @@ if ($mode == 'deploy') {
} else {
if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
// Show clean message
$message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
if (!is_numeric('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
$message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
} else {
$message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
}
} else {
// Show technical message
$message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));

View File

@ -109,12 +109,18 @@ if (!$base) {
$arrayoffilesrich = dol_dir_list(DOL_DOCUMENT_ROOT.'/install/mysql/tables/', 'files', 0, '\.sql$');
$arrayoffiles = array();
$arrayoftablesautocreated = array();
foreach ($arrayoffilesrich as $value) {
//print $shortsqlfilename.' ';
$shortsqlfilename = preg_replace('/\-[a-z]+\./', '.', $value['name']);
$arrayoffiles[] = $shortsqlfilename;
$arrayoffiles[$value['name']] = $shortsqlfilename;
if ($value['name'] == $shortsqlfilename && ! preg_match('/\.key\.sql$/', $value['name'])) {
// This is a sql file automatically created
$arrayoftablesautocreated[$value['name']] = $shortsqlfilename;
}
}
// Now loop on tables really found into database
$sql = "SHOW TABLE STATUS";
$resql = $db->query($sql);
@ -123,6 +129,7 @@ if (!$base) {
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.($i+1).'</td>';
@ -130,11 +137,14 @@ if (!$base) {
$tablename = preg_replace('/^'.MAIN_DB_PREFIX.'/', 'llx_', $obj->Name);
if (in_array($tablename.'.sql', $arrayoffiles)) {
$img = "info";
//print img_picto($langs->trans("ExternalModule"), $img);
if (in_array($tablename.'.sql', $arrayoftablesautocreated)) {
$img = "info";
} else {
$img = "info_black";
print img_picto($langs->trans("NotAvailableByDefaultEnabledOnModuleActivation"), $img, 'class="small opacitymedium"');
}
} else {
$img = "info_black";
//print DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$tablename.'.sql';
print img_picto($langs->trans("ExternalModule"), $img, 'class="small"');
}
print '</td>';

View File

@ -330,7 +330,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '</tr>';
// Auto fill the contact found from email
// This option is a serious security hole. it allowe to any non looged perso, to get the database of contacts
// This option is a serious security hole. it allows to any non logged perso, to get the database of contacts or to check if an email is a customer or not. We must keep it as hidden option only.
/*
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
print '<td class="left">';

View File

@ -106,6 +106,9 @@ class DolibarrApiAccess implements iAuthenticate
if (isset($_SERVER['HTTP_DOLAPIKEY'])) { // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
}
if (preg_match('/^dolcrypt:/i', $api_key)) {
throw new RestException(503, 'Bad value for the API key. An API key should not start with dolcrypt:');
}
if ($api_key) {
$userentity = 0;
@ -113,15 +116,15 @@ class DolibarrApiAccess implements iAuthenticate
$sql = "SELECT u.login, u.datec, u.api_key, ";
$sql .= " u.tms as date_modification, u.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."'";
// TODO Check if 2 users has same API key.
$sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."' OR u.api_key = '".$this->db->escape(dolEncrypt($api_key, '', '', 'dolibarr'))."'";
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$nbrows = $this->db->num_rows($result);
if ($nbrows == 1) {
$obj = $this->db->fetch_object($result);
$login = $obj->login;
$stored_key = $obj->api_key;
$stored_key = dolDecrypt($obj->api_key);
$userentity = $obj->entity;
if (!defined("DOLENTITY") && $conf->entity != ($obj->entity ? $obj->entity : 1)) { // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user
@ -130,6 +133,8 @@ class DolibarrApiAccess implements iAuthenticate
dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity.") and we have to reload configuration.", LOG_WARNING);
$conf->setValues($this->db);
}
} elseif ($nbrows > 1) {
throw new RestException(503, 'Error when fetching user api_key : More than 1 user with this apikey');
}
} else {
throw new RestException(503, 'Error when fetching user api_key :'.$this->db->error_msg);

View File

@ -607,6 +607,7 @@ class Documents extends DolibarrApi
if ($ref) {
$tmpreldir = '';
$fetchbyid = false;
if ($modulepart == 'facture' || $modulepart == 'invoice') {
$modulepart = 'facture';
@ -666,13 +667,22 @@ class Documents extends DolibarrApi
$modulepart = 'propale';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$object = new Propal($this->db);
} elseif ($modulepart == 'contact' || $modulepart == 'socpeople') {
$modulepart = 'contact';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$object = new Contact($this->db);
$fetchbyid = true;
} else {
// TODO Implement additional moduleparts
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
}
if (is_object($object)) {
$result = $object->fetch('', $ref);
if ($fetchbyid) {
$result = $object->fetch($ref);
} else {
$result = $object->fetch('', $ref);
}
if ($result == 0) {
throw new RestException(404, "Object with ref '".$ref."' was not found.");

View File

@ -18,6 +18,7 @@
use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
/**
@ -152,7 +153,7 @@ class Login
// We store API token into database
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET api_key = '".$this->db->escape($token)."'";
$sql .= " SET api_key = '".$this->db->escape(dolEncrypt($token, '', '', 'dolibarr'))."'";
$sql .= " WHERE login = '".$this->db->escape($login)."'";
dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log

View File

@ -214,7 +214,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -219,7 +219,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -306,7 +306,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -227,7 +227,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
//$sql .= ", COUNT(rc.rowid) as anotherfield";
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";

View File

@ -227,7 +227,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
//$sql .= ", COUNT(rc.rowid) as anotherfield";
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";

View File

@ -158,7 +158,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -71,7 +70,7 @@ if (!$sortorder) {
$object = new Propal($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('myobjectagenda', 'globalcard')); // Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('propalagenda', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);

255
htdocs/commande/agenda.php Normal file
View File

@ -0,0 +1,255 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/commande/agenda.php
* \ingroup commande
* \brief Tab of events on Sale Orders
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("order", "other"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical objects
$object = new Commande($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('orderagenda', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->commande->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
$permissiontoread = $user->hasRight("commande", "lire");
$permissiontoadd = $user->hasRight("commande", "creer");
// Security check
if (!empty($user->socid)) {
$socid = $user->socid;
}
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'commande', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
/*
* Actions
*/
$parameters = array('id'=>$id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
}
/*
* View
*/
$form = new Form($db);
if ($object->id > 0) {
$title = $langs->trans("Agenda");
//if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
llxHeader('', $title, $help_url);
if (isModEnabled('notification')) {
$langs->load("mails");
}
$head = commande_prepare_head($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("Order"), -1, $object->picto);
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>';
if (0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
}
}
}
}
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$object->info($object->id);
dol_print_object_info($object, 1);
print '</div>';
print dol_get_fiche_end();
// Actions buttons
$objthirdparty = $object;
$objcon = new stdClass();
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {
$out .= '&socid='.urlencode($objthirdparty->id);
}
$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '');
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
}
$morehtmlright = '';
//$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
//$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
if (isModEnabled('agenda')) {
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
} else {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0);
}
}
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
print '<br>';
$param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_commande_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnOrder").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
//print_barre_liste($langs->trans("ActionsOnOrder"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
$filters['search_rowid'] = $search_rowid;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
}
}
// End of page
llxFooter();
$db->close();

View File

@ -2976,10 +2976,14 @@ if ($action == 'create' && $usercancreate) {
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/commande/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'order', $socid, 1);
$somethingshown = $formactions->showactions($object, 'order', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty
print '</div></div>';
}

View File

@ -243,13 +243,14 @@ class CommandeStats extends Stats
global $user;
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
$sql .= " FROM ".$this->from;
$sql .= " INNER JOIN ".$this->from_line." ON c.rowid = tl.fk_commande";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
$sql .= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
$sql .= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
$sql .= " GROUP BY product.ref";
$sql .= $this->db->order('nb', 'DESC');

View File

@ -1,129 +0,0 @@
<?php
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/commande/info.php
* \ingroup commande
* \brief Sale Order info page
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
if (!$user->rights->commande->lire) {
accessforbidden();
}
// Load translation files required by the page
$langs->loadLangs(array('orders', 'sendings', 'bills'));
$socid = 0;
$comid = GETPOST("id", 'int');
$id = GETPOST("id", 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'commande', $comid, '');
$usercancreate = $user->hasRight("commande", "creer");
$object = new Commande($db);
if (!$object->fetch($id, $ref) > 0) {
dol_print_error($db);
exit;
}
/*
* View
*/
$form = new Form($db);
$title = $langs->trans('Order')." - ".$langs->trans('Info');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url);
$object->fetch_thirdparty();
$object->info($object->id);
$head = commande_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("CustomerOrder"), -1, 'order');
// Order card
$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>';
if (0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
}
}
}
}
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
print dol_get_fiche_end();
// End of page
llxFooter();
$db->close();

View File

@ -223,6 +223,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$error = 0;
/*
@ -1284,24 +1285,24 @@ if ($resql) {
if ($permissiontovalidate) {
$arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate");
}
if ($permissiontosendbymail) {
$arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail");
}
if ($permissiontoclose) {
$arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped");
}
if ($permissiontocancel) {
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
}
if (isModEnabled('facture') && $user->hasRight("facture", "creer")) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer");
}
if ($permissiontoclose) {
$arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled");
}
if ($permissiontocancel) {
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
}
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (isModEnabled('facture') && $user->hasRight("facture", "creer")) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer");
}
if ($permissiontosendbymail) {
$arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail");
}
if (in_array($massaction, array('presend', 'predelete', 'createbills'))) {
$arrayofmassactions = array();
}

View File

@ -1119,6 +1119,8 @@ class Account extends CommonObject
$this->db->begin();
// @TODO Check there is no child into llx_payment_various, ... to allow deletion ?
// Delete link between tag and bank account
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account";
@ -2018,7 +2020,6 @@ class AccountLine extends CommonObjectLine
$sql .= " b.fk_user_author, b.fk_user_rappro,";
$sql .= " b.fk_type, b.num_releve, b.num_chq, b.rappro, b.note,";
$sql .= " b.fk_bordereau, b.banque, b.emetteur,";
//$sql.= " b.author"; // Is this used ?
$sql .= " ba.ref as bank_account_ref, ba.label as bank_account_label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b,";
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba";

View File

@ -126,6 +126,22 @@ class PaymentVarious extends CommonObject
public $fk_user_modif;
/**
* @var int Type of bank account if the payment is on a bank account
*/
public $fk_type;
/**
* @var int 1 if the payment is on a bank account line that is conciliated
*/
public $rappro;
/**
* @var string ID of bank receipt
*/
public $bank_num_releve;
/**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
@ -251,7 +267,6 @@ class PaymentVarious extends CommonObject
*/
public function fetch($id, $user = null)
{
global $langs;
$sql = "SELECT";
$sql .= " v.rowid,";
$sql .= " v.tms,";
@ -262,7 +277,7 @@ class PaymentVarious extends CommonObject
$sql .= " v.fk_typepayment,";
$sql .= " v.num_payment,";
$sql .= " v.label,";
$sql .= " v.note,";
$sql .= " v.note as note_private,";
$sql .= " v.accountancy_code,";
$sql .= " v.subledger_account,";
$sql .= " v.fk_projet as fk_project,";
@ -271,7 +286,8 @@ class PaymentVarious extends CommonObject
$sql .= " v.fk_user_modif,";
$sql .= " b.fk_account,";
$sql .= " b.fk_type,";
$sql .= " b.rappro";
$sql .= " b.rappro,";
$sql .= " b.num_releve as bank_num_releve";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
$sql .= " WHERE v.rowid = ".((int) $id);
@ -292,7 +308,8 @@ class PaymentVarious extends CommonObject
$this->type_payment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->label = $obj->label;
$this->note = $obj->note;
$this->note = $obj->note_private; // For backward compatibility
$this->note_private = $obj->note_private;
$this->subledger_account = $obj->subledger_account;
$this->accountancy_code = $obj->accountancy_code;
$this->fk_project = $obj->fk_project;
@ -302,6 +319,7 @@ class PaymentVarious extends CommonObject
$this->fk_account = $obj->fk_account;
$this->fk_type = $obj->fk_type;
$this->rappro = $obj->rappro;
$this->bank_num_releve = $obj->bank_num_releve;
}
$this->db->free($resql);

View File

@ -6,6 +6,8 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2023 Maxime Nicolas <maxime@oarces.com>
* Copyright (C) 2023 Benjamin GREMBI <benjamin@oarces.com>
*
* 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
@ -35,7 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'multicurrency'));
$socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
@ -45,10 +46,11 @@ if (!$user->rights->banque->transfer) {
}
$action = GETPOST('action', 'aZ09');
$error = 0;
$hookmanager->initHooks(array('banktransfer'));
$MAXLINES = 10;
/*
* Actions
@ -60,123 +62,152 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($action == 'add') {
$langs->load("errors");
$langs->load('errors');
$i = 1;
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$label = GETPOST('label', 'alpha');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT', 2);
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT', 2);
while ($i < $MAXLINES) {
$dateo[$i] = dol_mktime(12, 0, 0, GETPOST($i.'_month', 'int'), GETPOST($i.'_day', 'int'), GETPOST($i.'_year', 'int'));
$label[$i] = GETPOST($i.'_label', 'alpha');
$amount[$i] = intval(price2num(GETPOST($i.'_amount', 'alpha'), 'MT', 2));
$amountto[$i] = price2num(GETPOST($i.'_amountto', 'alpha'), 'MT', 2);
$accountfrom[$i] = intval(GETPOST($i.'_account_from', 'int'));
$accountto[$i] = intval(GETPOST($i.'_account_to', 'int'));
$type[$i] = GETPOST($i.'_type', 'int');
$errori[$i] = 0;
if (!$label) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Description")), null, 'errors');
$tabnum[$i] = 0;
if (!empty($label[$i]) || !empty($type[$i]) || !($amount[$i] <= 0) || !($accountfrom[$i] < 0) || !($accountto[$i] < 0)) {
$tabnum[$i] = 1;
}
$i++;
}
if (!$amount) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
}
if (!GETPOST('account_from', 'int')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TransferFrom")), null, 'errors');
}
if (!GETPOST('account_to', 'int')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TransferTo")), null, 'errors');
}
if (!$error) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountfrom = new Account($db);
$accountfrom->fetch(GETPOST('account_from', 'int'));
$n = 1;
while ($n < $MAXLINES) {
if ($tabnum[$n] === 1) {
if ($accountfrom[$n] < 0) {
$errori[$n]++;
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("TransferFrom")), null, 'errors');
}
if ($accountto[$n] < 0) {
$errori[$n]++;
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("TransferTo")), null, 'errors');
}
if (!$type[$n]) {
$errori[$n]++;
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("Type")), null, 'errors');
}
if (!$dateo[$n]) {
$errori[$n]++;
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("Date")), null, 'errors');
}
$accountto = new Account($db);
$accountto->fetch(GETPOST('account_to', 'int'));
if (!($label[$n])) {
$errori[$n]++;
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' . $langs->transnoentities("Description")), null, 'errors');
}
if (!($amount[$n])) {
$errori[$n]++;
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("Amount")), null, 'errors');
}
if ($accountto->currency_code == $accountfrom->currency_code) {
$amountto = $amount;
} else {
if (!$amountto) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AmountTo")), null, 'errors');
}
}
if ($amountto < 0) {
$error++;
setEventMessages($langs->trans("AmountMustBePositive"), null, 'errors');
}
if ($accountto->id == $accountfrom->id) {
$error++;
setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors');
}
if (empty($error)) {
$db->begin();
$bank_line_id_from = 0;
$bank_line_id_to = 0;
$result = 0;
// By default, electronic transfert from bank to bank
$typefrom = 'PRE';
$typeto = 'VIR';
if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH) {
// This is transfer of change
$typefrom = 'LIQ';
$typeto = 'LIQ';
}
if (!$error) {
$bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, price2num(-1 * $amount), '', '', $user);
}
if (!($bank_line_id_from > 0)) {
$error++;
}
if (!$error) {
$bank_line_id_to = $accountto->addline($dateo, $typeto, $label, $amountto, '', '', $user);
}
if (!($bank_line_id_to > 0)) {
$error++;
}
if (!$error) {
$result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
}
if (!($result > 0)) {
$error++;
}
if (!$error) {
$result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
}
if (!($result > 0)) {
$error++;
}
if (!$error) {
$mesgs = $langs->trans("TransferFromToDone", '{s1}', '{s2}', $amount, $langs->transnoentitiesnoconv("Currency".$conf->currency));
$mesgs = str_replace('{s1}', '<a href="bankentries_list.php?id='.$accountfrom->id.'&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc">'.$accountfrom->label.'</a>', $mesgs);
$mesgs = str_replace('{s2}', '<a href="bankentries_list.php?id='.$accountto->id.'">'.$accountto->label.'</a>', $mesgs);
setEventMessages($mesgs, null, 'mesgs');
$db->commit();
} else {
setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors');
$db->rollback();
if (!$errori[$n]) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountfrom = new Account($db);
$accountfrom->fetch(GETPOST($n.'_account_from', 'int'));
$accountto = new Account($db);
$accountto->fetch(GETPOST($n.'_account_to', 'int'));
if ($accountto->currency_code == $accountfrom->currency_code) {
$amountto[$n] = $amount[$n];
} else {
if (!$amountto[$n]) {
$error[$n]++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AmountTo")).' #'.$n, null, 'errors');
}
}
if ($amountto[$n] < 0) {
$errori[$n]++;
setEventMessages($langs->trans("AmountMustBePositive").' #'.$n, null, 'errors');
}
if ($accountto->id == $accountfrom->id) {
$errori[$n]++;
setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers").' #'.$n, null, 'errors');
}
}
if ($errori[$n] == 0) {
$db->begin();
$bank_line_id_from = 0;
$bank_line_id_to = 0;
$result = 0;
// By default, electronic transfert from bank to bank
$typefrom = $type[$n];
$typeto = $type[$n];
if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH) {
// This is transfer of change
$typefrom = 'LIQ';
$typeto = 'LIQ';
}
if (!$errori[$n]) {
$bank_line_id_from = $accountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * $amount[$n]), '', '', $user);
}
if (!($bank_line_id_from > 0)) {
$errori[$n]++;
}
if (!$errori[$n]) {
$bank_line_id_to = $accountto->addline($dateo[$n], $typeto, $label[$n], $amountto[$n], '', '', $user);
}
if (!($bank_line_id_to > 0)) {
$errori[$n]++;
}
if (!$errori[$n]) {
$result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
}
if (!($result > 0)) {
$errori++;
}
if (!$errori[$n]) {
$result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
}
if (!($result > 0)) {
$errori[$n]++;
}
if (!$errori[$n]) {
$mesgs = $langs->trans("TransferFromToDone", '{s1}', '{s2}', $amount[$n], $langs->transnoentitiesnoconv("Currency".$conf->currency));
$mesgs = str_replace('{s1}', '<a href="bankentries_list.php?id='.$accountfrom->id.'&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc">'.$accountfrom->label.'</a>', $mesgs);
$mesgs = str_replace('{s2}', '<a href="bankentries_list.php?id='.$accountto->id.'">'.$accountto->label.'</a>', $mesgs);
setEventMessages($mesgs, null, 'mesgs');
$db->commit();
} else {
setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors');
$db->rollback();
}
}
}
$n++;
}
}
/*
* View
*/
$form = new Form($db);
$help_url = 'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:M&oacute;dulo_Bancos_y_Cajas';
$title = $langs->trans('MenuBankInternalTransfer');
llxHeader('', $title, $help_url);
print ' <script type="text/javascript">
$(document).ready(function () {
$(".selectbankaccount").change(function() {
@ -191,6 +222,13 @@ print ' <script type="text/javascript">
var currencycode1="";
var currencycode2="";
$("select").each(function() {
if( $(this).attr("view")){
$(this).closest("tr").removeClass("hidejs").removeClass("hideobject");
}
});
$.get("'.DOL_URL_ROOT.'/core/ajax/getaccountcurrency.php", {id: account1})
.done(function( data ) {
if (data != null)
@ -238,63 +276,104 @@ print ' <script type="text/javascript">
});
</script>';
$form = new Form($db);
$account_from = '';
$account_to = '';
$label = '';
$amount = '';
$amountto = '';
if ($error) {
$account_from = GETPOST('account_from', 'int');
$account_to = GETPOST('account_to', 'int');
$label = GETPOST('label', 'alpha');
$amount = GETPOST('amount', 'alpha');
}
print load_fiche_titre($langs->trans("MenuBankInternalTransfer"), '', 'bank_account');
print '<span class="opacitymedium">'.$langs->trans("TransferDesc").'</span>';
print "<br><br>";
print '<br><br>';
print '<form name="add" method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<div>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<table id="tablemouvbank" class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">'.$langs->trans("Amount").'</td>';
print '<td style="display:none" class="multicurrency">'.$langs->trans("AmountToOthercurrency").'</td>';
print '<th>'.$langs->trans("TransferFrom").'</th>';
print '<th>'.$langs->trans("TransferTo").'</th>';
print '<th>'.$langs->trans("Type").'</th>';
print '<th>'.$langs->trans("Date").'</th>';
print '<th>'.$langs->trans("Description").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
//print '<td class="hideobject" class="multicurrency">'.$langs->trans("AmountToOthercurrency").'</td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print img_picto('', 'bank_account', 'class="paddingright"');
$form->select_comptes($account_from, 'account_from', 0, '', 1, '', !isModEnabled('multicurrency') ? 0 : 1);
print "</td>";
for ($i = 1 ; $i < $MAXLINES; $i++) {
$label = '';
$amount = '';
print "<td>\n";
print img_picto('', 'bank_account', 'class="paddingright"');
$form->select_comptes($account_to, 'account_to', 0, '', 1, '', !isModEnabled('multicurrency') ? 0 : 1);
print "</td>\n";
if ($errori[$i]) {
$label = GETPOST($i.'_label', 'alpha');
$amount = GETPOST($i.'_amount', 'alpha');
}
print "<td>";
print $form->selectDate((!empty($dateo) ? $dateo : ''), '', '', '', '', 'add');
print "</td>\n";
print '<td><input name="label" class="flat quatrevingtpercent" type="text" value="'.dol_escape_htmltag($label).'"></td>';
print '<td class="right"><input name="amount" class="flat right" type="text" size="6" value="'.dol_escape_htmltag($amount).'"></td>';
print '<td style="display:none" class="multicurrency"><input name="amountto" class="flat" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>';
if ($i == 1) {
$classi = 'numvir number'. $i;
$classi .= ' active';
} else {
$classi = 'numvir number'. $i;
$classi .= ' hidejs hideobject';
}
print "</table>";
print '<tr class="oddeven nowraponall '.$classi.'"><td>';
print img_picto('', 'bank_account', 'class="paddingright"');
$form->select_comptes(($errori[$i] ? GETPOST($i.'_account_from', 'int') : ''), $i.'_account_from', 0, '', 1, ($errori[$i] ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
print '</td>';
print '<td class="nowraponall">';
print img_picto('', 'bank_account', 'class="paddingright"');
$form->select_comptes(($errori[$i] ? GETPOST($i.'_account_to', 'int') : ''), $i.'_account_to', 0, '', 1, ($errori[$i] ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
print "</td>\n";
// Payment mode
print '<td class="nowraponall">';
$idpaymentmodetransfer = dol_getIdFromCode($db, 'VIR', 'c_paiement');
$form->select_types_paiements(($errori[$i] ? GETPOST($i.'_type', 'aZ09') : $idpaymentmodetransfer), $i.'_type', '', 0, 1, 0, 0, 1, 'minwidth100');
print "</td>\n";
// Date
print '<td class="nowraponall">';
print $form->selectDate((!empty($dateo[$i]) ? $dateo[$i] : ''), $i.'_', '', '', '', 'add');
print "</td>\n";
print '<td><input name="'.$i.'_label" class="flat quatrevingtpercent selectjs" type="text" value="'.dol_escape_htmltag($label).'"></td>';
print '<td class="right"><input name="'.$i.'_amount" class="flat right selectjs" type="text" size="6" value="'.dol_escape_htmltag($amount).'"></td>';
print '<td class="hideobject" class="multicurrency"><input name="'.$i.'_amountto" class="flat" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>';
print '</tr>';
};
print '</table>';
print '</div>';
print '</div>';
print '<div id="btncont" style="display: flex; align-items: center">';
print '<a id="btnincrement" style="margin-left:35%" class="btnTitle btnTitlePlus" onclick="increment()" title="Ajouter écriture">
<span class="fa fa-plus-circle valignmiddle btnTitle-icon">
</span>
</a>';
print '<br><div class=""><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
print '</div>';
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
print '</form>';
print "</form>";
print ' <script type="text/javascript">
function increment(){
$(".numvir").nextAll(".hidejs:first").removeClass("hidejs").removeClass("hideobject").addClass("active").show();
};
$(".number1").on("click",(function() {
console.log("We click on number1");
$(".hidejs").each(function (){$(this).hide()});
$("#btncont").show();
}))
</script>
';
// End of page
llxFooter();
$db->close();

View File

@ -643,18 +643,28 @@ if ($id) {
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
print '</td></tr>';
if (isModEnabled("banque")) {
if ($object->fk_account > 0) {
$bankline = new AccountLine($db);
$bankline->fetch($object->fk_bank);
$bankaccountnotfound = 0;
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1, 0, 'showall');
print '</td>';
print '</tr>';
if (isModEnabled('banque')) {
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">';
if ($object->fk_bank > 0) {
$bankline = new AccountLine($db);
$result = $bankline->fetch($object->fk_bank);
if ($result <= 0) {
$bankaccountnotfound = 1;
} else {
print $bankline->getNomUrl(1, 0, 'showall');
}
} else {
$bankaccountnotfound = 1;
print '<span class="opacitymedium">'.$langs->trans("NoRecordfound").'</span>';
}
print '</td>';
print '</tr>';
}
// Other attributes
@ -684,7 +694,7 @@ if ($id) {
}
// Delete
if (empty($object->rappro)) {
if (empty($object->rappro) || $bankaccountnotfound) {
if (!empty($user->rights->banque->modifier)) {
if ($alreadyaccounted) {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("Accounted").'">'.$langs->trans("Delete").'</a></div>';

View File

@ -211,7 +211,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -0,0 +1,255 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/facture/agenda.php
* \ingroup facture
* \brief Tab of events on Invoices
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("facture", "other"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical objects
$object = new Facture($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->facture->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('invoiceagenda', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->facture->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
$permissiontoread = $user->hasRight("facture", "lire");
$permissiontoadd = $user->hasRight("facture", "creer");
// Security check
if (!empty($user->socid)) {
$socid = $user->socid;
}
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
/*
* Actions
*/
$parameters = array('id'=>$id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
}
/*
* View
*/
$form = new Form($db);
if ($object->id > 0) {
$title = $langs->trans("Agenda");
//if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
llxHeader('', $title, $help_url);
if (isModEnabled('notification')) {
$langs->load("mails");
}
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("Invoice"), -1, $object->picto);
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>';
if (0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
}
}
}
}
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$object->info($object->id);
dol_print_object_info($object, 1);
print '</div>';
print dol_get_fiche_end();
// Actions buttons
$objthirdparty = $object;
$objcon = new stdClass();
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {
$out .= '&socid='.urlencode($objthirdparty->id);
}
$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '');
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
}
$morehtmlright = '';
//$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
//$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
if (isModEnabled('agenda')) {
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
} else {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0);
}
}
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
print '<br>';
$param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_facture_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnBill").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
//print_barre_liste($langs->trans("ActionsOnBill"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
$filters['search_rowid'] = $search_rowid;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
}
}
// End of page
llxFooter();
$db->close();

View File

@ -1304,7 +1304,8 @@ if (empty($reshook)) {
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
$object->note_private = trim(GETPOST('note_private', 'restricthtml'));
$object->ref_client = GETPOST('ref_client');
$object->ref_customer = GETPOST('ref_client');
$object->ref_client = $object->ref_customer;
$object->model_pdf = GETPOST('model');
$object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = (GETPOST('type') == 3 ? 1 : GETPOST('cond_reglement_id'));
@ -5809,10 +5810,14 @@ if ($action == 'create') {
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty
print '</div></div>';
}

View File

@ -336,10 +336,6 @@ class Facture extends CommonInvoice
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LT2', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>1, 'position'=>130, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>166),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>167),
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>168),
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
@ -370,7 +366,11 @@ class Facture extends CommonInvoice
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315),
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>320),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>506),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'position'=>508),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>510),
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
);

View File

@ -1,144 +0,0 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/facture/info.php
* \ingroup facture
* \brief Page des informations d'une facture
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
if (isModEnabled('project')) {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array('companies', 'bills'));
$id = GETPOST("facid", "int");
$ref = GETPOST("ref", 'alpha');
$object = new Facture($db);
$extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
// Security check
if ($user->socid) {
$socid = $user->socid;
}
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$usercancreate = $user->hasRight("facture", "creer");
/*
* View
*/
$form = new Form($db);
$title = $object->ref." - ".$langs->trans('Info');
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $help_url);
if (empty($object->id)) {
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
$object->fetch_thirdparty();
$object->info($object->id);
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill');
$totalpaid = $object->getSommePaiement();
// Invoice content
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>';
if (0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
}
}
}
}
$morehtmlref .= '</div>';
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table class="centpercent"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
print dol_get_fiche_end();
// End of page
llxFooter();
$db->close();

View File

@ -300,7 +300,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total
@ -1035,7 +1035,7 @@ while ($i < $imaxinloop) {
// Status
if (!empty($arrayfields['status']['checked'])) {
print '<td class="center">';
print $invoicerectmp->getLibStatut(3, 0);
print $invoicerectmp->getLibStatut(5, 0);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -112,6 +112,7 @@ $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'alpha');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_company_code_client = GETPOST("search_type_thirdparty", 'alpha');
$search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
@ -232,8 +233,8 @@ $arrayfields = array(
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>75),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>80),
'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1, 'position'=>85),
'f.module_source'=>array('label'=>"POSModule", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>90),
'f.pos_source'=>array('label'=>"POSTerminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>91),
'f.module_source'=>array('label'=>"POSModule", 'langs'=>'cashdesk', 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>90),
'f.pos_source'=>array('label'=>"POSTerminal", 'langs'=>'cashdesk', 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>91),
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>95),
'f.total_tva'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>100),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj == "1"), 'position'=>110),
@ -241,8 +242,6 @@ $arrayfields = array(
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130),
'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140),
'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166),
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>280),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>285),
'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>290),
@ -255,10 +254,16 @@ $arrayfields = array(
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502),
'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'f.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'f.fk_fac_rec_source'=>array('label'=>'GeneratedFromTemplate', 'checked'=>0, 'position'=>520, 'enabled'=>'1'),
'f.tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502),
'u.login'=>array('label'=>"UserAuthor", 'checked'=>1, 'position'=>504),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>506),
//'f.fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>506),
//'f.fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'position'=>508),
//'f.fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>510),
//'f.fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>520, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'f.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>521, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'f.fk_fac_rec_source'=>array('label'=>'GeneratedFromTemplate', 'checked'=>0, 'position'=>530, 'enabled'=>'1'),
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
@ -268,10 +273,11 @@ if (getDolGlobalString("INVOICE_USE_SITUATION") && !empty($conf->global->INVOICE
// Overwrite $arrayfields from columns into ->fields (transition before removal of $arrayoffields)
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1, 1, '1');
$newkey = '';
if (array_key_exists($key, $arrayfields)) { $newkey = $key; } elseif (array_key_exists('t.'.$key, $arrayfields)) { $newkey = 't.'.$key; } elseif (array_key_exists('f.'.$key, $arrayfields)) { $newkey = 'f.'.$key; } elseif (array_key_exists('s.'.$key, $arrayfields)) { $newkey = 's.'.$key; }
if (array_key_exists($key, $arrayfields)) { $newkey = $key; } elseif (array_key_exists('f.'.$key, $arrayfields)) { $newkey = 'f.'.$key; } elseif (array_key_exists('f.'.$key, $arrayfields)) { $newkey = 'f.'.$key; } elseif (array_key_exists('s.'.$key, $arrayfields)) { $newkey = 's.'.$key; }
if ($newkey) {
$arrayfields[$newkey] = array(
'label'=>$val['label'],

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Markus Welters <markus@welters.de>
*
* This program is free software; you can redistribute it and/or modify
@ -126,8 +126,8 @@ if (empty($reshook)) {
$bprev = new BonPrelevement($db);
if (!$error) {
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
// getDolGlobalString('PRELEVEMENT_CODE_BANQUE') and getDolGlobalString('PRELEVEMENT_CODE_GUICHET') should be empty (we don't use them anymore)
$result = $bprev->create(getDolGlobalString('PRELEVEMENT_CODE_BANQUE'), getDolGlobalString('PRELEVEMENT_CODE_GUICHET'), $mode, $format, $executiondate, 0, $type);
if ($result < 0) {
setEventMessages($bprev->error, $bprev->errors, 'errors');
} elseif ($result == 0) {

View File

@ -39,12 +39,17 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills'));
$action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'salestaxeslist';
$mode = GETPOST('mode', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'alpha');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
@ -62,9 +67,9 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST('page', 'int');
if (empty($page) || $page == -1) {
$page = 0; // If $page is not defined, or '' or -1
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;
$pageprev = $page - 1;
@ -96,6 +101,9 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
$hookmanager->initHooks(array('salestaxeslist'));
$object = new Tva($db);
$permissiontoadd = $user->hasRight('tax', 'charges', 'creer');
$permissiontodelete = $user->hasRight('tax', 'charges', 'supprimer');
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
@ -116,6 +124,7 @@ if ($reshook < 0) {
if (empty($reshook)) {
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers
@ -129,7 +138,15 @@ if (empty($reshook)) {
$search_account = '';
$search_amount = '';
$search_status = '';
$toselect = array();
$search_array_options = array();
}
// Mass actions
$objectclass = 'Tva';
$objectlabel = 'Tva';
$uploaddir = $conf->tax->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -145,9 +162,16 @@ $bankstatic = new Account($db);
$accountingjournal = new AccountingJournal($db);
$bankline = new AccountLine($db);
llxHeader('', $langs->trans("VATDeclarations"));
$now = dol_now();
$sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment as type, t.fk_account,';
$title = $langs->trans("VATDeclarations");
//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
$help_url = '';
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye as status, t.fk_typepayment as type, t.fk_account,';
$sql.= ' ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,';
$sql.= ' t.num_payment, pst.code as payment_code,';
$sql .= ' SUM(ptva.amount) as alreadypayed';
@ -207,7 +231,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@ -223,22 +247,28 @@ if ($limit) {
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
llxFooter();
$db->close();
exit;
}
$num = $db->num_rows($resql);
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
$param .= '&contextpage='.$contextpage;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
@ -298,24 +328,33 @@ if (!empty($search_amount)) {
if ($search_status != '' && $search_status != '-1') {
$param .= '&search_status='.urlencode($search_status);
}
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$moreforfilter = '';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page_y" value="">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$url = DOL_URL_ROOT.'/compta/tva/card.php?action=create';
if (!empty($socid)) {
@ -324,8 +363,17 @@ if (!empty($socid)) {
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
print_barre_liste($langs->trans("VATDeclarations"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
// Add code for pre mass action (confirmation or email presend form)
$topicmail = "SendVAT";
$modelmail = "vat";
$objecttmp = new Tva($db);
$trackid = 'vat'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
$varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
@ -333,15 +381,40 @@ if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
$moreforfilter = '';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre_filter">';
// Filter: Buttons
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
@ -418,92 +491,137 @@ if (!empty($arrayfields['t.status']['checked'])) {
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Filter: Buttons
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '</tr>';
print '</tr>'."\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
}
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.rowid']['checked'])) {
print_liste_field_titre($arrayfields['t.rowid']['label'], $_SERVER['PHP_SELF'], 't.rowid', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.label']['checked'])) {
print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER['PHP_SELF'], 't.label', '', $param, 'align="left"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.datev']['checked'])) {
print_liste_field_titre($arrayfields['t.datev']['label'], $_SERVER['PHP_SELF'], 't.datev', '', $param, 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_typepayment']['label'], $_SERVER['PHP_SELF'], 't.fk_typepayment', '', $param, '', $sortfield, $sortorder, 'left ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.fk_account']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_account']['label'], $_SERVER['PHP_SELF'], 't.fk_account', '', $param, '', $sortfield, $sortorder, 'left ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.amount']['checked'])) {
print_liste_field_titre($arrayfields['t.amount']['label'], $_SERVER['PHP_SELF'], 't.amount', '', $param, '', $sortfield, $sortorder, 'right ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.status']['checked'])) {
print_liste_field_titre($arrayfields['t.status']['label'], $_SERVER["PHP_SELF"], "t.paye", "", $param, 'class="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
}
print '</tr>';
print '</tr>'."\n";
// Loop on record
// --------------------------------------------------------------------
$i = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
$total = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
break; // Should not happen
}
$tva_static->id = $obj->rowid;
$tva_static->ref = $obj->rowid;
$tva_static->label = $obj->label;
$tva_static->paiementtype = $obj->paye;
$tva_static->type_payment = $obj->payment_code;
$tva_static->datev = $obj->datev;
$tva_static->amount = $obj->amount;
$tva_static->paye = $obj->status;
$tva_static->status = $obj->status;
$object = $tva_static;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<tr><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $tva_static->getKanbanView('');
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
}
print $object->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
// Buttons
// Show here line of result
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// No
@ -588,7 +706,6 @@ while ($i < $imaxinloop) {
// Amount
if (!empty($arrayfields['t.amount']['checked'])) {
$total = $total + $obj->amount;
print '<td class="nowrap right"><span class="amount">' . price($obj->amount) . '</span></td>';
if (!$i) {
$totalarray['nbfield']++;
@ -602,7 +719,7 @@ while ($i < $imaxinloop) {
}
if (!empty($arrayfields['t.status']['checked'])) {
print '<td class="nowrap right">' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</td>';
print '<td class="nowrap right">' . $tva_static->getLibStatut(5, $obj->alreadypayed) . '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -611,19 +728,28 @@ while ($i < $imaxinloop) {
}
}
// Buttons
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print '</tr>';
print '</tr>'."\n";
}
$i++;
}
// Add a buttons placeholder for the total line
$totalarray['nbfield']++;
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
@ -641,7 +767,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";

View File

@ -425,7 +425,7 @@ if (isModEnabled('mailing')) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -261,7 +261,12 @@ if ($object->id > 0) {
$param .= '&limit='.$limit;
}
print load_fiche_titre($langs->trans("ActionsOnContract"), $newcardbutton, '');
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_thirdparty_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print load_fiche_titre($langs->trans("ActionsOnContract").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), $newcardbutton, '');
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
// List of all actions

View File

@ -279,7 +279,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -36,7 +36,7 @@ if (!defined('NOREQUIREAJAX')) {
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
// We need langs because the getRandomPassword may use user language to define some rules of pass generation
// We need langs because the getRandomPassword may use the user language to define some rules of pass generation
/*if (!defined('NOREQUIRETRAN')) {
define('NOREQUIRETRAN', '1');
}*/

View File

@ -85,19 +85,19 @@ class box_birthdays extends ModeleBoxes
if ($user->rights->user->user->lire) {
$tmparray = dol_getdate(dol_now(), true);
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, 'birth' as typea, u.email, u.statut as status";
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, date_format(u.birth, '%d') as daya, 'birth' as typea, u.email, u.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = 1";
$sql .= " AND u.statut = ".User::STATUS_ENABLED;
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= ' UNION ';
$sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, 'employment' as typea, u.email, u.statut as status";
$sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, date_format(u.dateemployment, '%d') as daya, 'employment' as typea, u.email, u.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = 1";
$sql .= " AND u.statut = ".User::STATUS_ENABLED;
$sql .= dolSqlDateFilter('u.dateemployment', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY DAY(datea) ASC";
$sql .= " ORDER BY daya ASC"; // We want to have date of the month sorted by the day without taking into consideration the year
$sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -85,12 +85,12 @@ class box_birthdays_members extends ModeleBoxes
if ($user->rights->adherent->lire) {
$tmparray = dol_getdate(dol_now(), true);
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth";
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth, date_format(u.birth, '%d') as daya, u.email, u.statut as status, u.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as u";
$sql .= " WHERE u.entity IN (".getEntity('adherent').")";
$sql .= " AND u.statut = ".Adherent::STATUS_VALIDATED;
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY DAY(u.birth) ASC";
$sql .= " ORDER BY daya ASC"; // We want to have date of the month sorted by the day without taking into consideration the year
$sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
@ -104,9 +104,16 @@ class box_birthdays_members extends ModeleBoxes
$memberstatic->id = $objp->rowid;
$memberstatic->firstname = $objp->firstname;
$memberstatic->lastname = $objp->lastname;
$memberstatic->email = $objp->email;
$memberstatic->status = $objp->status;
$memberstatic->statut = $memberstatic->status;
$memberstatic->datefin = $this->db->jdate($objp->datefin);
//$memberstatic->need_subscription = 1;
$dateb = $this->db->jdate($objp->birth);
$age = date('Y', dol_now()) - date('Y', $dateb);
$typea = '<i class="fas fa-birthday-cake inline-block"></i>';
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $memberstatic->getNomUrl(1),
@ -118,6 +125,12 @@ class box_birthdays_members extends ModeleBoxes
'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears')
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'text' => $typea,
'asis' => 1
);
/*$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $memberstatic->LibStatut($objp->status, 3)

View File

@ -112,6 +112,11 @@ class DolGraph
$this->datacolor = array(array(120, 130, 150), array(160, 160, 180), array(190, 190, 220));
$this->bgcolor = array(235, 235, 224);
// For small screen, we prefer a default with of 300
if (!empty($conf->dol_optimize_smallscreen)) {
$this->width = 300;
}
// Load color of the theme
$color_file = DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
if (is_readable($color_file)) {

View File

@ -726,6 +726,8 @@ class ExtraFields
if (is_array($param) && count($param) > 0) {
$params = serialize($param);
} elseif (is_array($param)) {
$params = '';
} elseif (strlen($param) > 0) {
$params = trim($param);
} else {

View File

@ -6729,8 +6729,8 @@ class Form
}
// Zone de saisie manuelle de la date
$retstring .= '<div class="nowrap inline-block divfordateinput">';
$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"';
$retstring .= '<div class="nowraponall inline-block divfordateinput">';
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript

View File

@ -190,14 +190,10 @@ class FormActions
$num = count($listofactions);
if ($num || $forceshowtitle) {
if ($typeelement == 'invoice') {
$title = $langs->trans('ActionsOnBill');
} elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') {
if ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') {
$title = $langs->trans('ActionsOnBill');
} elseif ($typeelement == 'supplier_proposal') {
$title = $langs->trans('ActionsOnSupplierProposal');
} elseif ($typeelement == 'order') {
$title = $langs->trans('ActionsOnOrder');
} elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') {
$title = $langs->trans('ActionsOnOrder');
} elseif ($typeelement == 'shipping') {

View File

@ -1445,7 +1445,25 @@ class FormFile
if (in_array($modulepart, array('product', 'produit', 'service'))) {
$newmodulepart = 'produit|service';
}
if (image_format_supported($file['name']) > 0) {
if ($permtoeditline) {
$moreparaminurl = '';
if (!empty($object->id) && $object->id > 0) {
$moreparaminurl .= '&id='.$object->id;
} elseif (GETPOST('website', 'alpha')) {
$moreparaminurl .= '&website='.GETPOST('website', 'alpha');
}
// Set the backtourl
if ($modulepart == 'medias' && !GETPOST('website')) {
$moreparaminurl .= '&backtourl='.urlencode(DOL_URL_ROOT.'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.'&section_dir='.$relativepath);
}
if ($modulepart == 'medias' && !GETPOST('website')) {
print '<a href="'.DOL_URL_ROOT.'/ecm/index_medias.php?action=confirmconvertimgwebp&token='.newToken().'&section_dir='.urlencode($relativepath).'&filetoregenerate='.urlencode($fileinfo['basename']).'&module='.$modulepart.$param.$moreparaminurl.'" title="'.dol_escape_htmltag($langs->trans("GenerateChosenImgWebp")).'">'.img_picto('', 'images', 'class="flip marginrightonly"').'</a>';
} elseif ($modulepart == 'medias' && GETPOST('website')) {
print '<a href="'.DOL_URL_ROOT.'/website/index.php?action=confirmconvertimgwebp&token='.newToken().'&section_dir='.urlencode($relativepath).'&filetoregenerate='.urlencode($fileinfo['basename']).'&module='.$modulepart.$param.$moreparaminurl.'" title="'.dol_escape_htmltag($langs->trans("GenerateChosenImgWebp")).'">'.img_picto('', 'images', 'class="flip marginrightonly"').'</a>';
}
}
}
if (!$disablecrop && image_format_supported($file['name']) > 0) {
if ($permtoeditline) {
// Link to resize

View File

@ -98,10 +98,15 @@ class FormMargin
}
$pv = $line->total_ht;
$pa_ht = ($pv < 0 ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);
$pa_ht = (($pv < 0 || ($pv == 0 && in_array($object->element, array('facture', 'facture_fourn')) && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
// We need a compensation relative to $line->situation_percent
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);
} else {
$pa = $line->qty * $pa_ht;
}
} else {
$pa = $line->qty * $pa_ht;
}
@ -213,7 +218,7 @@ class FormMargin
$marginInfo = $this->getMarginInfosArray($object, $force_price);
$parameters=array('marginInfo'=>&$marginInfo);
$parameters=array('marginInfo' => &$marginInfo);
$reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -233,8 +238,8 @@ class FormMargin
print '});</script>';
}
print '<!-- displayMarginInfos() - Show margin table -->' . "\n";
print '<div class="div-table-responsive-no-min">';
print '<!-- Margin table -->' . "\n";
print '<table class="noborder margintable centpercent" id="margintable">';
print '<tr class="liste_titre">';

View File

@ -1644,11 +1644,21 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Commande') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'invoice'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) {

View File

@ -87,11 +87,37 @@ function contract_prepare_head(Contrat $object)
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_contract_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbEvent = $dataretrieved;
} else {
$sql = "SELECT COUNT(id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
$sql .= " WHERE fk_element = ".((int) $object->id);
$sql .= " AND elementtype = 'contract'";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$nbEvent = $obj->nb;
} else {
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
}
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
if ($nbEvent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
}
}
$head[$h][2] = 'agenda';
$h++;

View File

@ -5413,7 +5413,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict
* @param string $morecss More css to the table
* @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
* @param int $hideselectlimit Force to hide select limit
* @param int $hidenavigation Force to hide all navigation tools
* @param int $hidenavigation Force to hide the arrows and page for navigation
* @param int $pagenavastextinput 1=Do not suggest list of pages to navigate but suggest the page number into an input field.
* @param string $morehtmlrightbeforearrow More html to show (before arrows)
* @return void
@ -5441,7 +5441,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
} else {
$nextpage = 0;
}
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage.'-hideselectlimit='.$hideselectlimit.'-hidenavigation='.$hidenavigation;
print "\n";
print "<!-- Begin title -->\n";
@ -5536,8 +5536,8 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
}
}
if (($savlimit || $morehtmlright || $morehtmlrightbeforearrow) && empty($hidenavigation)) {
print_fleche_navigation((int) $page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow); // output the div and ul for previous/last completed with page numbers into $pagelist
if ($savlimit || $morehtmlright || $morehtmlrightbeforearrow) {
print_fleche_navigation((int) $page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow, $hidenavigation); // output the div and ul for previous/last completed with page numbers into $pagelist
}
// js to autoselect page field on focus
@ -5571,9 +5571,10 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
* @param int $totalnboflines Total number of records/lines for all pages (if known)
* @param int $hideselectlimit Force to hide select limit
* @param string $beforearrows HTML content to show before arrows. Must NOT contains '<li> </li>' tags.
* @param int $hidenavigation Force to hide the arrows and page for navigation
* @return void
*/
function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $betweenarrows = '', $afterarrows = '', $limit = -1, $totalnboflines = 0, $hideselectlimit = 0, $beforearrows = '')
function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $betweenarrows = '', $afterarrows = '', $limit = -1, $totalnboflines = 0, $hideselectlimit = 0, $beforearrows = '', $hidenavigation = 0)
{
global $conf, $langs;
@ -5583,69 +5584,72 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
print $beforearrows;
print '</li>';
}
if ((int) $limit > 0 && empty($hideselectlimit)) {
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000';
$pagesizechoices .= ',5000:5000,10000:10000,20000:20000';
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2';
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) {
$pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;
}
print '<li class="pagination">';
print '<select class="flat selectlimit" name="limit" title="'.dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")).'">';
$tmpchoice = explode(',', $pagesizechoices);
$tmpkey = $limit.':'.$limit;
if (!in_array($tmpkey, $tmpchoice)) {
$tmpchoice[] = $tmpkey;
}
$tmpkey = $conf->liste_limit.':'.$conf->liste_limit;
if (!in_array($tmpkey, $tmpchoice)) {
$tmpchoice[] = $tmpkey;
}
asort($tmpchoice, SORT_NUMERIC);
foreach ($tmpchoice as $val) {
$selected = '';
$tmp = explode(':', $val);
$key = $tmp[0];
$val = $tmp[1];
if ($key != '' && $val != '') {
if ((int) $key == (int) $limit) {
$selected = ' selected="selected"';
}
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
if (empty($hidenavigation)) {
if ((int) $limit > 0 && empty($hideselectlimit)) {
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000';
$pagesizechoices .= ',5000:5000,10000:10000,20000:20000';
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2';
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) {
$pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;
}
print '<li class="pagination">';
print '<select class="flat selectlimit" name="limit" title="'.dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")).'">';
$tmpchoice = explode(',', $pagesizechoices);
$tmpkey = $limit.':'.$limit;
if (!in_array($tmpkey, $tmpchoice)) {
$tmpchoice[] = $tmpkey;
}
$tmpkey = $conf->liste_limit.':'.$conf->liste_limit;
if (!in_array($tmpkey, $tmpchoice)) {
$tmpchoice[] = $tmpkey;
}
asort($tmpchoice, SORT_NUMERIC);
foreach ($tmpchoice as $val) {
$selected = '';
$tmp = explode(':', $val);
$key = $tmp[0];
$val = $tmp[1];
if ($key != '' && $val != '') {
if ((int) $key == (int) $limit) {
$selected = ' selected="selected"';
}
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
}
}
print '</select>';
if ($conf->use_javascript_ajax) {
print '<!-- JS CODE TO ENABLE select limit to launch submit of page -->
<script>
jQuery(document).ready(function () {
jQuery(".selectlimit").change(function() {
console.log("Change limit. Send submit");
$(this).parents(\'form:first\').submit();
});
});
</script>
';
}
print '</li>';
}
print '</select>';
if ($conf->use_javascript_ajax) {
print '<!-- JS CODE TO ENABLE select limit to launch submit of page -->
<script>
jQuery(document).ready(function () {
jQuery(".selectlimit").change(function() {
console.log("Change limit. Send submit");
$(this).parents(\'form:first\').submit();
});
});
</script>
';
if ($page > 0) {
print '<li class="pagination paginationpage paginationpageleft"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>';
}
if ($betweenarrows) {
print '<!--<div class="betweenarrows nowraponall inline-block">-->';
print $betweenarrows;
print '<!--</div>-->';
}
if ($nextpage > 0) {
print '<li class="pagination paginationpage paginationpageright"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
}
if ($afterarrows) {
print '<li class="paginationafterarrows">';
print $afterarrows;
print '</li>';
}
print '</li>';
}
if ($page > 0) {
print '<li class="pagination paginationpage paginationpageleft"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>';
}
if ($betweenarrows) {
print '<!--<div class="betweenarrows nowraponall inline-block">-->';
print $betweenarrows;
print '<!--</div>-->';
}
if ($nextpage > 0) {
print '<li class="pagination paginationpage paginationpageright"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
}
if ($afterarrows) {
print '<li class="paginationafterarrows">';
print $afterarrows;
print '</li>';
}
print '</ul></div>'."\n";
}
@ -8985,7 +8989,7 @@ function verifCond($strToEvaluate)
* @param string $s String to evaluate
* @param int $returnvalue 0=No return (used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
* @param int $hideerrors 1=Hide errors
* @param string $onlysimplestring '0' (used for computed property of extrafields)=Accept all chars, '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', '2' (not used)=Accept also ';[]'
* @param string $onlysimplestring '0' (used for computed property of extrafields)=Accept all chars, '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', '2' (rarely used)=Accept also '[]'
* @return mixed Nothing or return result of eval
*/
function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1')
@ -9021,15 +9025,21 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
}
} elseif ($onlysimplestring == '2') {
// We must accept: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found"
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@;[]', '/').']/i', $s)) {
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@[]', '/').']/i', $s)) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s);
return '';
}
// TODO
// We can exclude all parenthesis ( that are not '($db' and 'getDolGlobalInt(' and 'getDolGlobalString(' and 'preg_match(' and 'isModEnabled('
// ...
}
}
if (is_array($s) || $s === 'Array') {
return 'Bad string syntax to evaluate (value is Array) '.var_export($s, true);
}
if (strpos($s, '::') !== false) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (double : char is forbidden): '.$s;
@ -12310,25 +12320,28 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
$out .= '</div>';
// Title
$libelle = '';
$out .= ' <div class="messaging-title inline-block">';
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
$out .= $langs->trans('TicketNewMessage');
} elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
$out .= $langs->trans('TicketNewMessage').' <em>('.$langs->trans('Private').')</em>';
} else {
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
$transcode = $langs->trans("Action".$histo[$key]['acode']);
} elseif (isset($histo[$key]['type'])) {
if ($histo[$key]['type'] == 'action') {
$transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
$libelle = $histo[$key]['note'];
$actionstatic->id = $histo[$key]['id'];
$out .= dol_trunc($libelle, 120);
}
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
$out .= dol_escape_htmltag(dol_trunc($libelle, 120));
} elseif ($histo[$key]['type'] == 'mailing') {
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
$out .= dol_trunc($libelle, 120);
$out .= dol_escape_htmltag(dol_trunc($libelle, 120));
} else {
$libelle .= $histo[$key]['note'];
$out .= dol_escape_htmltag(dol_trunc($libelle, 120));
}
}
@ -12336,7 +12349,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
$out .= '</h3>';
if (!empty($histo[$key]['message'])
if (!empty($histo[$key]['message'] && $histo[$key]['message'] != $libelle)
&& $actionstatic->code != 'AC_TICKET_CREATE'
&& $actionstatic->code != 'AC_TICKET_MODIFY'
) {

View File

@ -35,19 +35,19 @@
*/
function facture_prepare_head($object)
{
global $db, $langs, $conf;
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?id='.$object->id;
$head[$h][1] = $langs->trans('CustomerInvoice');
$head[$h][2] = 'compta';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.urlencode($object->id);
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?id='.urlencode($object->id);
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
@ -73,7 +73,7 @@ function facture_prepare_head($object)
}
$langs->load("banks");
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.urlencode($object->id);
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?id='.urlencode($object->id);
$head[$h][1] = $langs->trans('StandingOrders');
if ($nbStandingOrders > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbStandingOrders.'</span>';
@ -96,7 +96,7 @@ function facture_prepare_head($object)
if (!empty($object->note_public)) {
$nbNote++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
@ -110,7 +110,7 @@ function facture_prepare_head($object)
$upload_dir = $conf->facture->dir_output."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
@ -118,9 +118,38 @@ function facture_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id;
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_facture_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbEvent = $dataretrieved;
} else {
$sql = "SELECT COUNT(id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
$sql .= " WHERE fk_element = ".((int) $object->id);
$sql .= " AND elementtype = 'invoice'";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$nbEvent = $obj->nb;
} else {
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
}
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
if ($nbEvent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
}
}
$head[$h][2] = 'agenda';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice', 'add', 'external');

View File

@ -126,16 +126,38 @@ function member_prepare_head(Adherent $object)
$h++;
// Show agenda tab
if (isModEnabled('agenda')) {
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
$head[$h][0] = DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_member_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbEvent = $dataretrieved;
} else {
$sql = "SELECT COUNT(id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
$sql .= " WHERE elementtype = 'member' AND fk_element = ".((int) $object->id);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$nbEvent = $obj->nb;
} else {
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
}
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
if ($nbEvent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
}
$head[$h][2] = 'agenda';
$h++;
}
$head[$h][2] = 'agenda';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'add', 'external');

View File

@ -419,6 +419,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
/**
* Get list of existing objects from directory
*
* @param string $destdir Directory
* @return Array|int <=0 if KO, array if OK
*/
@ -443,7 +444,87 @@ function dolGetListOfObjectClasses($destdir)
}
if (count($objects)>0) {
return $objects;
} else {
return -1;
}
/**
* Delete all permissions
*
* @param string $file file with path
* @return void
*/
function deletePerms($file)
{
$start = "/* BEGIN MODULEBUILDER PERMISSIONS */";
$end = "/* END MODULEBUILDER PERMISSIONS */";
$i = 1;
$array = array();
$lines = file($file);
// Search for start and end lines
foreach ($lines as $i => $line) {
if (strpos($line, $start) !== false) {
$start_line = $i + 1;
// Copy lines until the end on array
while (($line = $lines[++$i]) !== false) {
if (strpos($line, $end) !== false) {
$end_line = $i + 1;
break;
}
$array[] = $line;
}
break;
}
}
$allContent = implode("", $array);
dolReplaceInFile($file, array($allContent => ''));
}
/**
* Rewriting all permissions after any actions
* @param string $file filename or path
* @param array $permissions permissions existing in file
* @param int|null $key key for permission needed
* @param array|null $right $right to update or add
* @param int $action 0 for delete, 1 for add, 2 for update
* @return int 1 if OK,-1 if KO
*/
function reWriteAllPermissions($file, $permissions, $key, $right, $action)
{
$error = 0;
$rights = array();
if ($action == 0) {
// delete right from permissions array
array_splice($permissions, array_search($permissions[$key], $permissions), 1);
} elseif ($action == 1) {
array_push($permissions, $right);
} elseif ($action == 2 && !empty($right)) {
// update right from permissions array
array_splice($permissions, array_search($permissions[$key], $permissions), 1, $right);
} else {
return -1;
$error++;
}
if (!$error) {
// prepare permissions array
$count_perms = count($permissions);
for ($i = 0;$i<$count_perms;$i++) {
$permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)";
$permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'";
$permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'";
$permissions[$i][5] = "\$this->rights[\$r][5] = '".$permissions[$i][5]."';\n\t\t";
}
//convert to string
foreach ($permissions as $perms) {
$rights[] = implode(";\n\t\t", $perms);
$rights[] = "\$r++;\n\t\t";
}
$rights_str = implode("", $rights);
// delete all permission from file
deletePerms($file);
// rewrite all permission again
dolReplaceInFile($file, array('/* BEGIN MODULEBUILDER PERMISSIONS */' => '/* BEGIN MODULEBUILDER PERMISSIONS */'."\n\t\t".$rights_str));
return 1;
}
}

View File

@ -128,9 +128,39 @@ function commande_prepare_head(Commande $object)
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$head[$h][0] = DOL_URL_ROOT.'/commande/agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_propal_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbEvent = $dataretrieved;
} else {
$sql = "SELECT COUNT(id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
$sql .= " WHERE fk_element = ".((int) $object->id);
$sql .= " AND elementtype = 'order'";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$nbEvent = $obj->nb;
} else {
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
}
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
if ($nbEvent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
}
}
$head[$h][2] = 'agenda';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'add', 'external');

View File

@ -113,10 +113,11 @@ function dolGetRandomBytes($length)
* @param string $chain string to encode
* @param string $key If '', we use $dolibarr_main_instance_unique_id
* @param string $ciphering Default ciphering algorithm
* @param string $forceseed To force the seed
* @return string encoded string
* @see dolDecrypt(), dol_hash()
*/
function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR")
function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = '')
{
global $dolibarr_main_instance_unique_id;
global $dolibarr_disable_dolcrypt_for_debug;
@ -134,6 +135,9 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR")
if (empty($key)) {
$key = $dolibarr_main_instance_unique_id;
}
if (empty($ciphering)) {
$ciphering = 'AES-256-CTR';
}
$newchain = $chain;
@ -145,7 +149,11 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR")
if ($ivlen === false || $ivlen < 1 || $ivlen > 32) {
$ivlen = 16;
}
$ivseed = dolGetRandomBytes($ivlen);
if (empty($forceseed)) {
$ivseed = dolGetRandomBytes($ivlen);
} else {
$ivseed = dol_trunc(md5($forceseed), $ivlen, 'right', 'UTF-8', 1);
}
$newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed);
return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain;

View File

@ -581,6 +581,9 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token
token: \''.dol_escape_js(newToken()).'\'
},
function(result) {
if ($("input#'.dol_escape_js($htmlname).'").attr("type") == "password") {
$("input#'.dol_escape_js($htmlname).'").attr("type", "text");
}
$("#'.dol_escape_js($htmlname).'").val(result);
});
});

View File

@ -248,10 +248,15 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $export_icon;
/**
* @var array export enabled
*/
public $export_enabled;
public $export_permission;
public $export_fields_array;
public $export_TypeFields_array; // Array of key=>type where type can be 'Numeric', 'Date', 'Text', 'Boolean', 'Status', 'List:xxx:login:rowid'
public $export_entities_array;
public $export_examplevalues_array;
public $export_help_array;
public $export_special_array; // special or computed field
public $export_dependencies_array;
@ -273,9 +278,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $import_label;
public $import_icon;
public $import_entities_array;
public $import_tables_array;
public $import_tables_creator_array;
public $import_fields_array;
public $import_fieldshidden_array;
public $import_convertvalue_array;

View File

@ -142,16 +142,16 @@ class modCategorie extends DolibarrModules
if (isModEnabled("societe")) {
$typeexample .= ($typeexample ? " / " : "")."4=Contact";
}
if (!empty($conf->bank->enabled)) {
if (isModEnabled('bank')) {
$typeexample .= ($typeexample ? " / " : "")."5=Bank account";
}
if (isModEnabled('project')) {
$typeexample .= ($typeexample ? " / " : "")."6=Project";
}
if (!empty($conf->user->enabled)) {
if (isModEnabled('user')) {
$typeexample .= ($typeexample ? " / " : "")."7=User";
}
if (!empty($conf->bank->enabled)) {
if (isModEnabled('bank')) {
$typeexample .= ($typeexample ? " / " : "")."8=Bank line";
}
if (isModEnabled('stock')) {
@ -411,7 +411,7 @@ class modCategorie extends DolibarrModules
$this->export_code[$r] = $this->rights_class.'_7_'.Categorie::$MAP_ID_TO_CODE[7];
$this->export_label[$r] = 'CatUsersList';
$this->export_icon[$r] = $this->picto;
$this->export_enabled[$r] = '!empty($conf->user->enabled)';
$this->export_enabled[$r] = 'isModEnabled("user")';
$this->export_permission[$r] = array(array("categorie", "lire"), array("user", "export"));
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'UserID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname');
$this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
@ -594,7 +594,7 @@ class modCategorie extends DolibarrModules
}
// 7 Users
if (!empty($conf->user->enabled)) {
if (isModEnabled('user')) {
$r++;
$this->import_code[$r] = $this->rights_class.'_7_'.Categorie::$MAP_ID_TO_CODE[7];
$this->import_label[$r] = "CatUsersLinks"; // Translation key

View File

@ -158,8 +158,6 @@ class modLoan extends DolibarrModules
*/
public function init($options = '')
{
global $conf;
$result = $this->_load_tables('/install/mysql/', 'loan');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')

View File

@ -269,11 +269,16 @@ class modTakePos extends DolibarrModules
dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity);
$sql = array();
$result = $this->_load_tables('/install/mysql/', 'takepos');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
// Remove permissions and default values
// Clean before activation
$this->remove($options);
$sql = array();
return $this->_init($sql, $options);
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2021 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2023 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
@ -342,10 +342,10 @@ class doc_generic_mo_odt extends ModelePDFMo
$odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->mrp->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
'PATH_TO_TMP' => $conf->mrp->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
)
);
} catch (Exception $e) {
@ -359,8 +359,6 @@ class doc_generic_mo_odt extends ModelePDFMo
// [!-- BEGIN lines --]*[!-- END lines --]
//print html_entity_decode($odfHandler->__toString());
//print exit;
/*
// Make substitutions into odt of freetext
try {
@ -461,7 +459,7 @@ class doc_generic_mo_odt extends ModelePDFMo
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
*/
// Write new file
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
try {

View File

@ -203,7 +203,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php<br>Contact:con
<!-- Always editable -->
<tr class="extra_alwayseditable"><td><?php echo $form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ((GETPOST('alwayseditable', 'alpha') || !GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr>
<!-- Visibility -->
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'<br><br>'.$langs->trans("ItCanBeAnExpression")); ?>
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list', 'int') != '' ? GETPOST('list', 'int') : '1'; ?>"></td></tr>
<!-- Visibility for PDF-->
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>

View File

@ -289,7 +289,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
<tr class="extra_alwayseditable"><td><?php echo $form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable ? ' checked' : ''); ?>></td></tr>
<!-- Visibility -->
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'<br><br>'.$langs->trans("ItCanBeAnExpression")); ?>
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list != '' ? $list : '1'); ?>"></td></tr>
<!-- Visibility for PDF-->

View File

@ -73,7 +73,7 @@ print '<td>'.$langs->trans("ComputedFormula").'</td>';
print '<td class="center">'.$langs->trans("Unique").'</td>';
print '<td class="center">'.$langs->trans("Mandatory").'</td>';
print '<td class="center">'.$form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")).'</td>';
print '<td class="center">'.$form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")).'</td>';
print '<td class="center">'.$form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'<br><br>'.$langs->trans("ItCanBeAnExpression")).'</td>';
print '<td class="center">'.$form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")).'</td>';
print '<td class="center">'.$form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")).'</td>';
print '<td class="center">'.$form->textwithpicto($langs->trans("CssOnEdit"), $langs->trans("HelpCssOnEditDesc")).'</td>';

View File

@ -197,18 +197,22 @@ if ($action == 'confirmconvertimgwebp') {
$section_dir=GETPOST('section_dir', 'alpha');
$section=GETPOST('section', 'alpha');
$file=GETPOST('filetoregenerate', 'alpha');
$form = new Form($db);
$formquestion['section_dir']=array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir');
$formquestion['section']=array('type'=>'hidden', 'value'=>$section, 'name'=>'section');
$formquestion['filetoregenerate']=array('type'=>'hidden', 'value'=>$file, 'name'=>'filetoregenerate');
if ($module == 'medias') {
$formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website');
}
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', $formquestion, "yes", 1);
print $form->formconfirm($_SERVER["PHP_SELF"], empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp'), 'convertimgwebp', $formquestion, "yes", 1);
$action = 'file_manager';
}
// Duplicate images into .webp
if ($action == 'convertimgwebp' && $permtoadd) {
$file = GETPOST('filetoregenerate', 'alpha');
if ($module == 'medias') {
$imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha'));
} else {
@ -217,9 +221,14 @@ if ($action == 'convertimgwebp' && $permtoadd) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$regeximgext = getListOfPossibleImageExt();
if (!empty($file)) {
$filelist = array();
$filelist[]["fullname"] = dol_osencode($imagefolder.'/'.$file); // get $imagefolder.'/'.$file infos
} else {
$regeximgext = getListOfPossibleImageExt();
$filelist = dol_dir_list($imagefolder, "files", 0, $regeximgext);
$filelist = dol_dir_list($imagefolder, "files", 0, $regeximgext);
}
$nbconverted = 0;
@ -245,7 +254,11 @@ if ($action == 'convertimgwebp' && $permtoadd) {
}
}
if (!$error) {
setEventMessages($langs->trans('SucessConvertImgWebp'), null);
if (!empty($file)) {
setEventMessages($langs->trans('SucessConvertChosenImgWebp'), null);
} else {
setEventMessages($langs->trans('SucessConvertImgWebp'), null);
}
}
$action = 'file_manager';
}

View File

@ -124,7 +124,7 @@ if ($nolinesbefore) {
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
<td class="linecoluht_currency right"><span id="title_up_ht_currency"><?php echo $langs->trans('PriceUHTCurrency'); ?></span></td>
<?php } ?>
<?php if (!empty($inputalsopricewithtax)) { ?>
<?php if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
<td class="linecoluttc right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td>
<?php } ?>
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td>

View File

@ -102,8 +102,14 @@ $(document).ready(function () {
</script>
<?php } ?>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));"' : '' ?>>
<div class="login_center center"<?php
if (empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
}
?>>
<div class="login_vertical_align">
<form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">

View File

@ -134,7 +134,14 @@ $(document).ready(function () {
<?php } ?>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));"' : '' ?>>
<div class="login_center center"<?php
if (empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
}
?>>
<div class="login_vertical_align">
<form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">

View File

@ -524,7 +524,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
//$sql .= ", COUNT(rc.rowid) as anotherfield";

View File

@ -274,7 +274,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (!empty($confOrBooth->id)) {

View File

@ -1840,7 +1840,7 @@ if ($action == 'create') {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdate_livraison">';
print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print '<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : '&nbsp;';
@ -1858,10 +1858,10 @@ if ($action == 'create') {
print '<input name="action" value="settrueWeight" type="hidden">';
print '<input name="id" value="'.$object->id.'" type="hidden">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.'" type="text" class="width50">';
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
print ' <input class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
print '<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.'" type="text" class="width50 valignmiddle">';
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2, 'maxwidth125 valignmiddle');
print ' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
print ' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
print '</form>';
} else {
print $object->trueWeight;
@ -1895,8 +1895,8 @@ if ($action == 'create') {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.'" type="text" class="width50">';
print $formproduct->selectMeasuringUnits("size_units", "size", $object->size_units, 0, 2);
print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
print ' <input class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
print ' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
print ' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
print '</form>';
} else {
print $object->trueHeight;
@ -1975,7 +1975,7 @@ if ($action == 'create') {
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print '<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
if ($object->shipping_method_id > 0) {

View File

@ -4051,8 +4051,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result > 0) {
$resql = $this->db->query($sql);
if ($resql) {
if (!$error) {
$result = $this->insertExtraFields();
if ($result < 0) {
@ -4061,7 +4061,6 @@ class CommandeFournisseurLigne extends CommonOrderLine
}
if (!$error && !$notrigger) {
global $user;
// Call trigger
$result = $this->call_trigger('LINEORDER_SUPPLIER_MODIFY', $user);
if ($result < 0) {

View File

@ -278,7 +278,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn_rec as f';

View File

@ -431,7 +431,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -309,7 +309,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total

View File

@ -231,7 +231,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -226,7 +226,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -363,7 +363,7 @@ if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
@ -906,7 +906,7 @@ function DisplayPositionList()
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -232,7 +232,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t LEFT JOIN ".MAIN_DB_PREFIX.$userstatic->table_element." as u on t.fk_user = u.rowid, ".MAIN_DB_PREFIX."hrm_job as j";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {

View File

@ -235,7 +235,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
//$sql .= ", COUNT(rc.rowid) as anotherfield";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -279,255 +279,255 @@ INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUE
UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = "AFG";
UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = "ALA";
UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = "ALB";
UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = "DEU";
UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = "AND";
UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = "AGO";
UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = "AIA";
UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = "ATA";
UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = "ATG";
UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = "SAU";
UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = "DZA";
UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = "ARG";
UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = "ARM";
UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = "ABW";
UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = "AUS";
UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = "AUT";
UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = "AZE";
UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = "BHS";
UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = "BGD";
UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = "BRB";
UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = "BHR";
UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = "BEL";
UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = "BLZ";
UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = "BEN";
UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = "BMU";
UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = "BLR";
UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = "BOL";
UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = "BES";
UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = "BIH";
UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = "BWA";
UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = "BRA";
UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = "BRN";
UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = "BGR";
UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = "BFA";
UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = "BDI";
UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = "BTN";
UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = "CPV";
UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = "KHM";
UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = "CMR";
UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = "CAN";
UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = "QAT";
UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = "TCD";
UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = "CHL";
UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = "CHN";
UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = "CYP";
UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = "COL";
UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = "COM";
UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = "PRK";
UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = "KOR";
UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = "CIV";
UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = "CRI";
UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = "HRV";
UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = "CUB";
UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = "CUW";
UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = "DNK";
UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = "DMA";
UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = "ECU";
UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = "EGY";
UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = "SLV";
UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = "ARE";
UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = "ERI";
UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = "SVK";
UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = "SVN";
UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = "ESP";
UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = "USA";
UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = "EST";
UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = "ETH";
UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = "PHL";
UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = "FIN";
UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = "FJI";
UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = "FRA";
UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = "GAB";
UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = "GMB";
UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = "GEO";
UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = "GHA";
UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = "GIB";
UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = "GRD";
UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = "GRC";
UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = "GRL";
UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = "GLP";
UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = "GUM";
UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = "GTM";
UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = "GUF";
UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = "GGY";
UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = "GIN";
UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = "GNB";
UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = "GNQ";
UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = "GUY";
UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = "HTI";
UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = "HND";
UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = "HKG";
UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = "HUN";
UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = "IND";
UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = "IDN";
UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = "IRQ";
UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = "IRN";
UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = "IRL";
UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = "BVT";
UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = "IMN";
UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = "CXR";
UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = "ISL";
UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = "CYM";
UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = "CCK";
UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = "COK";
UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = "FRO";
UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = "SGS";
UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = "HMD";
UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = "FLK";
UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = "MNP";
UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = "MHL";
UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = "PCN";
UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = "SLB";
UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = "TCA";
UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = "UMI";
UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = "VGB";
UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = "VIR";
UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = "ISR";
UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = "ITA";
UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = "JAM";
UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = "JPN";
UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = "JEY";
UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = "JOR";
UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = "KAZ";
UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = "KEN";
UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = "KGZ";
UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = "KIR";
UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = "KWT";
UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = "LAO";
UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = "LSO";
UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = "LVA";
UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = "LBN";
UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = "LBR";
UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = "LBY";
UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = "LIE";
UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = "LTU";
UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = "LUX";
UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = "MAC";
UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = "MKD";
UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = "MDG";
UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = "MYS";
UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = "MWI";
UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = "MDV";
UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = "MLI";
UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = "MLT";
UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = "MAR";
UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = "MTQ";
UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = "MUS";
UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = "MRT";
UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = "MYT";
UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = "MEX";
UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = "FSM";
UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = "MDA";
UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = "MCO";
UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = "MNG";
UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = "MNE";
UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = "MSR";
UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = "MOZ";
UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = "MMR";
UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = "NAM";
UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = "NRU";
UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = "NPL";
UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = "NIC";
UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = "NER";
UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = "NGA";
UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = "NIU";
UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = "NFK";
UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = "NOR";
UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = "NCL";
UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = "NZL";
UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = "OMN";
UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = "NLD";
UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = "PAK";
UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = "PLW";
UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = "PSE";
UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = "PAN";
UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = "PNG";
UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = "PRY";
UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = "PER";
UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = "PYF";
UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = "POL";
UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = "PRT";
UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = "PRI";
UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = "GBR";
UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = "ESH";
UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = "CAF";
UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = "CZE";
UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = "COG";
UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = "COD";
UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = "DOM";
UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = "REU";
UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = "RWA";
UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = "ROU";
UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = "RUS";
UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = "WSM";
UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = "ASM";
UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = "BLM";
UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = "KNA";
UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = "SMR";
UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = "MAF";
UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = "SPM";
UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = "VCT";
UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = "SHN";
UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = "LCA";
UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = "STP";
UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = "SEN";
UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = "SRB";
UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = "SYC";
UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = "SLE";
UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = "SGP";
UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = "SXM";
UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = "SYR";
UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = "SOM";
UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = "LKA";
UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = "SWZ";
UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = "ZAF";
UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = "SDN";
UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = "SSD";
UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = "SWE";
UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = "CHE";
UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = "SUR";
UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = "SJM";
UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = "THA";
UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = "TWN";
UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = "TZA";
UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = "TJK";
UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = "IOT";
UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = "ATF";
UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = "TLS";
UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = "TGO";
UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = "TKL";
UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = "TON";
UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = "TTO";
UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = "TUN";
UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = "TKM";
UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = "TUR";
UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = "TUV";
UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = "UKR";
UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = "UGA";
UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = "URY";
UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = "UZB";
UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = "VUT";
UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = "VAT";
UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = "VEN";
UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = "VNM";
UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = "WLF";
UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = "YEM";
UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = "DJI";
UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = "ZMB";
UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = "ZWE";
UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = 'AFG';
UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = 'ALA';
UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = 'ALB';
UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = 'DEU';
UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = 'AND';
UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = 'AGO';
UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = 'AIA';
UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = 'ATA';
UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = 'ATG';
UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = 'SAU';
UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = 'DZA';
UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = 'ARG';
UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = 'ARM';
UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = 'ABW';
UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = 'AUS';
UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = 'AUT';
UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = 'AZE';
UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = 'BHS';
UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = 'BGD';
UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = 'BRB';
UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = 'BHR';
UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = 'BEL';
UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = 'BLZ';
UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = 'BEN';
UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = 'BMU';
UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = 'BLR';
UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = 'BOL';
UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = 'BES';
UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = 'BIH';
UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = 'BWA';
UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = 'BRA';
UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = 'BRN';
UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = 'BGR';
UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = 'BFA';
UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = 'BDI';
UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = 'BTN';
UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = 'CPV';
UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = 'KHM';
UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = 'CMR';
UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = 'CAN';
UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = 'QAT';
UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = 'TCD';
UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = 'CHL';
UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = 'CHN';
UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = 'CYP';
UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = 'COL';
UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = 'COM';
UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = 'PRK';
UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = 'KOR';
UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = 'CIV';
UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = 'CRI';
UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = 'HRV';
UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = 'CUB';
UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = 'CUW';
UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = 'DNK';
UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = 'DMA';
UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = 'ECU';
UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = 'EGY';
UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = 'SLV';
UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = 'ARE';
UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = 'ERI';
UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = 'SVK';
UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = 'SVN';
UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = 'ESP';
UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = 'USA';
UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = 'EST';
UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = 'ETH';
UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = 'PHL';
UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = 'FIN';
UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = 'FJI';
UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = 'FRA';
UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = 'GAB';
UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = 'GMB';
UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = 'GEO';
UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = 'GHA';
UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = 'GIB';
UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = 'GRD';
UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = 'GRC';
UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = 'GRL';
UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = 'GLP';
UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = 'GUM';
UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = 'GTM';
UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = 'GUF';
UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = 'GGY';
UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = 'GIN';
UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = 'GNB';
UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = 'GNQ';
UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = 'GUY';
UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = 'HTI';
UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = 'HND';
UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = 'HKG';
UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = 'HUN';
UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = 'IND';
UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = 'IDN';
UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = 'IRQ';
UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = 'IRN';
UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = 'IRL';
UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = 'BVT';
UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = 'IMN';
UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = 'CXR';
UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = 'ISL';
UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = 'CYM';
UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = 'CCK';
UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = 'COK';
UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = 'FRO';
UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = 'SGS';
UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = 'HMD';
UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = 'FLK';
UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = 'MNP';
UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = 'MHL';
UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = 'PCN';
UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = 'SLB';
UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = 'TCA';
UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = 'UMI';
UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = 'VGB';
UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = 'VIR';
UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = 'ISR';
UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = 'ITA';
UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = 'JAM';
UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = 'JPN';
UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = 'JEY';
UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = 'JOR';
UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = 'KAZ';
UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = 'KEN';
UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = 'KGZ';
UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = 'KIR';
UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = 'KWT';
UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = 'LAO';
UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = 'LSO';
UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = 'LVA';
UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = 'LBN';
UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = 'LBR';
UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = 'LBY';
UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = 'LIE';
UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = 'LTU';
UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = 'LUX';
UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = 'MAC';
UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = 'MKD';
UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = 'MDG';
UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = 'MYS';
UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = 'MWI';
UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = 'MDV';
UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = 'MLI';
UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = 'MLT';
UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = 'MAR';
UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = 'MTQ';
UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = 'MUS';
UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = 'MRT';
UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = 'MYT';
UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = 'MEX';
UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = 'FSM';
UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = 'MDA';
UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = 'MCO';
UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = 'MNG';
UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = 'MNE';
UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = 'MSR';
UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = 'MOZ';
UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = 'MMR';
UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = 'NAM';
UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = 'NRU';
UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = 'NPL';
UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = 'NIC';
UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = 'NER';
UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = 'NGA';
UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = 'NIU';
UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = 'NFK';
UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = 'NOR';
UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = 'NCL';
UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = 'NZL';
UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = 'OMN';
UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = 'NLD';
UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = 'PAK';
UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = 'PLW';
UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = 'PSE';
UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = 'PAN';
UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = 'PNG';
UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = 'PRY';
UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = 'PER';
UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = 'PYF';
UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = 'POL';
UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = 'PRT';
UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = 'PRI';
UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = 'GBR';
UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = 'ESH';
UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = 'CAF';
UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = 'CZE';
UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = 'COG';
UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = 'COD';
UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = 'DOM';
UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = 'REU';
UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = 'RWA';
UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = 'ROU';
UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = 'RUS';
UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = 'WSM';
UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = 'ASM';
UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = 'BLM';
UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = 'KNA';
UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = 'SMR';
UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = 'MAF';
UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = 'SPM';
UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = 'VCT';
UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = 'SHN';
UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = 'LCA';
UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = 'STP';
UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = 'SEN';
UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = 'SRB';
UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = 'SYC';
UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = 'SLE';
UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = 'SGP';
UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = 'SXM';
UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = 'SYR';
UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = 'SOM';
UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = 'LKA';
UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = 'SWZ';
UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = 'ZAF';
UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = 'SDN';
UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = 'SSD';
UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = 'SWE';
UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = 'CHE';
UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = 'SUR';
UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = 'SJM';
UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = 'THA';
UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = 'TWN';
UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = 'TZA';
UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = 'TJK';
UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = 'IOT';
UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = 'ATF';
UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = 'TLS';
UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = 'TGO';
UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = 'TKL';
UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = 'TON';
UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = 'TTO';
UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = 'TUN';
UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = 'TKM';
UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = 'TUR';
UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = 'TUV';
UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = 'UKR';
UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = 'UGA';
UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = 'URY';
UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = 'UZB';
UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = 'VUT';
UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = 'VAT';
UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = 'VEN';
UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = 'VNM';
UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = 'WLF';
UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = 'YEM';
UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = 'DJI';
UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = 'ZMB';
UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = 'ZWE';

View File

@ -401,4 +401,6 @@ ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128);
ALTER TABLE llx_projet ADD COLUMN extraparams varchar(255);
DELETE FROM llx_const WHERE name = 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST';

Some files were not shown because too many files have changed in this diff Show More