diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 3cffed355fa..67b4b346b6c 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -18,9 +18,10 @@ filter:
- dev/*
- doc/*
- documents/*
- - htdocs/includes/*
- node_modules/*
- test/*
+ dependency_paths:
+ - htdocs/includes/*
paths:
- htdocs/*
- scripts/*
diff --git a/ChangeLog b/ChangeLog
index f4945b44df0..37957f61c1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ For users:
NEW: PHP 8.1 compatibility
NEW: Support for recurring purchase invoices.
NEW: #20292 Include German public holidays
+NEW: Can show ZATCA QRCode on PDFs
NEW: #17123 added ExtraFields for Stock Mouvement
NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties
NEW: #20653 edit discount pourcentage for all lines in one shot
@@ -405,8 +406,9 @@ NEW: Increase size of params of actions for emailcollector
NEW: Invoice list - Use complete country select field with EEC or not
NEW: mass action delete, no more break if at least one object has child
NEW: mass action paid on customer invoice list
-NEW: massaction validate on supplier orders list
-NEW: Mass action send email to all attendees of an event.
+NEW: mass action validate on supplier orders list
+NEW: mass action send email to all attendees of an event
+NEW: mass action to switch status on sale / on purchase of a product
NEW: expense reports: conf to pre-fill start/end dates with bounds of current month
NEW: Option "Add a link on the PDF to make the online payment"
NEW: More options to generate PDF (show Frame option, width of picture option)
@@ -427,7 +429,7 @@ NEW: when multiple order linked to facture, show list into note.
NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted
NEW: Editing a page in website module keep old page with name .back
NEW: External backups can be downloaded from the "About info page".
-NEW: Add massaction to switch status on sale / on purchase of a product.
+
Modules
@@ -435,36 +437,49 @@ NEW: Stable module Knowledge Management
NEW: Experimental module Event Organization Management
NEW: Experimental module Workstations Management
NEW: Development of module Partnership Management
+OLD: module SimplePOS has been completely removed -> use TakePOS
For developers:
---------------
+API:
+NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
+NEW: add API /approve and /makeOrder for purchase orders
+NEW: API for knowledgemanagement
+NEW: API get list of legal form of business
+NEW: API list of staff units
+NEW: Hidden option API_DISABLE_COMPRESSION is now visible in API setup page.
+
+Hook:
+NEW: add hook 'beforeBodyClose'
+NEW: add hook 'hookGetEntity'
+NEW: add hook 'menuLeftMenuItems' to filter the leftmenu items
+NEW: add hook 'printUnderHeaderPDFline' on invoice PDF templates (can be used for example to add a barcode or more information on header of invoices).
+NEW: add hookmanager on note pages
+NEW: hook after rank update
+NEW: 'printFieldListFrom' hook call on several lists
+
+ModuleBuilder:
+NEW: add the property "copytoclipboard" in modulebuilder
+NEW: Use lang selector when using a field key 'lang' in modulebuilder
+
+Options:
+NEW: add options MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
+
+Trigger:
+NEW: add action trigger for member excluded
+
+
NEW: Introduce method hasRight
NEW: Can use textarea field into a confirm popup.
NEW: Can use the result_mode of mysqli driver. Save memory for list count
-NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
-NEW: Add API /approve and /makeOrder for purchase orders.
-NEW: add action trigger for member excluded
-NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
-NEW: Add code codebar column on serial/lot structure
-NEW: Add date_valid and date_approve columns in the list of supplier orders
-NEW: add hook `beforeBodyClose`
-NEW: Add hook hookGetEntity.
-NEW: add hookmanager on note pages
-NEW: add hook 'menuLeftMenuItems' to filter the leftmenu items
-NEW: Add the property "copytoclipboard" in modulebuilder
-NEW: api for knowledgemanagement
-NEW: API get list of legal form of business
-NEW: API list of staff units
-NEW: hook after rank update
-NEW: printFieldListFrom hook call on several lists
-NEW: Use lang selector when using a field key 'lang' in modulebuilder
+NEW: add code codebar column on serial/lot structure
+NEW: add date_valid and date_approve columns in the list of supplier orders
NEW: we need to be able to put more filters on deleteByParentField() function
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
NEW: Experimental feature to manage user sessions in database
-NEW: Hidden option API_DISABLE_COMPRESSION is now visible in API setup page.
-NEW: Add hook printUnderHeaderPDFline on invoice PDF templates (can be used for example to add a barcode or more information on header of invoices).
+
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
@@ -1321,7 +1336,6 @@ NEW: introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM
NEW: introducing new modal boxes in TakePOS
NEW: keep TakePOS terminal when login/logout
NEW: link on balance to the ledger
-NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view
NEW: more filter for "View change logs"
diff --git a/README.md b/README.md
index 5559613eaa2..c476f14a8cc 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
-- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_DoliWamp)
+- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp))
- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian)
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia
diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php
index 6d7d92ce22b..583b12368dc 100644
--- a/htdocs/accountancy/admin/defaultaccounts.php
+++ b/htdocs/accountancy/admin/defaultaccounts.php
@@ -81,22 +81,22 @@ $list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
-if ($conf->banque->enabled) {
+if (!empty($conf->banque->enabled)) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
}
-if ($conf->don->enabled) {
+if (!empty($conf->don->enabled)) {
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
}
-if ($conf->adherent->enabled) {
+if (!empty($conf->adherent->enabled)) {
$list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
}
-if ($conf->loan->enabled) {
+if (!empty($conf->loan->enabled)) {
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
}
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
-if ($conf->societe->enabled) {
+if (!empty($conf->societe->enabled)) {
$list_account[] = '---Deposits---';
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
}
@@ -246,7 +246,7 @@ foreach ($list_account as $key) {
}
}
-if ($conf->societe->enabled) {
+if (!empty($conf->societe->enabled)) {
print '
'.$langs->trans("VATToUseForSubscriptions").' ';
if (!empty($conf->banque->enabled)) {
print '';
diff --git a/htdocs/adherents/admin/member_extrafields.php b/htdocs/adherents/admin/member_extrafields.php
index 7f5262bc7c6..210e6213d6f 100644
--- a/htdocs/adherents/admin/member_extrafields.php
+++ b/htdocs/adherents/admin/member_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/adherents/admin/member_type_extrafields.php b/htdocs/adherents/admin/member_type_extrafields.php
index 68916df624f..c643d6e15d4 100644
--- a/htdocs/adherents/admin/member_type_extrafields.php
+++ b/htdocs/adherents/admin/member_type_extrafields.php
@@ -87,7 +87,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index f73ff9bf451..3f857ce827b 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -122,12 +122,10 @@ class AdherentType extends CommonObject
public $members = array();
/** @var string string other */
- public $other;
+ public $other = array();
public $multilangs = array();
- public $other = array();
-
/**
* Constructor
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 72f75cdf4c8..8bf7f7af6a6 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -1,7 +1,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo
- * Copyright (C) 2004-2016 Laurent Destailleur
+ * Copyright (C) 2004-2022 Laurent Destailleur
* Copyright (C) 2013-2015 Raphaël Doursenaud
* Copyright (C) 2014-2016 Juanjo Menent
* Copyright (C) 2018 Alexandre Spangaro
@@ -63,6 +63,7 @@ $search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
+$search_import_key = trim(GETPOST("search_import_key", "alpha"));
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int');
@@ -156,7 +157,8 @@ $arrayfields = array(
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'd.birth'=>array('label'=>$langs->trans("Birthday"), 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
- 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
+ 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
+ 'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@@ -213,6 +215,7 @@ if (empty($reshook)) {
$search_categ = "";
$search_filter = "";
$search_status = "";
+ $search_import_key = '';
$catid = "";
$sall = "";
$toselect = array();
@@ -318,7 +321,7 @@ $sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
-$sql .= " d.note_private, d.note_public,";
+$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,";
@@ -427,6 +430,9 @@ if ($search_phone_mobile) {
if ($search_country) {
$sql .= " AND d.country IN (".$db->sanitize($search_country).')';
}
+if ($search_import_key) {
+ $sql .= natural_search("d.import_key", $search_import_key);
+}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -436,8 +442,6 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
-$sql .= $db->order($sortfield, $sortorder);
-
// Count total nb of records with no order and no limits
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@@ -447,15 +451,20 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} else {
dol_print_error($db);
}
+
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
+ $db->free($resql);
+}
+
+// Complete request and execute it with limit
+$sql .= $db->order($sortfield, $sortorder);
+if ($limit) {
+ $sql .= $db->plimit($limit + 1, $offset);
}
-// Add limit
-$sql .= $db->plimit($limit + 1, $offset);
-dol_syslog("get list", LOG_DEBUG);
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
@@ -464,6 +473,7 @@ if (!$resql) {
$num = $db->num_rows($resql);
+
$arrayofselected = is_array($toselect) ? $toselect : array();
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
@@ -473,7 +483,8 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit;
}
-llxHeader('', $title, 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
+$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
+llxHeader('', $title, $help_url);
if (GETPOSTISSET("search_status")) {
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
@@ -577,6 +588,9 @@ if ($search_filter && $search_filter != '-1') {
if ($search_status != "" && $search_status != -3) {
$param .= "&search_status=".urlencode($search_status);
}
+if ($search_import_key != '') {
+ $param .= '&search_import_key='.urlencode($search_import_key);
+}
if ($search_type > 0) {
$param .= "&search_type=".urlencode($search_type);
}
@@ -603,7 +617,7 @@ if ($user->rights->societe->creer) {
if ($user->rights->adherent->creer && $user->rights->user->user->creer) {
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
}
-if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@@ -669,7 +683,6 @@ if ($massactionbutton) {
print '';
print '
'."\n";
-
// Line for filters fields
print '';
@@ -807,15 +820,24 @@ if (!empty($arrayfields['d.statut']['checked'])) {
print $form->selectarray('search_status', $liststatus, $search_status, -3);
print '';
}
-// Action column
-print '';
-$searchpicto = $form->showFilterButtons();
-print $searchpicto;
-print ' ';
-
+if (!empty($arrayfields['d.import_key']['checked'])) {
+ print '';
+ print ' ';
+ print ' ';
+}
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ // Action column
+ print '';
+ $searchpicto = $form->showFilterButtons();
+ print $searchpicto;
+ print ' ';
+}
print " \n";
print '';
+if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
+}
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder);
}
@@ -895,7 +917,12 @@ if (!empty($arrayfields['d.tms']['checked'])) {
if (!empty($arrayfields['d.statut']['checked'])) {
print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder);
}
-print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
+if (!empty($arrayfields['d.import_key']['checked'])) {
+ print_liste_field_titre($arrayfields['d.import_key']['label'], $_SERVER["PHP_SELF"], "d.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
+}
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
+}
print " \n";
$i = 0;
@@ -936,7 +963,7 @@ while ($i < min($num, $limit)) {
print '';
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
- print ''.$obj->rowid.' ';
+ print ''.$obj->rowid.' ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1172,21 +1199,31 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
- // Action column
- print '';
- 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($obj->rowid, $arrayofselected)) {
- $selected = 1;
+ if (!empty($arrayfields['d.import_key']['checked'])) {
+ print ' ';
+ print dol_escape_htmltag($obj->import_key);
+ print " \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
}
- print ' ';
}
- print '';
+ // Action column
+ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print '';
+ 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($obj->rowid, $arrayofselected)) {
+ $selected = 1;
+ }
+ print ' ';
+ }
+ print ' ';
+ }
if (!$i) {
$totalarray['nbfield']++;
}
- print " \n";
+ print ''."\n";
$i++;
}
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 7dccaa90eda..1cfbb80f65b 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -1067,12 +1067,12 @@ if ($rowid > 0) {
// Bank account
print ''.$langs->trans("FinancialAccount").' ';
print img_picto('', 'bank_account');
- $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
+ $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200');
print " \n";
// Payment mode
print ''.$langs->trans("PaymentMode").' ';
- $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
+ $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200');
print " \n";
// Date of payment
diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php
index d96adbc3b82..6056e1320f0 100644
--- a/htdocs/adherents/subscription/list.php
+++ b/htdocs/adherents/subscription/list.php
@@ -628,10 +628,10 @@ while ($i < min($num, $limit)) {
print '';
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($obj->rowid, $arrayofselected)) {
+ if (in_array($obj->crowid, $arrayofselected)) {
$selected = 1;
}
- print ' ';
+ print ' ';
}
print ' ';
if (!$i) {
diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php
index 50e4a3e92c7..13f8ad246a0 100644
--- a/htdocs/admin/agenda_extrafields.php
+++ b/htdocs/admin/agenda_extrafields.php
@@ -89,7 +89,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php
index e1e468b0cec..ef365881feb 100644
--- a/htdocs/admin/bank.php
+++ b/htdocs/admin/bank.php
@@ -53,8 +53,6 @@ $type = 'bankaccount';
// Order display of bank account
if ($action == 'setbankorder') {
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) {
- header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
} else {
dol_print_error($db);
}
@@ -63,15 +61,11 @@ if ($action == 'setbankorder') {
// Auto report last num releve on conciliate
if ($action == 'setreportlastnumreleve') {
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0, '', $conf->entity) > 0) {
- header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
} else {
dol_print_error($db);
}
} elseif ($action == 'unsetreportlastnumreleve') {
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0, '', $conf->entity) > 0) {
- header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
} else {
dol_print_error($db);
}
@@ -80,15 +74,11 @@ if ($action == 'setreportlastnumreleve') {
// Colorize movements
if ($action == 'setbankcolorizemovement') {
if (dolibarr_set_const($db, "BANK_COLORIZE_MOVEMENT", 1, 'chaine', 0, '', $conf->entity) > 0) {
- header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
} else {
dol_print_error($db);
}
} elseif ($action == 'unsetbankcolorizemovement') {
if (dolibarr_set_const($db, "BANK_COLORIZE_MOVEMENT", 0, 'chaine', 0, '', $conf->entity) > 0) {
- header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
} else {
dol_print_error($db);
}
@@ -427,13 +417,13 @@ print "";
// Active
if ($conf->global->BANK_COLORIZE_MOVEMENT) {
print ''."\n";
- print '';
+ print ' ';
print img_picto($langs->trans("Enabled"), 'switch_on');
print ' ';
print ' ';
} else {
print ''."\n";
- print ''.img_picto($langs->trans("Disabled"), 'switch_off').' ';
+ print ''.img_picto($langs->trans("Disabled"), 'switch_off').' ';
print " ";
}
@@ -483,13 +473,13 @@ print '';
// Active
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
print ''."\n";
- print '';
+ print ' ';
print img_picto($langs->trans("Enabled"), 'switch_on');
print ' ';
print ' ';
} else {
print ''."\n";
- print ''.img_picto($langs->trans("Disabled"), 'switch_off').' ';
+ print ''.img_picto($langs->trans("Disabled"), 'switch_off').' ';
print " ";
}
diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php
index 35fd9f5271f..1382ef49983 100644
--- a/htdocs/admin/bank_extrafields.php
+++ b/htdocs/admin/bank_extrafields.php
@@ -85,7 +85,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php
index e3adb206d7e..dc56d3ae79f 100644
--- a/htdocs/admin/bom.php
+++ b/htdocs/admin/bom.php
@@ -93,7 +93,7 @@ if ($action == 'updateMask') {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf");
return;
} else {
- setEventMessages($module->error, null, 'errors');
+ setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
@@ -176,7 +176,7 @@ $head = bomAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans("BOMs"), -1, 'bom');
/*
- * BOMs Numbering model
+ * Numbering module
*/
print load_fiche_titre($langs->trans("BOMsNumberingModules"), '', '');
@@ -202,10 +202,11 @@ foreach ($dirmodels as $reldir) {
while (($file = readdir($handle)) !== false) {
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
$file = substr($file, 0, dol_strlen($file) - 4);
+ $classname = $file;
require_once $dir.$file.'.php';
- $module = new $file($db);
+ $module = new $classname($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
@@ -220,7 +221,7 @@ foreach ($dirmodels as $reldir) {
print $module->info();
print '';
- // Show example of numbering model
+ // Show example of numbering module
print '';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
@@ -277,13 +278,13 @@ foreach ($dirmodels as $reldir) {
}
print "
";
print "
";
-print " \n";
/*
* Document templates generators
*/
+print " \n";
print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
// Load array def with activated templates
@@ -307,8 +308,8 @@ if ($resql) {
print '';
-print "
\n";
-print "\n";
+print '';
+print '';
print ''.$langs->trans("Name").' ';
print ''.$langs->trans("Description").' ';
print ''.$langs->trans("Status")." \n";
@@ -364,13 +365,13 @@ foreach ($dirmodels as $reldir) {
// Active
if (in_array($name, $def)) {
print ''."\n";
- print '';
+ print ' ';
print img_picto($langs->trans("Enabled"), 'switch_on');
print ' ';
print ' ';
} else {
print ''."\n";
- print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').' ';
+ print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').' ';
print " ";
}
@@ -379,7 +380,7 @@ foreach ($dirmodels as $reldir) {
if ($conf->global->BOM_ADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
- print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').' ';
+ print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').' ';
}
print '';
@@ -421,12 +422,12 @@ foreach ($dirmodels as $reldir) {
print '
';
print '';
-print " ";
/*
* Other options
*/
+print " ";
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '';
diff --git a/htdocs/admin/bom_extrafields.php b/htdocs/admin/bom_extrafields.php
index 74d6ca931ec..c8ebafd4be8 100644
--- a/htdocs/admin/bom_extrafields.php
+++ b/htdocs/admin/bom_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '
";
}
diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php
index 6c3a6f30646..1bc5f67239e 100644
--- a/htdocs/admin/boxes.php
+++ b/htdocs/admin/boxes.php
@@ -229,6 +229,7 @@ $sql .= " WHERE b.box_id = bd.rowid";
$sql .= " AND b.entity IN (0,".$conf->entity.")";
$sql .= " AND b.fk_user=0";
$sql .= " ORDER by b.position, b.box_order";
+//print $sql;
dol_syslog("Search available boxes", LOG_DEBUG);
$resql = $db->query($sql);
diff --git a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php
index ac8f4fced4d..cf887b6b454 100644
--- a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php
+++ b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php
@@ -94,7 +94,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '
";
}
diff --git a/htdocs/admin/delivery_extrafields.php b/htdocs/admin/delivery_extrafields.php
index cf712bc6ecf..fa1aa809944 100644
--- a/htdocs/admin/delivery_extrafields.php
+++ b/htdocs/admin/delivery_extrafields.php
@@ -91,7 +91,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '
";
}
diff --git a/htdocs/admin/deliverydet_extrafields.php b/htdocs/admin/deliverydet_extrafields.php
index c74f5235d42..6fbfbb58884 100644
--- a/htdocs/admin/deliverydet_extrafields.php
+++ b/htdocs/admin/deliverydet_extrafields.php
@@ -92,7 +92,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '
";
}
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 2ac4fa76682..8fd4feffcf4 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -585,6 +585,10 @@ complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqls
$i = 0;
foreach ($tabcomplete as $key => $value) {
$i++;
+ // When a dictionnary is commented
+ if (!isset($tabcond[$i])) {
+ continue;
+ }
$tabcomplete[$key]['id'] = $i;
$tabcomplete[$key]['cond'] = $tabcond[$i];
$tabcomplete[$key]['rowid'] = $tabrowid[$i];
@@ -607,7 +611,7 @@ if (empty($sortfield)) {
$tmp1 = explode(',', empty($tabcomplete[$keytable]['sqlsort']) ? '' : $tabcomplete[$keytable]['sqlsort']);
$tmp2 = explode(' ', $tmp1[0]);
$sortfield = preg_replace('/^.*\./', '', $tmp2[0]);
- $sortorder = $tmp2[1];
+ $sortorder = (!empty($tmp2[1]) ? $tmp2[1] : '');
//var_dump($sortfield);var_dump($sortorder);
}
@@ -842,12 +846,15 @@ if (empty($reshook)) {
$_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', GETPOST("code"));
}
+ $tablename = $tabname[$id];
+ $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename);
+
// If check ok and action add, add the line
if ($ok && GETPOST('actionadd')) {
if ($tabrowid[$id]) {
// Get free id for insert
$newid = 0;
- $sql = "SELECT MAX(".$tabrowid[$id].") as newid FROM ".MAIN_DB_PREFIX.$tabname[$id];
+ $sql = "SELECT MAX(".$tabrowid[$id].") as newid FROM ".MAIN_DB_PREFIX.$tablename;
$result = $db->query($sql);
if ($result) {
$obj = $db->fetch_object($result);
@@ -858,7 +865,7 @@ if (empty($reshook)) {
}
// Add new entry
- $sql = "INSERT INTO ".MAIN_DB_PREFIX.$tabname[$id]." (";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$tablename." (";
// List of fields
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
$sql .= $tabrowid[$id].",";
@@ -883,7 +890,7 @@ if (empty($reshook)) {
} elseif ($value == 'taux' || $value == 'localtax1') {
$_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z
} elseif ($value == 'entity') {
- $_POST[$keycode] = getEntity($tabname[$id]);
+ $_POST[$keycode] = getEntity($tablename);
}
if ($i) {
@@ -934,7 +941,7 @@ if (empty($reshook)) {
}
// Modify entry
- $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET ";
// Modifie valeur des champs
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
$sql .= $tabrowid[$id]."=";
@@ -952,7 +959,7 @@ if (empty($reshook)) {
} elseif ($field == 'taux' || $field == 'localtax1') {
$_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z
} elseif ($field == 'entity') {
- $_POST[$keycode] = getEntity($tabname[$id]);
+ $_POST[$keycode] = getEntity($tablename);
}
if ($i) {
@@ -979,7 +986,7 @@ if (empty($reshook)) {
$sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
}
if (in_array('entity', $listfieldmodify)) {
- $sql .= " AND entity = ".((int) getEntity($tabname[$id], 0));
+ $sql .= " AND entity = ".((int) getEntity($tablename, 0));
}
dol_syslog("actionmodify", LOG_DEBUG);
@@ -998,7 +1005,10 @@ if (empty($reshook)) {
$rowidcol = "rowid";
}
- $sql = "DELETE FROM ".MAIN_DB_PREFIX.$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
+ $tablename = $tabname[$id];
+ $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename);
+
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX.$tablename." WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
@@ -1486,11 +1496,13 @@ if ($id > 0) {
}
if ($valuetoshow != '') {
+ $tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : '');
+
$tdsoffields .= '
';
- if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
- $tdsoffields .= ''.$valuetoshow.' '.img_help(1, $valuetoshow).' ';
- } elseif (!empty($tabhelp[$id][$value])) {
- $tdsoffields .= $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
+ if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) {
+ $tdsoffields .= ''.$valuetoshow.' '.img_help(1, $valuetoshow).' ';
+ } elseif ($tooltiphelp) {
+ $tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
} else {
$tdsoffields .= $valuetoshow;
}
@@ -1639,8 +1651,8 @@ if ($id > 0) {
continue;
}
- if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabhelp[$id][$value])) {
- $tabhelp[$id][$value] = $langs->trans('LabelUsedByDefault');
+ if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabcomplete[$tabname[$id]]['help'][$value])) {
+ $tabcomplete[$tabname[$id]]['help'][$value] = $langs->trans('LabelUsedByDefault');
}
// Determines the name of the field in relation to the possible names
@@ -1846,10 +1858,12 @@ if ($id > 0) {
// Show field title
if ($showfield) {
- if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
- $newvaluetoshow = ''.$valuetoshow.' '.img_help(1, $valuetoshow).' ';
- } elseif (!empty($tabhelp[$id][$value])) {
- $newvaluetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
+ $tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : '');
+
+ if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) {
+ $newvaluetoshow = ''.$valuetoshow.' '.img_help(1, $valuetoshow).' ';
+ } elseif ($tooltiphelp) {
+ $newvaluetoshow = $form->textwithpicto($valuetoshow, $tooltiphelp);
} else {
$newvaluetoshow = $valuetoshow;
}
diff --git a/htdocs/admin/ecm_directories_extrafields.php b/htdocs/admin/ecm_directories_extrafields.php
index d913826b245..ea75c5ea0fc 100644
--- a/htdocs/admin/ecm_directories_extrafields.php
+++ b/htdocs/admin/ecm_directories_extrafields.php
@@ -91,7 +91,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/ecm_files_extrafields.php b/htdocs/admin/ecm_files_extrafields.php
index b260eff55fa..41a0d714eb9 100644
--- a/htdocs/admin/ecm_files_extrafields.php
+++ b/htdocs/admin/ecm_files_extrafields.php
@@ -91,7 +91,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index d01b160ca31..4f3cf10e77b 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2022 Charlene Benke
*
* 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
@@ -359,47 +360,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$linkback = ''.$langs->trans("BackToList").' ';
$morehtmlref = '';
- /*
- // Ref bis
- $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->emailcollector->creer, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->emailcollector->creer, 'string', '', null, null, '', 1);
- // Thirdparty
- $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
- // Project
- if (! empty($conf->projet->enabled))
- {
- $langs->load("projects");
- $morehtmlref.='
'.$langs->trans('Project') . ' ';
- if ($user->rights->emailcollector->creer)
- {
- if ($action != 'classify')
- {
- $morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='
';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
- }
- } else {
- if (! empty($object->fk_project)) {
- $proj = new Project($db);
- $proj->fetch($object->fk_project);
- $morehtmlref.='
';
- $morehtmlref.=$proj->ref;
- $morehtmlref.=' ';
- } else {
- $morehtmlref.='';
- }
- }
- }
- */
$morehtmlref .= '
';
$morehtml = $langs->trans("NbOfEmailsInInbox").' : ';
@@ -561,7 +521,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$rulefilterobj->fetch($rulefilter['id']);
print '';
- print '';
+ print ' ';
print $langs->trans($arrayoftypes[$rulefilter['type']]['label']);
print ' ';
print ''.$rulefilter['rulevalue'].' ';
@@ -583,24 +543,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
print ''.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).' ';
print ' ';
- // Add operation
- print '';
- print '';
+
$arrayoftypes = array(
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'recordjoinpiece'=>'AttachJoinedDocumentsToObject',
'recordevent'=>'RecordEvent');
$arrayoftypesnocondition = $arrayoftypes;
- if ($conf->projet->enabled) {
+ if (!empty($conf->projet->enabled)) {
$arrayoftypes['project'] = 'CreateLeadAndThirdParty';
}
$arrayoftypesnocondition['project'] = 'CreateLeadAndThirdParty';
- if ($conf->ticket->enabled) {
+ if (!empty($conf->ticket->enabled)) {
$arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
}
$arrayoftypesnocondition['ticket'] = 'CreateTicketAndThirdParty';
- if ($conf->recruitment->enabled) {
+ if (!empty($conf->recruitment->enabled)) {
$arrayoftypes['candidature'] = 'CreateCandidature';
}
$arrayoftypesnocondition['candidature'] = 'CreateCandidature';
@@ -617,6 +575,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
+ // Add operation
+ print ' ';
+ print '';
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1);
print ' ';
print ' ';
@@ -637,7 +598,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$ruleactionobj->fetch($ruleaction['id']);
print ' ';
- print '';
+ print ' ';
print '';
if (array_key_exists($ruleaction['type'], $arrayoftypes)) {
print $langs->trans($arrayoftypes[$ruleaction['type']]);
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 35c483f33e6..f1cf4ca6385 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -205,7 +205,7 @@ $form = new Form($db);
$now = dol_now();
$help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
-$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailCollector"));
+$title = $langs->trans('EmailCollectors');
$morejs = array();
$morecss = array();
diff --git a/htdocs/admin/eventorganization_confbooth_extrafields.php b/htdocs/admin/eventorganization_confbooth_extrafields.php
index 991ed3f824a..f17a2cf91e1 100644
--- a/htdocs/admin/eventorganization_confbooth_extrafields.php
+++ b/htdocs/admin/eventorganization_confbooth_extrafields.php
@@ -81,7 +81,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/eventorganization_confboothattendee_extrafields.php b/htdocs/admin/eventorganization_confboothattendee_extrafields.php
index 0b50c483d69..552e814f8de 100644
--- a/htdocs/admin/eventorganization_confboothattendee_extrafields.php
+++ b/htdocs/admin/eventorganization_confboothattendee_extrafields.php
@@ -85,7 +85,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php
index b76ee35b76c..948efb6188a 100644
--- a/htdocs/admin/expedition_extrafields.php
+++ b/htdocs/admin/expedition_extrafields.php
@@ -91,7 +91,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php
index 4f807ee9da3..41fba691b7f 100644
--- a/htdocs/admin/expeditiondet_extrafields.php
+++ b/htdocs/admin/expeditiondet_extrafields.php
@@ -92,7 +92,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php
index 25771ef63d0..54ce5a9ffea 100644
--- a/htdocs/admin/expensereport_extrafields.php
+++ b/htdocs/admin/expensereport_extrafields.php
@@ -85,7 +85,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/holiday_extrafields.php b/htdocs/admin/holiday_extrafields.php
index 609187058e3..0ef1998d9e7 100644
--- a/htdocs/admin/holiday_extrafields.php
+++ b/htdocs/admin/holiday_extrafields.php
@@ -85,7 +85,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php
index 5605fa4fb63..aedd91a34eb 100644
--- a/htdocs/admin/ihm.php
+++ b/htdocs/admin/ihm.php
@@ -76,7 +76,7 @@ if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
}
if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
- dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$logofile = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
@@ -100,10 +100,16 @@ if ($action == 'update') {
if ($mode == 'template') {
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
- /*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
- if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
- else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/
+ if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
+ $val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
+ if (!$val) {
+ dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
+ } else {
+ dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
+ }
+ }
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
if ($val == '') {
@@ -222,7 +228,7 @@ if ($action == 'update') {
if ($mode == 'other') {
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
diff --git a/htdocs/admin/knowledgerecord_extrafields.php b/htdocs/admin/knowledgerecord_extrafields.php
index d6c94e4ceeb..62580d585c3 100644
--- a/htdocs/admin/knowledgerecord_extrafields.php
+++ b/htdocs/admin/knowledgerecord_extrafields.php
@@ -88,7 +88,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index d96e0706223..abc434ed58f 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -57,6 +57,7 @@ $langs->loadLangs($langsArray);
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
+$mode = GETPOST('mode', 'aZ09');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'alpha');
@@ -619,15 +620,17 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
-foreach ($search as $key => $val) {
- if (is_array($search[$key]) && count($search[$key])) {
- foreach ($search[$key] as $skey) {
- if ($skey != '') {
- $param .= '&search_'.$key.'[]='.urlencode($skey);
+if (!empty($search) && is_array($search)) {
+ foreach ($search as $key => $val) {
+ if (is_array($search[$key]) && count($search[$key])) {
+ foreach ($search[$key] as $skey) {
+ if ($skey != '') {
+ $param .= '&search_'.$key.'[]='.urlencode($skey);
+ }
}
+ } elseif ($search[$key] != '') {
+ $param .= '&search_'.$key.'='.urlencode($search[$key]);
}
- } elseif ($search[$key] != '') {
- $param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
if ($optioncss != '') {
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index dbf4ca53686..0db1b26dc7d 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -528,8 +528,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '';
//$moreforfilter .= ''.$moreinfo.' '.$moreinfo2.'
';
diff --git a/htdocs/admin/mrp_extrafields.php b/htdocs/admin/mrp_extrafields.php
index d3c03056fef..768ec487165 100644
--- a/htdocs/admin/mrp_extrafields.php
+++ b/htdocs/admin/mrp_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php
index e11ac077cc6..b66f004295d 100644
--- a/htdocs/admin/order_extrafields.php
+++ b/htdocs/admin/order_extrafields.php
@@ -88,7 +88,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php
index c89ff3e3655..3f8102d076a 100644
--- a/htdocs/admin/orderdet_extrafields.php
+++ b/htdocs/admin/orderdet_extrafields.php
@@ -89,7 +89,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php
index 1e015d69f9c..8729fce71d3 100644
--- a/htdocs/admin/pdf.php
+++ b/htdocs/admin/pdf.php
@@ -4,7 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2012-2107 Juanjo Menent
* Copyright (C) 2019 Ferran Marcet
- * Copyright (C) 2021 Anthony Berton
+ * Copyright (C) 2021-2022 Anthony Berton
*
* 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
@@ -166,6 +166,10 @@ if ($action == 'update') {
dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
}
+ if (GETPOSTISSET('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) {
+ dolibarr_set_const($db, "PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", GETPOST('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME', 'alpha'), 'chaine', 0, '', $conf->entity);
+ }
+
if (GETPOSTISSET('PDF_USE_A')) {
dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity);
}
@@ -564,6 +568,16 @@ print ''.$langs->trans("ShowDetailsInPDFPageFoot").' selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0));
print ' ';
+// Show alias in thirdparty name
+
+/* Disabled because not yet completely implemented (does not work when we force a contact on object)
+print ''.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").' ';
+if ($conf->use_javascript_ajax) {
+ $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY"));
+ print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME'));
+}
+*/
+
// Show online payment link on invoices
print ' '.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").' ';
diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php
index 72acf7fbf4f..5a51535e04d 100644
--- a/htdocs/admin/pdf_other.php
+++ b/htdocs/admin/pdf_other.php
@@ -60,6 +60,9 @@ if ($action == 'update') {
if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
}
+ if (GETPOSTISSET('INVOICE_ADD_ZATCA_QR_CODE')) {
+ dolibarr_set_const($db, "INVOICE_ADD_ZATCA_QR_CODE", GETPOST("INVOICE_ADD_ZATCA_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
+ }
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@@ -90,19 +93,19 @@ $tooltiptext = '';
print ''.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)." \n";
print " \n";
+print '\n";
- ?>
-
-
- id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
- print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes');
+ print load_fiche_titre($langs->trans("BOMNetNeeds"), $viewlink, '');
/*
* Lines
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index fb7fd68e13a..598c4c73945 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -820,13 +820,6 @@ class BOM extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('bomdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -958,8 +951,8 @@ class BOM extends CommonObject
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.((int) $this->id)));
if (is_numeric($result)) {
- $this->error = $this->error;
- $this->errors = $this->errors;
+ $this->error = $objectline->error;
+ $this->errors = $objectline->errors;
return $result;
} else {
$this->lines = $result;
@@ -1301,6 +1294,7 @@ class BOMLine extends CommonObjectLine
*/
public $childBom = array();
+
/**
* Constructor
*
@@ -1514,13 +1508,6 @@ class BOMLine extends CommonObjectLine
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('bomlinedao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php
index 954959d5d7a..94debfbee7b 100644
--- a/htdocs/bom/lib/bom.lib.php
+++ b/htdocs/bom/lib/bom.lib.php
@@ -136,3 +136,55 @@ function bomPrepareHead($object)
return $head;
}
+
+/**
+ * Manage collapse bom display
+ *
+ * @return void
+ */
+function mrpCollapseBomManagement()
+{
+ ?>
+
+
+
+ ';
- print "".$langs->trans("NewAttribute")." ";
+ print ''.$langs->trans("NewAttribute").' ';
print "";
}
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index c1d5d241340..05b1822f45f 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
/**
@@ -113,7 +114,7 @@ class Categorie extends CommonObject
*
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_CAT_FK = array(
+ public $MAP_CAT_FK = array(
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
@@ -125,7 +126,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_CAT_TABLE = array(
+ public $MAP_CAT_TABLE = array(
'customer' => 'societe',
'supplier' => 'fournisseur',
'bank_account'=> 'account',
@@ -136,7 +137,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_OBJ_CLASS = array(
+ public $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
@@ -178,7 +179,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_OBJ_TABLE = array(
+ public static $MAP_OBJ_TABLE = array(
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
@@ -825,7 +826,7 @@ class Categorie extends CommonObject
/**
* Return list of fetched instance of elements having this category
*
- * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member', ...)
+ * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member', 'knowledge_management' ...)
* @param int $onlyids Return only ids of objects (consume less memory)
* @param int $limit Limit
* @param int $offset Offset
@@ -919,7 +920,7 @@ class Categorie extends CommonObject
$categories = array();
- $type = checkVal($type, 'aZ09');
+ $type = sanitizeVal($type, 'aZ09');
$sub_type = $type;
$subcol_name = "fk_".$type;
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 737ff059eee..b1ae9dee61b 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1185,7 +1185,7 @@ if ($action == 'create') {
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print ' ';
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
// Categories
print ''.$langs->trans("Categories").' ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
@@ -1201,7 +1201,7 @@ if ($action == 'create') {
print '';
- if ($conf->societe->enabled) {
+ if (!empty($conf->societe->enabled)) {
// Related company
print ''.$langs->trans("ActionOnCompany").' ';
if (GETPOST('socid', 'int') > 0) {
@@ -1241,7 +1241,7 @@ if ($action == 'create') {
print ' '.$langs->trans("Project").' ';
print img_picto('', 'project', 'class="pictofixedwidth"');
- print $formproject->select_projects((empty($societe->id) ? '' : $societe->id), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
+ print $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
print ' ';
print ' ';
@@ -1693,7 +1693,7 @@ if ($id > 0) {
print ' ';
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print ''.$langs->trans("Categories").' ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@@ -1714,7 +1714,7 @@ if ($id > 0) {
print '';
- if ($conf->societe->enabled) {
+ if (!empty($conf->societe->enabled)) {
// Related company
print ''.$langs->trans("ActionOnCompany").' ';
print '';
@@ -1912,7 +1912,7 @@ if ($id > 0) {
$linkback = '';
// Link to other agenda views
$linkback .= '';
- $linkback .= img_picto($langs->trans("BackToList"), 'object_list', 'class="pictoactionview pictofixedwidth"');
+ $linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
$linkback .= ''.$langs->trans("BackToList").' ';
$linkback .= ' ';
$linkback .= '';
@@ -2099,7 +2099,7 @@ if ($id > 0) {
}
// Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print ' '.$langs->trans("Categories").' ';
print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1);
print " ";
@@ -2114,7 +2114,7 @@ if ($id > 0) {
print '
';
print '';
- if ($conf->societe->enabled) {
+ if (!empty($conf->societe->enabled)) {
// Related company
print ''.$langs->trans("ActionOnCompany").' '.($object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : (''.$langs->trans("None").' '));
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') {
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index aeb20e6c7b4..19eb35376cd 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -389,6 +389,9 @@ class ActionComm extends CommonObject
const EVENT_FINISHED = 100;
+ public $fields = array();
+
+
/**
* Constructor
*
@@ -1142,8 +1145,16 @@ class ActionComm extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
if ($this->type_id > 0) {
- $sql .= ", fk_action = '".$this->db->escape($this->type_id)."'";
+ $sql .= ", fk_action = ".(int) $this->type_id;
+ if (empty($this->type_code)) {
+ $cactioncomm = new CActionComm($this->db);
+ $result = $cactioncomm->fetch($this->type_id);
+ if ($result >= 0 && !empty($cactioncomm->code)) {
+ $this->type_code = $cactioncomm->code;
+ }
+ }
}
+ $sql .= ", code = " . (isset($this->type_code)? "'".$this->db->escape($this->type_code) . "'":"null");
$sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null");
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
@@ -1220,11 +1231,14 @@ class ActionComm extends CommonObject
if (!empty($this->socpeopleassigned)) {
$already_inserted = array();
- foreach (array_keys($this->socpeopleassigned) as $id) {
+ foreach (array_keys($this->socpeopleassigned) as $key => $val) {
+ if (!is_array($val)) { // For backward compatibility when val=id
+ $val = array('id'=>$val);
+ }
if (!empty($already_inserted[$val['id']])) continue;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
- $sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $id).", 0, 0, 0)";
+ $sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $val['id']).", 0, 0, 0)";
$resql = $this->db->query($sql);
if (!$resql) {
@@ -1623,12 +1637,6 @@ class ActionComm extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"';
$linkclose .= ' class="'.$classname.' classfortooltip"';
- /*
- $hookmanager->initHooks(array('actiondao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose);
- */
} else {
$linkclose .= ' class="'.$classname.'"';
}
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 3de00e9cb6f..38779e300ed 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -139,7 +139,7 @@ if ($object->id > 0) {
print dol_get_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action');
- $linkback = img_picto($langs->trans("BackToList"), 'object_list', 'class="hideonsmartphone pictoactionview"');
+ $linkback = img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="hideonsmartphone pictoactionview"');
$linkback .= ''.$langs->trans("BackToList").' ';
// Link to other agenda views
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index dee6c459433..ec80dc90a4c 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -497,7 +497,7 @@ print ' ';
$viewmode = '';
$viewmode .= '';
//$viewmode .= '';
-$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
+$viewmode .= img_picto($langs->trans("List"), 'object_calendarlist', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php
index 225bc8b29fc..19f4c4bfa03 100644
--- a/htdocs/comm/action/info.php
+++ b/htdocs/comm/action/info.php
@@ -66,7 +66,7 @@ $object->info($object->id);
$head = actions_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action');
-$linkback = img_picto($langs->trans("BackToList"), 'object_list', 'class="hideonsmartphone pictoactionview"');
+$linkback = img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="hideonsmartphone pictoactionview"');
$linkback .= ''.$langs->trans("BackToList").' ';
// Link to other agenda views
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 7d8861aded3..06e6684d99b 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -183,7 +183,8 @@ if ($user->socid && $socid) {
*/
if (GETPOST('cancel', 'alpha')) {
- $mode = 'list'; $massaction = '';
+ $mode = 'list';
+ $massaction = '';
}
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) {
@@ -268,13 +269,17 @@ if (empty($reshook)) {
}
/*
- * View
+ * View
*/
$form = new Form($db);
$userstatic = new User($db);
$formactions = new FormActions($db);
+$actionstatic = new ActionComm($db);
+$societestatic = new Societe($db);
+$contactstatic = new Contact($db);
+
$nav = '';
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav .= ' ';
@@ -282,7 +287,8 @@ $nav .= ' trans("Agenda");
+llxHeader('', $title, $help_url);
// Define list of all external calendars
$listofextcals = array();
@@ -570,11 +576,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords++;
}*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */
- $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
+ $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
- if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
+ if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
$offset = 0;
}
@@ -595,12 +601,6 @@ if (!$resql) {
$num = $db->num_rows($resql);
-
-$actionstatic = new ActionComm($db);
-$societestatic = new Societe($db);
-
-$num = $db->num_rows($resql);
-
$arrayofselected = is_array($toselect) ? $toselect : array();
// Local calendar
@@ -642,7 +642,6 @@ $s = $newtitle;
// Calendars from hooks
$parameters = array();
-$object = null;
$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
if (empty($reshook)) {
$s .= $hookmanager->resPrint;
@@ -655,7 +654,7 @@ $viewday = is_object($object) ? dol_print_date($object->datep, '%d') : '';
$viewmode = '';
$viewmode .= '';
//$viewmode .= '';
-$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
+$viewmode .= img_picto($langs->trans("List"), 'object_calendarlist', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
@@ -687,7 +686,6 @@ $viewmode .= ' ';
// Add more views from hooks
$parameters = array();
-$object = null;
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) {
$viewmode .= $hookmanager->resPrint;
@@ -804,44 +802,57 @@ print ' ';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print ' ';
-print " \n";
+print ''."\n";
+$totalarray = array();
+$totalarray['nbfield'] = 0;
+
+// Fields title label
+// --------------------------------------------------------------------
print '';
if (!empty($arrayfields['a.id']['checked'])) {
print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['owner']['checked'])) {
print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['c.libelle']['checked'])) {
print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['a.label']['checked'])) {
print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['a.note']['checked'])) {
print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
if (!empty($arrayfields['a.datep']['checked'])) {
print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['a.datep2']['checked'])) {
print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['a.fk_contact']['checked'])) {
print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['a.fk_element']['checked'])) {
print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $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
@@ -849,18 +860,21 @@ print $hookmanager->resPrint;
if (!empty($arrayfields['a.datec']['checked'])) {
print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['a.tms']['checked'])) {
print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['a.percent']['checked'])) {
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
+$totalarray['nbfield']++;
print " \n";
-$contactstatic = new Contact($db);
$now = dol_now();
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
@@ -869,8 +883,20 @@ $caction = new CActionComm($db);
$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
$contactListCache = array();
-while ($i < min($num, $limit)) {
+// Loop on record
+// --------------------------------------------------------------------
+$i = 0;
+//$savnbfield = $totalarray['nbfield'];
+//$totalarray['nbfield'] = 0;
+$imaxinloop = ($limit ? min($num, $limit) : $num);
+while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
+ if (empty($obj)) {
+ break; // Should not happen
+ }
+
+ // Store properties in $object
+ $object->setVarsFromFetchObj($obj);
// Discard auto action if option is on
if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') {
@@ -1087,12 +1113,20 @@ while ($i < min($num, $limit)) {
}
print '';
- print "\n";
+ print ''."\n";
+
$i++;
}
-print "
";
-print '';
-print '';
+// If no record found
+if ($num == 0) {
+ print ''.$langs->trans("NoRecordFound").' ';
+}
+
+
+print '
'."\n";
+print ''."\n";
+
+print ''."\n";
$db->free($resql);
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index d4e005ae3e5..85eb355f2b6 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -420,7 +420,7 @@ $massactionbutton = '';
$viewmode = '';
$viewmode .= '';
//$viewmode .= '';
-$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
+$viewmode .= img_picto($langs->trans("List"), 'object_calendarlist', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index b9e190729e0..18f62872630 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -101,7 +101,7 @@ $month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m");
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$pid = GETPOSTISSET("search_projectid") ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
-$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha');
+$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'alpha') : GETPOST("type", 'alpha');
$maxprint = ((GETPOST("maxprint", 'int') != '') ?GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@@ -432,7 +432,7 @@ $massactionbutton = '';
$viewmode = '';
$viewmode .= '';
//$viewmode .= '';
-$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
+$viewmode .= img_picto($langs->trans("List"), 'object_calendarlist', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
@@ -514,7 +514,6 @@ $s = $newtitle;
print $s;
print '';
-
print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print '
';
diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php
index bfa62eba7fc..7a4cfe7a6ea 100644
--- a/htdocs/comm/admin/propal_extrafields.php
+++ b/htdocs/comm/admin/propal_extrafields.php
@@ -82,7 +82,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php
index 19b7674449f..91517d456c5 100644
--- a/htdocs/comm/admin/propaldet_extrafields.php
+++ b/htdocs/comm/admin/propaldet_extrafields.php
@@ -85,7 +85,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 411efc5ae93..d0cb4d7be2f 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -827,7 +827,7 @@ if ($object->id > 0) {
$sql .= ", p.total_tva";
$sql .= ", p.total_ttc";
$sql .= ", p.ref, p.ref_client, p.remise";
- $sql .= ", p.datep as dp, p.fin_validite as date_limit";
+ $sql .= ", p.datep as dp, p.fin_validite as date_limit, p.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
$sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
$sql .= " AND s.rowid = ".((int) $object->id);
@@ -887,7 +887,7 @@ if ($object->id > 0) {
}
}
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
- print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, $param);
+ print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0);
}
// $filename = dol_sanitizeFileName($objp->ref);
// $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
@@ -1226,7 +1226,7 @@ if ($object->id > 0) {
* Latest interventions
*/
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) {
- $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate";
+ $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND s.rowid = ".((int) $object->id);
@@ -1261,7 +1261,7 @@ if ($object->id > 0) {
print ' ';
print $fichinter_static->getNomUrl(1);
// Preview
- $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ $filedir = $conf->ficheinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
$file_list = null;
if (!empty($filedir)) {
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
@@ -1283,7 +1283,7 @@ if ($object->id > 0) {
}
}
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
- print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, $param);
+ print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0);
}
// $filename = dol_sanitizeFileName($objp->ref);
// $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 9069b63179f..95639a25997 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -135,7 +135,7 @@ if (GETPOST('exportcsv', 'int')) {
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
$sql .= " mc.source_id, mc.source_type, mc.error_text";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
- $sql .= " WHERE mc.fk_mailing=".((int) $object->id);
+ $sql .= " WHERE mc.fk_mailing = ".((int) $object->id);
$sql .= $db->order($sortfield, $sortorder);
$resql = $db->query($sql);
@@ -365,17 +365,19 @@ if ($object->fetch($id) >= 0) {
$obj = new $classname($db);
+ // Check if qualified
+ $qualified = (is_null($obj->enabled) ? 1 : dol_eval($obj->enabled, 1));
+
// Check dependencies
- $qualified = (isset($obj->enabled) ? $obj->enabled : 1);
foreach ($obj->require_module as $key) {
- if (!$conf->$key->enabled || (!$user->admin && $obj->require_admin)) {
+ if (empty($conf->$key->enabled) || (empty($user->admin) && $obj->require_admin)) {
$qualified = 0;
//print "Les prerequis d'activation du module mailing ne sont pas respectes. Il ne sera pas actif";
break;
}
}
- // Si le module mailing est qualifie
+ // If module is qualified
if ($qualified) {
$var = !$var;
@@ -402,7 +404,7 @@ if ($object->fetch($id) >= 0) {
}
print '';
- if ($nbofrecipient >= 0) {
+ if ($nbofrecipient === '' || $nbofrecipient >= 0) {
print $nbofrecipient;
} else {
print $langs->trans("Error").' '.img_error($obj->error);
diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
index f4295fa6583..9e10d51031e 100644
--- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
@@ -128,7 +128,8 @@ class FormAdvTargetEmailing extends Form
$i++;
}
- array_multisort($label, SORT_ASC, $countryArray);
+ $array1_sort_order = SORT_ASC;
+ array_multisort($label, $array1_sort_order, $countryArray);
foreach ($countryArray as $row) {
$label = dol_trunc($row['label'], $maxlength, 'middle');
diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php
index 0c2bf539384..4ea794bfbd4 100644
--- a/htdocs/comm/mailing/class/mailing.class.php
+++ b/htdocs/comm/mailing/class/mailing.class.php
@@ -185,6 +185,11 @@ class Mailing extends CommonObject
*/
public $substitutionarray;
+ /**
+ * @var array substitutionarrayfortest
+ */
+ public $substitutionarrayfortest;
+
/**
* Constructor
@@ -723,13 +728,6 @@ class Mailing extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('myobjectdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 22a816acc1d..cc35cfc65a9 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -901,7 +901,7 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
$idprod = 0;
- $tva_tx = (GETPOST('tva_tx') ? price2num(GETPOST('tva_tx')) : 0);
+ $tva_tx = (GETPOST('tva_tx') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
@@ -1644,7 +1644,7 @@ if ($action == 'create') {
// Ref customer
print '
'.$langs->trans('RefCustomer').' ';
- print ' ';
+ print ' ';
print '';
// Third party
@@ -2791,7 +2791,7 @@ if ($action == 'create') {
}
// Create contract
- if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
+ if (!empty($conf->contrat->enabled) && $object->statut == Propal::STATUS_SIGNED) {
$langs->load("contracts");
if ($usercancreatecontract) {
diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php
index 9c8b3c653e6..d28b5718c2f 100644
--- a/htdocs/comm/propal/class/api_proposals.class.php
+++ b/htdocs/comm/propal/class/api_proposals.class.php
@@ -135,8 +135,13 @@ class Proposals extends DolibarrApi
}
// Add external contacts ids.
- $this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->propal->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->propal->contacts_ids = $tmparray;
+ }
+
$this->propal->fetchObjectLinked();
+
return $this->_cleanObjectDatas($this->propal);
}
@@ -228,7 +233,10 @@ class Proposals extends DolibarrApi
$proposal_static = new Propal($this->db);
if ($proposal_static->fetch($obj->rowid)) {
// Add external contacts ids
- $proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
+ $tmparray = $proposal_static->liste_contact(-1, 'external', 1);
+ if (is_array($tmparray)) {
+ $proposal_static->contacts_ids = $tmparray;
+ }
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
}
$i++;
@@ -343,8 +351,8 @@ class Proposals extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->label = checkVal($request_data->label);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->label = sanitizeVal($request_data->label);
$updateRes = $this->propal->addline(
$request_data->desc,
@@ -488,8 +496,8 @@ class Proposals extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->label = checkVal($request_data->label);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->label = sanitizeVal($request_data->label);
$propalline = new PropaleLigne($this->db);
$result = $propalline->fetch($lineid);
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index d59505e5fb7..103ef815e48 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -236,7 +236,7 @@ $arrayfields = array(
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1),
- 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
+ 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php
index 0a182e6dcbe..576285594b4 100644
--- a/htdocs/comm/propal/stats/index.php
+++ b/htdocs/comm/propal/stats/index.php
@@ -335,11 +335,11 @@ foreach ($data as $val) {
print '
';
print ' 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.' ';
print ''.$val['nb'].' ';
- print ''.round($val['nb_diff']).'% ';
+ print ''.(isset($val['nb_diff']) ? round($val['nb_diff']): "0").'% ';
print ''.price(price2num($val['total'], 'MT'), 1).' ';
- print ''.round($val['total_diff']).'% ';
+ print ''.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'% ';
print ''.price(price2num($val['avg'], 'MT'), 1).' ';
- print ''.round($val['avg_diff']).'% ';
+ print ''.(isset($val['avg_diff']) ? round($val['avg_diff']) : "0").'% ';
print ' ';
$oldyear = $year;
}
diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php
index c0e96aa4b15..f36b4bb0b9e 100644
--- a/htdocs/comm/remx.php
+++ b/htdocs/comm/remx.php
@@ -284,11 +284,11 @@ if ($socid > 0) {
}
print '
'.$langs->trans("CustomerAbsoluteDiscountAllUsers").' ';
- print ''.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").' ';
+ print '
'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").' ';
if (!empty($user->fk_soc)) { // No need to show this for external users
print ''.$langs->trans("CustomerAbsoluteDiscountMy").' ';
- print ''.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").' ';
+ print ''.price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").' ';
}
}
@@ -314,11 +314,11 @@ if ($socid > 0) {
}
print ''.$langs->trans("SupplierAbsoluteDiscountAllUsers").' ';
- print ''.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").' ';
+ print ''.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").' ';
if (!empty($user->fk_soc)) { // No need to show this for external users
print ''.$langs->trans("SupplierAbsoluteDiscountMy").' ';
- print ''.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").' ';
+ print ''.price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").' ';
}
}
@@ -353,7 +353,7 @@ if ($socid > 0) {
print '';
}
print ''.$langs->trans("AmountHT").' ';
- print ' ';
+ print ' ';
print ' '.$langs->trans("Currency".$conf->currency).' ';
print ''.$langs->trans("VAT").' ';
print '';
@@ -382,7 +382,7 @@ if ($socid > 0) {
print ' ';
- if ($_GET['action'] == 'remove') {
+ if ($action == 'remove') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.GETPOST('remid'), $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
}
@@ -445,7 +445,7 @@ if ($socid > 0) {
$obj = $db->fetch_object($resql);
print ' ';
- print ''.dol_print_date($db->jdate($obj->dc), 'dayhour').' ';
+ print ''.dol_print_date($db->jdate($obj->dc), 'dayhour', 'tzuserrel').' ';
if (preg_match('/\(CREDIT_NOTE\)/', $obj->description)) {
print '';
$facturestatic->id = $obj->fk_facture_source;
@@ -472,15 +472,15 @@ if ($socid > 0) {
print $obj->description;
print ' ';
}
- print ''.$langs->trans("NotConsumed").' ';
- print ''.price($obj->amount_ht).' ';
+ print ''.$langs->trans("NotConsumed").' ';
+ print ''.price($obj->amount_ht).' ';
if (!empty($conf->multicurrency->enabled)) {
- print ''.price($obj->multicurrency_amount_ht).' ';
+ print ''.price($obj->multicurrency_amount_ht).' ';
}
print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).' ';
- print ''.price($obj->amount_ttc).' ';
+ print ''.price($obj->amount_ttc).' ';
if (!empty($conf->multicurrency->enabled)) {
- print ''.price($obj->multicurrency_amount_ttc).' ';
+ print ''.price($obj->multicurrency_amount_ttc).' ';
}
print '';
print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.' ';
@@ -583,7 +583,7 @@ if ($socid > 0) {
$obj = $db->fetch_object($resql);
print ' ';
- print ''.dol_print_date($db->jdate($obj->dc), 'dayhour').' ';
+ print ''.dol_print_date($db->jdate($obj->dc), 'dayhour', 'tzuserrel').' ';
if (preg_match('/\(CREDIT_NOTE\)/', $obj->description)) {
print '';
$facturefournstatic->id = $obj->fk_invoice_supplier_source;
@@ -610,15 +610,15 @@ if ($socid > 0) {
print $obj->description;
print ' ';
}
- print ''.$langs->trans("NotConsumed").' ';
- print ''.price($obj->amount_ht).' ';
+ print ''.$langs->trans("NotConsumed").' ';
+ print ''.price($obj->amount_ht).' ';
if (!empty($conf->multicurrency->enabled)) {
- print ''.price($obj->multicurrency_amount_ht).' ';
+ print ''.price($obj->multicurrency_amount_ht).' ';
}
print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).' ';
- print ''.price($obj->amount_ttc).' ';
+ print ''.price($obj->amount_ttc).' ';
if (!empty($conf->multicurrency->enabled)) {
- print ''.price($obj->multicurrency_amount_ttc).' ';
+ print ''.price($obj->multicurrency_amount_ttc).' ';
}
print '';
print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.' ';
@@ -766,7 +766,8 @@ if ($socid > 0) {
$tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
}
$db->free($resql2);
- array_multisort($tab_sqlobjOrder, SORT_DESC, $tab_sqlobj);
+ $array1_sort_order = SORT_DESC;
+ array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
$num = count($tab_sqlobj);
if ($num > 0) {
@@ -926,7 +927,8 @@ if ($socid > 0) {
$tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
}
$db->free($resql2);
- array_multisort($tab_sqlobjOrder, SORT_DESC, $tab_sqlobj);
+ $array1_sort_order = SORT_DESC;
+ array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
$num = count($tab_sqlobj);
if ($num > 0) {
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index f1423ffa12b..c0aae93dff9 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1697,8 +1697,8 @@ if ($action == 'create' && $usercancreate) {
if ($socid > 0) {
// Contacts (ask contact only if thirdparty already defined).
print " ".$langs->trans("DefaultContact").' ';
- print img_picto('', 'contact');
- print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1);
+ print img_picto('', 'contact', 'class="pictofixedwidth"');
+ print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1, 'maxwidth200 widthcentpercentminusx');
print ' ';
// Ligne info remises tiers
@@ -1755,7 +1755,7 @@ if ($action == 'create' && $usercancreate) {
// Shipping Method
if (!empty($conf->expedition->enabled)) {
print ''.$langs->trans('SendingMethod').' ';
- print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"');
+ print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
print ' ';
}
@@ -2735,7 +2735,7 @@ if ($action == 'create' && $usercancreate) {
}
// Create intervention
- if ($conf->ficheinter->enabled) {
+ if (!empty($conf->ficheinter->enabled)) {
$langs->load("interventions");
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
@@ -2748,7 +2748,7 @@ if ($action == 'create' && $usercancreate) {
}
// Create contract
- if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
+ if (!empty($conf->contrat->enabled) && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
$langs->load("contracts");
if ($user->rights->contrat->creer) {
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 2795c325fba..2c916abda9a 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -133,7 +133,10 @@ class Orders extends DolibarrApi
}
// Add external contacts ids
- $this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->commande->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->commande->contacts_ids = $tmparray;
+ }
$this->commande->fetchObjectLinked();
// Add online_payment_url, cf #20477
@@ -234,7 +237,10 @@ class Orders extends DolibarrApi
$commande_static = new Commande($this->db);
if ($commande_static->fetch($obj->rowid)) {
// Add external contacts ids
- $commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
+ $tmparray = $commande_static->liste_contact(-1, 'external', 1);
+ if (is_array($tmparray)) {
+ $commande_static->contacts_ids = $tmparray;
+ }
// Add online_payment_url, cf #20477
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
@@ -344,8 +350,8 @@ class Orders extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->label = checkVal($request_data->label);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->label = sanitizeVal($request_data->label);
$updateRes = $this->commande->addline(
$request_data->desc,
@@ -412,8 +418,8 @@ class Orders extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->label = checkVal($request_data->label);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->label = sanitizeVal($request_data->label);
$updateRes = $this->commande->updateline(
$lineid,
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index a7d237bc780..44cc5c6effd 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -359,7 +359,7 @@ class Commande extends CommonOrder
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302),
- 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304),
+ 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>304),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 5d4dce6872d..cdabf9f2a5a 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -190,7 +190,7 @@ $arrayfields = array(
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
- 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
+ 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php
index 603627ee91e..3e33ddedf57 100644
--- a/htdocs/commande/stats/index.php
+++ b/htdocs/commande/stats/index.php
@@ -394,11 +394,11 @@ foreach ($data as $val) {
print '';
print ' 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.' ';
print ''.$val['nb'].' ';
- print ''.round($val['nb_diff']).'% ';
+ print ''.(isset($val['nb_diff']) ? round($val['nb_diff']): "0").'% ';
print ''.price(price2num($val['total'], 'MT'), 1).' ';
- print ''.round($val['total_diff']).'% ';
+ print ''.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'% ';
print ''.price(price2num($val['avg'], 'MT'), 1).' ';
- print ''.round($val['avg_diff']).'% ';
+ print ''.(isset($val['avg_diff']) ? round($val['avg_diff']) : "0").'% ';
print ' ';
$oldyear = $year;
}
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 05b30d69668..fba2d05897c 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -32,14 +32,15 @@
*/
require '../../main.inc.php';
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
+
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
-
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
@@ -54,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
// Load translation files required by the page
$langs->loadLangs(array("banks", "bills", "categories", "companies", "margins", "salaries", "loan", "donations", "trips", "members", "compta", "accountancy"));
@@ -99,6 +101,7 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search
$search_req_nb = GETPOST("req_nb", 'alpha');
$search_num_releve = GETPOST("search_num_releve", 'alpha');
$search_conciliated = GETPOST("search_conciliated", 'int');
+$search_fk_bordereau = GETPOST("search_fk_bordereau", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$toselect = GETPOST('toselect', 'array');
$num_releve = GETPOST("num_releve", "alpha");
@@ -157,20 +160,21 @@ $extrafields->fetch_name_optionals_label('banktransaction');
$search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_');
$arrayfields = array(
- 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
- 'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
- 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
- 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
- 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
- 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
- 'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500),
- 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
- 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
- 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
- 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
- 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
- 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
- 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
+ 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1,'position'=>10),
+ 'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1,'position'=>20),
+ 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1,'position'=>30),
+ 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1,'position'=>40),
+ 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1,'position'=>50),
+ 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1,'position'=>60),
+ 'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>70),
+ 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>80),
+ 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>90),
+ 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>100),
+ 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>110),
+ 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>120),
+ 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>130),
+ 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>140),
+ 'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeReceipt"), 'checked'=>0, 'position'=>150),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@@ -178,7 +182,6 @@ 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');
-
/*
* Actions
*/
@@ -214,6 +217,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_thirdparty_user = '';
$search_num_releve = '';
$search_conciliated = '';
+ $search_fk_bordereau = '';
$toselect = array();
$search_account = "";
@@ -390,8 +394,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->ba
}
}
-
-
/*
* View
*/
@@ -421,6 +423,7 @@ $paymentvariousstatic = new PaymentVarious($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db);
$bankstatic = new Account($db);
$banklinestatic = new AccountLine($db);
+$bordereaustatic = new RemiseCheque($db);
$now = dol_now();
@@ -465,6 +468,9 @@ if (!empty($search_num_releve)) {
if ($search_conciliated != '' && $search_conciliated != '-1') {
$param .= '&search_conciliated='.urlencode($search_conciliated);
}
+if ($search_fk_bordereau > 0) {
+ $param .= '$&search_fk_bordereau='.urlencode($search_fk_bordereau);
+}
if ($search_bid > 0) {
$param .= '&search_bid='.urlencode($search_bid);
}
@@ -547,7 +553,7 @@ if ($id > 0 || !empty($ref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
- $buttonreconcile = ''.$titletoconciliatemanual.' ';
+ $buttonreconcile = ''.$titletoconciliatemanual.' ';
} else {
$buttonreconcile = ''.$titletoconciliatemanual.' ';
}
@@ -557,7 +563,7 @@ if ($id > 0 || !empty($ref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
- $buttonreconcile .= ' '.$titletoconciliateauto.' ';
+ $buttonreconcile .= ' '.$titletoconciliateauto.' ';
} else {
$buttonreconcile .= ' '.$titletoconciliateauto.' ';
}
@@ -568,8 +574,9 @@ if ($id > 0 || !empty($ref)) {
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
}
+
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
-$sql .= " b.fk_account, b.fk_type,";
+$sql .= " b.fk_account, b.fk_type, b.fk_bordereau,";
$sql .= " ba.rowid as bankid, ba.ref as bankref";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@@ -621,6 +628,9 @@ if ($search_num_releve) {
if ($search_conciliated != '' && $search_conciliated != '-1') {
$sql .= " AND b.rappro = ".((int) $search_conciliated);
}
+if ($search_fk_bordereau > 0) {
+ $sql .= " AND b.fk_bordereau = " . ((int) $search_fk_bordereau);
+}
if ($search_thirdparty_user) {
$sql.= " AND (b.rowid IN ";
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
@@ -737,6 +747,9 @@ if ($search_conciliated != '' && $search_conciliated != '-1') {
if (!empty($search_num_releve)) {
$mode_balance_ok = false;
}
+if (!empty($search_fk_bordereau)) {
+ $mode_balance_ok = false;
+}
$sql .= $db->plimit($limit + 1, $offset);
//print $sql;
@@ -1067,34 +1080,40 @@ if ($resql) {
$form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100');
print '';
}
+ // Numero
if (!empty($arrayfields['b.num_chq']['checked'])) {
- // Numero
print ' ';
}
+ // Checked
if (!empty($arrayfields['bu.label']['checked'])) {
print ' ';
}
+ // Ref
if (!empty($arrayfields['ba.ref']['checked'])) {
print '';
$form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : ''), 0, 'maxwidth100');
print ' ';
}
+ // Debit
if (!empty($arrayfields['b.debit']['checked'])) {
print '';
print ' ';
print ' ';
}
+ // Credit
if (!empty($arrayfields['b.credit']['checked'])) {
print '';
print ' ';
print ' ';
}
+ // Balance before
if (!empty($arrayfields['balancebefore']['checked'])) {
print '';
$htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1);
print ' ';
}
+ // Balance
if (!empty($arrayfields['balance']['checked'])) {
print '';
$htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
@@ -1111,6 +1130,11 @@ if ($resql) {
print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1);
print ' ';
}
+ // Bordereau
+ if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
+ print ' ';
+ }
+
// Actions and select
print '';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@@ -1162,6 +1186,10 @@ if ($resql) {
if (!empty($arrayfields['b.conciliated']['checked'])) {
print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center ");
}
+ if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
+ print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center ");
+ }
+
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@@ -1673,6 +1701,16 @@ if ($resql) {
}
}
+ if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
+ $bordereaustatic->fetch($objp->fk_bordereau);
+ print ' ';
+ print $bordereaustatic->getNomUrl();
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
// Action edit/delete and select
print '';
// Transaction reconciliated or edit link
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 495dd86f268..ce373bbf5b5 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -7,6 +7,7 @@
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2016 Marcos García
* Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2022 Charlene Benke
*
* 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
@@ -436,7 +437,7 @@ if ($action == 'create') {
print ' ';
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print ''.$langs->trans("Categories").' ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
@@ -713,7 +714,7 @@ if ($action == 'create') {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print ''.$langs->trans("Categories").' ';
print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
print " ";
@@ -966,7 +967,7 @@ if ($action == 'create') {
print '';
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print ''.$langs->trans("Categories").' ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@@ -1082,12 +1083,12 @@ if ($action == 'create') {
print ' '.$langs->trans($bickey).' ';
print ' ';
- if ($conf->prelevement->enabled) {
+ if (!empty($conf->prelevement->enabled)) {
print ''.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').' ';
print ' ';
}
- if ($conf->paymentbybanktransfer->enabled) {
+ if (!empty($conf->paymentbybanktransfer->enabled)) {
print ''.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').' ';
print ' ';
diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php
index 23d4c2eefbb..8e38d1ffe78 100644
--- a/htdocs/compta/bank/class/api_bankaccounts.class.php
+++ b/htdocs/compta/bank/class/api_bankaccounts.class.php
@@ -250,7 +250,7 @@ class BankAccounts extends DolibarrApi
}
// Clean data
- $description = checkVal($description, 'alphanohtml');
+ $description = sanitizeVal($description, 'alphanohtml');
/**
@@ -498,13 +498,13 @@ class BankAccounts extends DolibarrApi
throw new RestException(404, 'account not found');
}
- $type = checkVal($type);
- $label = checkVal($label);
- $cheque_number = checkVal($cheque_number);
- $cheque_writer = checkVal($cheque_writer);
- $cheque_bank = checkVal($cheque_bank);
- $accountancycode = checkVal($accountancycode);
- $num_releve = checkVal($num_releve);
+ $type = sanitizeVal($type);
+ $label = sanitizeVal($label);
+ $cheque_number = sanitizeVal($cheque_number);
+ $cheque_writer = sanitizeVal($cheque_writer);
+ $cheque_bank = sanitizeVal($cheque_bank);
+ $accountancycode = sanitizeVal($accountancycode);
+ $num_releve = sanitizeVal($num_releve);
$result = $account->addline(
$date,
@@ -557,9 +557,9 @@ class BankAccounts extends DolibarrApi
throw new RestException(404, 'account line not found');
}
- $url = checkVal($url);
- $label = checkVal($label);
- $type = checkVal($type);
+ $url = sanitizeVal($url);
+ $label = sanitizeVal($label);
+ $type = sanitizeVal($type);
$result = $account->add_url_line($line_id, $url_id, $url, $label, $type);
if ($result < 0) {
diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php
index 77aded9c594..8bad5dbebd0 100644
--- a/htdocs/compta/bank/class/paymentvarious.class.php
+++ b/htdocs/compta/bank/class/paymentvarious.class.php
@@ -694,13 +694,6 @@ class PaymentVarious extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('myobjectdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 90bc79483bf..d91a14f14cd 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -616,9 +616,18 @@ foreach ($accounts as $key => $type) {
// Transactions to reconcile
if (!empty($arrayfields['toreconcile']['checked'])) {
- print '';
-
$conciliate = $objecttmp->canBeConciliated();
+
+ $labeltoshow = '';
+ if ($conciliate == -2) {
+ $labeltoshow = $langs->trans("CashAccount");
+ } elseif ($conciliate == -3) {
+ $labeltoshow = $langs->trans("Closed");
+ } elseif (empty($objecttmp->rappro)) {
+ $labeltoshow = $langs->trans("ConciliationDisabled");
+ }
+
+ print ' ';
if ($conciliate == -2) {
print ''.$langs->trans("CashAccount").' ';
} elseif ($conciliate == -3) {
@@ -630,7 +639,7 @@ foreach ($accounts as $key => $type) {
if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
- print '';
+ print ' ';
print '';
print $result->nbtodo;
print ' ';
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index 2385f2210a5..9a0adb6957f 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -276,7 +276,7 @@ if (empty($numref)) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
- $buttonreconcile = ' '.$titletoconciliatemanual.' ';
+ $buttonreconcile = ''.$titletoconciliatemanual.' ';
} else {
$buttonreconcile = ''.$titletoconciliatemanual.' ';
}
@@ -287,7 +287,7 @@ if (empty($numref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
- $buttonreconcile .= ' '.$titletoconciliateauto.' ';
+ $buttonreconcile .= ' '.$titletoconciliateauto.' ';
} else {
$buttonreconcile .= ' '.$titletoconciliateauto.' ';
}
diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php
index 149710c975b..2b6b027d7ce 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_card.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_card.php
@@ -647,7 +647,7 @@ if (empty($action) || $action == "view" || $action == "close") {
print '
';
print '';
- print '>';
+ print '
';
print '
';
print '
';
@@ -659,11 +659,11 @@ if (empty($action) || $action == "view" || $action == "close") {
print '';
print ''.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").' ';
- print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
+ print ''.price($object->opening, 0, $langs, 1, -1, -1, $conf->currency).' ';
print " ";
foreach ($arrayofpaymentmode as $key => $val) {
print ''.$langs->trans($val).' ';
- print price($object->$key, 0, $langs, 1, -1, -1, $conf->currency);
+ print ''.price($object->$key, 0, $langs, 1, -1, -1, $conf->currency).' ';
print " ";
}
diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
index 63dae3a3a1c..d7744f777fe 100644
--- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php
+++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
@@ -439,13 +439,6 @@ class CashControl extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('myobjectdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php
index 78f9eae72a0..c16b6523d1f 100644
--- a/htdocs/compta/charges/index.php
+++ b/htdocs/compta/charges/index.php
@@ -153,7 +153,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$sql = "SELECT c.id, c.libelle as label,";
$sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
- $sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
+ $sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
@@ -185,7 +185,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$i = 0;
$total = 0;
$totalnb = 0;
- $totalpaye = 0;
+ $totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@@ -239,15 +239,15 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
}
// Paid
print '';
- if ($obj->totalpaye) {
- print price($obj->totalpaye);
+ if ($obj->totalpaid) {
+ print price($obj->totalpaid);
}
print ' ';
print '';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
- $totalpaye = $totalpaye + $obj->totalpaye;
+ $totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
print ''.$langs->trans("Total").' ';
@@ -258,7 +258,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
if (!empty($conf->banque->enabled)) {
print ' ';
}
- print ''.price($totalpaye)." ";
+ print ''.price($totalpaid)." ";
print " ";
} else {
dol_print_error($db);
diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php
index b3ca5f5f233..42fb64738e1 100644
--- a/htdocs/compta/facture/admin/facture_cust_extrafields.php
+++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php
@@ -83,7 +83,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php b/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php
index 7d2d2b1df97..1c834134f6d 100644
--- a/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php
+++ b/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php
index 05aa47737be..7b7f62ed94c 100644
--- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php
+++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php
index 6ebdfae6277..900aab1e10b 100644
--- a/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php
+++ b/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index f2e57c8b536..0fefbbab118 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
-$usercancreatemargin = $user->rights->margins->creer;
-$usercanreadallmargin = $user->rights->margins->liretous;
-$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
+$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
+$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
+$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
@@ -725,14 +725,14 @@ if (empty($reshook)) {
while ($i < $num) {
$objp = $db->fetch_object($result);
- $totalpaye += $objp->amount;
+ $totalpaid += $objp->amount;
$i++;
}
} else {
dol_print_error($db, '');
}
- $resteapayer = $object->total_ttc - $totalpaye;
+ $resteapayer = $object->total_ttc - $totalpaid;
// We check that invlice lines are transferred into accountancy
$ventilExportCompta = $object->getVentilExportCompta();
@@ -1255,10 +1255,10 @@ if (empty($reshook)) {
if (GETPOST('invoiceAvoirWithPaymentRestAmount', 'int') == 1 && $id > 0) {
if ($facture_source->fetch($object->fk_facture_source) > 0) {
- $totalpaye = $facture_source->getSommePaiement();
+ $totalpaid = $facture_source->getSommePaiement();
$totalcreditnotes = $facture_source->getSumCreditNotesUsed();
$totaldeposits = $facture_source->getSumDepositsUsed();
- $remain_to_pay = abs($facture_source->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits);
+ $remain_to_pay = abs($facture_source->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits);
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 1, 0, 0, 0, 0, 0, '', '', 'TTC');
}
@@ -3899,24 +3899,24 @@ if ($action == 'create') {
}
$selleruserevenustamp = $mysoc->useRevenueStamp();
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
- //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
+ //print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
// selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
- // $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
+ // $resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
- $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
- $multicurrency_totalpaye = $object->getSommePaiement(1);
+ $multicurrency_totalpaid = $object->getSommePaiement(1);
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
- $multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
+ $multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaid - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
// Code to fix case of corrupted data
if ($resteapayer == 0 && $multicurrency_resteapayer != 0) {
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
@@ -4317,7 +4317,7 @@ if ($action == 'create') {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $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, '', '');
@@ -4325,7 +4325,7 @@ if ($action == 'create') {
print '';
print '
';
- print '
';
+ print '';
// Type
print ''.$langs->trans('Type').' ';
@@ -4338,17 +4338,17 @@ if ($action == 'create') {
if ($object->type == Facture::TYPE_REPLACEMENT) {
$facreplaced = new Facture($db);
$facreplaced->fetch($object->fk_facture_source);
- print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).') ';
+ print ' '.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).' ';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($object->fk_facture_source)) {
$facusing = new Facture($db);
$facusing->fetch($object->fk_facture_source);
- print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).') ';
+ print ' '.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).' ';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
- print ' ('.$langs->transnoentities("InvoiceHasAvoir");
+ print ' '.$langs->transnoentities("InvoiceHasAvoir");
$i = 0;
foreach ($facidavoir as $id) {
if ($i == 0) {
@@ -4360,12 +4360,12 @@ if ($action == 'create') {
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
- print ') ';
+ print ' ';
}
if ($objectidnext > 0) {
$facthatreplace = new Facture($db);
$facthatreplace->fetch($objectidnext);
- print ' ('.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).') ';
+ print ' '.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).' ';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
@@ -4425,7 +4425,7 @@ if ($action == 'create') {
print ' ';
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
- // Date invoice
+ // Date invoice point of tax
print '';
print '';
print $langs->trans('DatePointOfTax');
@@ -4740,7 +4740,7 @@ if ($action == 'create') {
}
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2
print ' '.$langs->transcountry("AmountLT2", $mysoc->country_code).' ';
- print ''.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).' ';
+ print ''.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).' ';
}
// Revenue stamp
@@ -4926,7 +4926,7 @@ if ($action == 'create') {
$total_next_ht = $total_next_ttc = 0;
foreach ($object->tab_next_situation_invoice as $next_invoice) {
- $totalpaye = $next_invoice->getSommePaiement();
+ $totalpaid = $next_invoice->getSommePaiement();
$total_next_ht += $next_invoice->total_ht;
$total_next_ttc += $next_invoice->total_ttc;
@@ -4939,7 +4939,7 @@ if ($action == 'create') {
}
print ''.price($next_invoice->total_ht).' ';
print ''.price($next_invoice->total_ttc).' ';
- print ''.$next_invoice->getLibStatut(3, $totalpaye).' ';
+ print ''.$next_invoice->getLibStatut(3, $totalpaid).' ';
print '';
}
@@ -5008,7 +5008,7 @@ if ($action == 'create') {
$paymentstatic->datepaye = $db->jdate($objp->dp);
$paymentstatic->ref = $objp->ref;
$paymentstatic->num_payment = $objp->num_payment;
- $paymentstatic->payment_code = $objp->payment_code;
+ $paymentstatic->paiementcode = $objp->payment_code;
print '';
print $paymentstatic->getNomUrl(1);
@@ -5072,7 +5072,7 @@ if ($action == 'create') {
} else {
print $langs->trans('AlreadyPaid');
}
- print ' '.price($totalpaye).' ';
+ print ''.price($totalpaid).' ';
$resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
@@ -5125,7 +5125,7 @@ if ($action == 'create') {
print '';
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
print ' ';
- print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).' ';
+ print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).' ';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@@ -5135,7 +5135,7 @@ if ($action == 'create') {
print '';
print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1);
print ' ';
- print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).' ';
+ print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).' ';
// $resteapayeraffiche=0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@@ -5145,7 +5145,7 @@ if ($action == 'create') {
print '';
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
print ' ';
- print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).' ';
+ print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).' ';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@@ -5159,7 +5159,7 @@ if ($action == 'create') {
print '';
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
print ' ';
- print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).' ';
+ print ''.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).' ';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@@ -5220,7 +5220,7 @@ if ($action == 'create') {
// Total already paid back
print '';
print ''.$langs->trans('AlreadyPaidBack').' ';
- print ' '.price($sign * $totalpaye).' ';
+ print ''.price($sign * $totalpaid).' ';
// Billed
print ''.$langs->trans("Billed").' '.price($sign * $object->total_ttc).' ';
@@ -5426,7 +5426,7 @@ if ($action == 'create') {
// Create contract
if (!empty($conf->global->CONTRACT_CREATE_FROM_INVOICE)) {
- if ($conf->contrat->enabled && $object->statut == Facture::STATUS_VALIDATED) {
+ if (!empty($conf->contrat->enabled) && $object->statut == Facture::STATUS_VALIDATED) {
$langs->load("contracts");
if ($usercancreatecontract) {
@@ -5498,8 +5498,8 @@ if ($action == 'create') {
}
}
- $sumofpayment = $totalpaye;
- $sumofpaymentall = $totalpaye + $totalcreditnotes + $totaldeposits;
+ $sumofpayment = $totalpaid;
+ $sumofpaymentall = $totalpaid + $totalcreditnotes + $totaldeposits;
// Reverse back money or convert to reduction
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
@@ -5551,7 +5551,7 @@ if ($action == 'create') {
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
- if ($totalpaye > 0 || $totalcreditnotes > 0) {
+ if ($totalpaid > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print ''.$langs->trans('ClassifyPaidPartially').' ';
} else {
@@ -5575,7 +5575,7 @@ if ($action == 'create') {
// For situation invoice with excess received
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
- && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
+ && ($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits) > 0
&& $usercancreate
&& !$objectidnext
&& $object->is_last_in_cycle()
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index 51fd8c1dd7a..a864168d161 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -148,7 +148,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
- $this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->invoice->contacts_ids = $tmparray;
+ }
}
$this->invoice->fetchObjectLinked();
@@ -267,8 +270,10 @@ class Invoices extends DolibarrApi
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Add external contacts ids
- $invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1);
-
+ $tmparray = $invoice_static->liste_contact(-1, 'external', 1);
+ if (is_array($tmparray)) {
+ $invoice_static->contacts_ids = $tmparray;
+ }
$obj_ret[] = $this->_cleanObjectDatas($invoice_static);
}
$i++;
@@ -423,8 +428,8 @@ class Invoices extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->label = checkVal($request_data->label);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->label = sanitizeVal($request_data->label);
$updateRes = $this->invoice->updateline(
$lineid,
@@ -713,8 +718,8 @@ class Invoices extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->label = checkVal($request_data->label);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->label = sanitizeVal($request_data->label);
// Reset fk_parent_line for no child products and special product
if (($request_data->product_type != 9 && empty($request_data->fk_parent_line)) || $request_data->product_type == 9) {
@@ -1420,10 +1425,10 @@ class Invoices extends DolibarrApi
}
// Calculate amount to pay
- $totalpaye = $this->invoice->getSommePaiement();
+ $totalpaid = $this->invoice->getSommePaiement();
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
$totaldeposits = $this->invoice->getSumDepositsUsed();
- $resteapayer = price2num($this->invoice->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $resteapayer = price2num($this->invoice->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
$this->db->begin();
@@ -1562,10 +1567,10 @@ class Invoices extends DolibarrApi
}
// Calculate amount to pay
- $totalpaye = $this->invoice->getSommePaiement($is_multicurrency);
+ $totalpaid = $this->invoice->getSommePaiement($is_multicurrency);
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed($is_multicurrency);
$totaldeposits = $this->invoice->getSumDepositsUsed($is_multicurrency);
- $remainstopay = $amount = price2num($total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $remainstopay = $amount = price2num($total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if (!$is_multicurrency && $amountarray["amount"] != 'remain') {
$amount = price2num($amountarray["amount"], 'MT');
@@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
- $this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->template_invoice->contacts_ids = $tmparray;
+ }
}
$this->template_invoice->fetchObjectLinked();
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 927da1bf17a..34df7bcf097 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -1333,6 +1333,11 @@ class FactureRec extends CommonInvoice
$facture->status = self::STATUS_DRAFT;
$facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
$facture->socid = $facturerec->socid;
+ if (!empty($facturerec->fk_multicurrency)) {
+ $facture->fk_multicurrency = $facturerec->fk_multicurrency;
+ $facture->multicurrency_code = $facturerec->multicurrency_code;
+ $facture->multicurrency_tx = $facturerec->multicurrency_tx;
+ }
$invoiceidgenerated = $facture->create($user);
if ($invoiceidgenerated <= 0) {
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 64d83cb2123..a2c22d7f878 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -5214,13 +5214,13 @@ class Facture extends CommonInvoice
$hasDelay = $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
if ($hasDelay && !empty($this->retained_warranty) && !empty($this->retained_warranty_date_limit)) {
- $totalpaye = $this->getSommePaiement();
- $totalpaye = floatval($totalpaye);
+ $totalpaid = $this->getSommePaiement();
+ $totalpaid = floatval($totalpaid);
$RetainedWarrantyAmount = $this->getRetainedWarrantyAmount();
- if ($totalpaye >= 0 && $RetainedWarrantyAmount >= 0) {
- if (($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
+ if ($totalpaid >= 0 && $RetainedWarrantyAmount >= 0) {
+ if (($totalpaid < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
$hasDelay = 1;
- } elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
+ } elseif ($totalpaid < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
$hasDelay = 1;
} else {
$hasDelay = 0;
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 43897172779..b1799350ce8 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -52,7 +52,7 @@ if ($user->socid) {
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
- $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$result = restrictedArea($user, 'facture', $object->id);
@@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
print dol_get_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), -1, 'bill');
@@ -171,13 +171,13 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $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, '', '', 1);
print dol_get_fiche_end();
- print ' ';
+ //print ' ';
// Contacts lines (modules that overwrite templates must declare this into descriptor)
$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 6eb05a16922..f55e9c4b36f 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill');
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
@@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $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);
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index 60efaf36e3d..ceea7dcbb62 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
- $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
// Security check
@@ -84,7 +84,7 @@ $object->info($object->id);
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill');
-$totalpaye = $object->getSommePaiement();
+$totalpaid = $object->getSommePaiement();
// Invoice content
@@ -131,7 +131,7 @@ if (!empty($conf->projet->enabled)) {
}
$morehtmlref .= '';
-$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$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);
@@ -140,7 +140,7 @@ print '
';
print ' ';
-print '';
+print '';
dol_print_object_info($object);
print '
';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 5937eda916c..54de9440b8b 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -141,7 +141,6 @@ $search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
-
$option = GETPOST('search_option');
if ($option == 'late') {
$search_status = '1';
@@ -245,7 +244,7 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
- 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
+ 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
@@ -472,10 +471,10 @@ if ($action == 'makepayment_confirm' && !empty($user->rights->facture->paiement)
$objecttmp = new Facture($db);
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
- $totalpaye = $objecttmp->getSommePaiement();
+ $totalpaid = $objecttmp->getSommePaiement();
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed();
- $objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if ($objecttmp->statut == Facture::STATUS_DRAFT) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');
@@ -1112,7 +1111,7 @@ if ($resql) {
if (!empty($user->rights->facture->paiement)) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
}
- if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
+ if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 6f699774d32..cab6d3ac680 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
- $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
@@ -99,7 +99,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
print dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill');
@@ -148,7 +148,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $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);
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 989fa28b2f0..afdd871371c 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -236,16 +236,16 @@ llxHeader('', $title, $helpurl);
if ($object->id > 0) {
$selleruserevenustamp = $mysoc->useRevenueStamp();
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
- //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
+ //print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
- //$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
+ //$resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
- $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if ($object->paye) {
$resteapayer = 0;
@@ -352,9 +352,9 @@ if ($object->id > 0) {
if (!empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' ';
- if ($user->rights->facture->creer) {
+ if ($usercancreate) {
if ($action != 'classify') {
- //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ //$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : ';
$morehtmlref .= ' : ';
}
if ($action == 'classify') {
@@ -384,7 +384,7 @@ if ($object->id > 0) {
}
$morehtmlref .= '';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $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, $moreparam, 0, '', '');
@@ -395,12 +395,12 @@ if ($object->id > 0) {
print '';
// Type
- print ''.$langs->trans('Type').' ';
+ print ' '.$langs->trans('Type').' ';
print '';
print $object->getLibType();
print ' ';
if ($object->module_source) {
- print ' ('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.') ';
+ print ' ('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.') ';
}
if ($object->type == $object::TYPE_REPLACEMENT) {
if ($type == 'bank-transfer') {
@@ -409,16 +409,16 @@ if ($object->id > 0) {
$facreplaced = new Facture($db);
}
$facreplaced->fetch($object->fk_facture_source);
- print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')';
+ print ' '.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).' ';
}
- if ($object->type == $object::TYPE_CREDIT_NOTE) {
+ if ($object->type == $object::TYPE_CREDIT_NOTE && !empty($object->fk_facture_source)) {
if ($type == 'bank-transfer') {
$facusing = new FactureFournisseur($db);
} else {
$facusing = new Facture($db);
}
$facusing->fetch($object->fk_facture_source);
- print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
+ print ' '.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).' ';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
@@ -433,20 +433,22 @@ if ($object->id > 0) {
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
}
- print ' ('.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits) . ')';
+ print ' '.$langs->transnoentities("InvoiceHasAvoir");
+ print ' '. (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);
+ print ' ';
}
/*
- if ($facidnext > 0)
- {
+ if ($objectidnext > 0) {
$facthatreplace=new Facture($db);
- $facthatreplace->fetch($facidnext);
- print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
+ $facthatreplace->fetch($objectidnext);
+ print ' '.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).' ';
}
*/
print ' ';
- // Discounts
- print ''.$langs->trans('Discounts').' ';
+ // Relative and absolute discounts
+ print ''."\n";
+ print ' '.$langs->trans('DiscountStillRemaining').' ';
if ($type == 'bank-transfer') {
//$societe = new Fournisseur($db);
@@ -667,7 +669,7 @@ if ($object->id > 0) {
// Total with tax
print ' '.$langs->trans('AmountTTC').' '.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' ';
- $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// TODO Replace this by an include with same code to show already done payment visible in invoice card
print ''.$langs->trans('RemainderToPay').' '.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).' ';
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 207f806dc74..def6318ed95 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -102,15 +102,20 @@ print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'bill');
print '';
-//print getCustomerInvoicePieChart($socid);
print getNumberInvoicesPieChart('customers');
print ' ';
-print getNumberInvoicesPieChart('fourn');
-//print getPurchaseInvoicePieChart($socid);
-print ' ';
+
+if (!empty($conf->fournisseur->enabled)) {
+ print getNumberInvoicesPieChart('fourn');
+ print ' ';
+}
+
print getCustomerInvoiceDraftTable($max, $socid);
-print ' ';
-print getDraftSupplierTable($max, $socid);
+
+if (!empty($conf->fournisseur->enabled)) {
+ print ' ';
+ print getDraftSupplierTable($max, $socid);
+}
print '
';
diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php
index 234073cdb38..28d095715c2 100644
--- a/htdocs/compta/localtax/index.php
+++ b/htdocs/compta/localtax/index.php
@@ -293,7 +293,7 @@ $mend = $tmp['mon'];
$total = 0;
$subtotalcoll = 0;
-$subtotalpaye = 0;
+$subtotalpaid = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
@@ -536,7 +536,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '
'.price(price2num($x_paye_sum, 'MT')).' ';
$subtotalcoll = $subtotalcoll + $x_coll_sum;
- $subtotalpaye = $subtotalpaye + $x_paye_sum;
+ $subtotalpaid = $subtotalpaid + $x_paye_sum;
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
@@ -552,12 +552,12 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '
';
print ''.$langs->trans("SubTotal").' : ';
print ''.price(price2num($subtotalcoll, 'MT')).' ';
- print ''.price(price2num($subtotalpaye, 'MT')).' ';
+ print ''.price(price2num($subtotalpaid, 'MT')).' ';
print ''.price(price2num($subtotal, 'MT')).' ';
print ' ';
$i = 0;
$subtotalcoll = 0;
- $subtotalpaye = 0;
+ $subtotalpaid = 0;
$subtotal = 0;
}
}
diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php
index 2306e99899b..bd5c114e983 100644
--- a/htdocs/compta/paiement/card.php
+++ b/htdocs/compta/paiement/card.php
@@ -52,7 +52,7 @@ $hookmanager->initHooks(array('paymentcard', 'globalcard'));
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
-$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
+$result = restrictedArea($user, $object->element, $object->id, 'paiement');
// Security check
if ($user->socid) {
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index 451a18ab05b..3fb82f05cb9 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -200,8 +200,9 @@ class RemiseCheque extends CommonObject
}
}
+ $lines = array();
+
if ($this->id > 0 && $this->errno == 0) {
- $lines = array();
$sql = "SELECT b.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " WHERE b.fk_type = 'CHQ'";
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index ae4064462e2..f63d58db933 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -79,8 +79,8 @@ class Paiement extends CommonObject
public $pos_change = 0; // Excess received in TakePOS cash payment
public $author;
- public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement
- public $paiementcode; // Code of payment.
+ public $paiementid; // ID of mode of payment. Is saved into fields fk_paiement on llx_paiement = id of llx_c_paiement
+ public $paiementcode; // Code of mode of payment.
/**
* @var string Type of payment label
@@ -109,6 +109,16 @@ class Paiement extends CommonObject
*/
public $ext_payment_id;
+ /**
+ * @var string Id of prelevement
+ */
+ public $id_prelevement;
+
+ /**
+ * @var string num_prelevement
+ */
+ public $num_prelevement;
+
/**
* @var string Name of external payment mode
*/
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index 640ffc78d99..db48b2767f2 100644
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -291,7 +291,7 @@ if ($action == 'create') {
print "\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
- $totalrecu += $objp->am;
+ $totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {
diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php
index 84d2765b278..645fd36bc2a 100644
--- a/htdocs/compta/paiement_vat.php
+++ b/htdocs/compta/paiement_vat.php
@@ -290,7 +290,7 @@ if ($action == 'create') {
print "\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
- $totalrecu += $objp->am;
+ $totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index df142fb6531..d60002f479d 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -78,6 +78,8 @@ class BonPrelevement extends CommonObject
public $statut; // 0-Wait, 1-Trans, 2-Done
public $labelStatus = array();
+ public $factures = array();
+
public $invoice_in_error = array();
public $thirdparty_in_error = array();
@@ -394,10 +396,10 @@ class BonPrelevement extends CommonObject
$amounts[$fac->id] = $facs[$i][1];
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
- $totalpaye = $fac->getSommePaiement();
+ $totalpaid = $fac->getSommePaiement();
$totalcreditnotes = $fac->getSumCreditNotesUsed();
$totaldeposits = $fac->getSumDepositsUsed();
- $alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
+ $alreadypayed = $totalpaid + $totalcreditnotes + $totaldeposits;
// @TODO Move this after creation of payment
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
@@ -913,6 +915,7 @@ class BonPrelevement extends CommonObject
$this->db->begin();
$now = dol_now();
+ $ref = '';
/*
* Process order generation
@@ -1243,13 +1246,6 @@ class BonPrelevement extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('myobjectdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -1492,7 +1488,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, '
'.$i.' '.$CrLf);
fputs($this->file, '
'.$this->total.' '.$CrLf);
fputs($this->file, '
'.$CrLf);
- fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).' '.$CrLf);
+ fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf);
fputs($this->file, ' '.$CrLf);
fputs($this->file, ' '.$CrLf);
fputs($this->file, ' '.$CrLf);
@@ -1608,7 +1604,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' '.$i.' '.$CrLf);
fputs($this->file, ' '.$this->total.' '.$CrLf);
fputs($this->file, ' '.$CrLf);
- fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).' '.$CrLf);
+ fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf);
fputs($this->file, ' '.$CrLf);
fputs($this->file, ' '.$CrLf);
fputs($this->file, ' '.$CrLf);
@@ -1858,16 +1854,16 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
- $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).' '.$CrLf;
+ $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom)))).' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$row_country_code.' '.$CrLf;
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
if (trim($addressline1)) {
- $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if (trim($addressline2)) {
- $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
@@ -1927,16 +1923,16 @@ class BonPrelevement extends CommonObject
$XML_CREDITOR .= ' '.$CrLf;
$XML_CREDITOR .= ' '.$CrLf;
$XML_CREDITOR .= ' '.$CrLf;
- $XML_CREDITOR .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).' '.$CrLf;
+ $XML_CREDITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom)))).' '.$CrLf;
$XML_CREDITOR .= ' '.$CrLf;
$XML_CREDITOR .= ' '.$row_country_code.' '.$CrLf;
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
if (trim($addressline1)) {
- $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if (trim($addressline2)) {
- $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_CREDITOR .= ' '.$CrLf;
$XML_CREDITOR .= ' '.$CrLf;
@@ -2100,16 +2096,16 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$dateTime_ETAD.' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""));
if ($addressline1) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if ($addressline2) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
@@ -2124,11 +2120,11 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
/* $XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS.' ').$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;*/
$XML_SEPA_INFO .= ' SLEV '.$CrLf; // Field "Responsible of fees". Must be SLEV
@@ -2166,16 +2162,16 @@ class BonPrelevement extends CommonObject
}
$XML_SEPA_INFO .= ' '.dol_print_date($dateTime_ETAD, 'dayrfc').' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""));
if ($addressline1) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if ($addressline2) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
@@ -2190,11 +2186,11 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
/* $XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS).' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;*/
$XML_SEPA_INFO .= ' SLEV '.$CrLf; // Field "Responsible of fees". Must be SLEV
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index d98a6aab251..8b2bf351094 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -158,7 +158,7 @@ if ($id > 0) {
print $fac->error." ";
continue;
}
- $totalpaye = $fac->getSommePaiement();
+ $totalpaid = $fac->getSommePaiement();
$userstatic->id = $objf->userid;
$userstatic->login = $objf->login;
@@ -168,7 +168,7 @@ if ($id > 0) {
'date' => $fac->date,
'datefieldforsort' => $fac->date.'-'.$fac->ref,
'link' => $fac->getNomUrl(1),
- 'status' => $fac->getLibStatut(2, $totalpaye),
+ 'status' => $fac->getLibStatut(2, $totalpaid),
'amount' => $fac->total_ttc,
'author' => $userstatic->getLoginUrl(1)
);
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index b586d4c88a6..900f1a179e9 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -166,8 +166,8 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
// Delete social contribution
if ($action == 'confirm_delete' && $confirm == 'yes') {
$object->fetch($id);
- $totalpaye = $object->getSommePaiement();
- if (empty($totalpaye)) {
+ $totalpaid = $object->getSommePaiement();
+ if (empty($totalpaid)) {
$result = $object->delete($user);
if ($result > 0) {
header("Location: list.php");
@@ -454,7 +454,7 @@ if ($id > 0) {
if ($result > 0) {
$head = tax_prepare_head($object);
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
// Clone confirmation
if ($action === 'clone') {
@@ -551,11 +551,11 @@ if ($id > 0) {
$morehtmlref .= '';
$morehtmlref .= ' ';
$morehtmlref .= ' ';
- $morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'fk_project', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
+ $morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'fk_project', 0, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= ' ';
$morehtmlref .= ' ';
} else {
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, 0, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (!empty($object->fk_project)) {
@@ -576,7 +576,7 @@ if ($id > 0) {
$linkback = ''.$langs->trans("BackToList").' ';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@@ -690,7 +690,7 @@ if ($id > 0) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
- $totalpaye = 0;
+ $totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0;
@@ -748,7 +748,7 @@ if ($id > 0) {
}
print ''.price($objp->amount)." \n";
print "";
- $totalpaye += $objp->amount;
+ $totalpaid += $objp->amount;
$i++;
}
} else {
@@ -757,10 +757,10 @@ if ($id > 0) {
print '';
}
- print ''.$langs->trans("AlreadyPaid").' : '.price($totalpaye)." \n";
+ print ''.$langs->trans("AlreadyPaid").' : '.price($totalpaid)." \n";
print ''.$langs->trans("AmountExpected").' : '.price($object->amount)." \n";
- $resteapayer = $object->amount - $totalpaye;
+ $resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print ''.$langs->trans("RemainderToPay")." : ";
@@ -820,7 +820,7 @@ if ($id > 0) {
}
// Delete
- if ($user->rights->tax->charges->supprimer && empty($totalpaye)) {
+ if ($user->rights->tax->charges->supprimer && empty($totalpaid)) {
print '';
} else {
print '';
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 70d8da4c27b..3b9019868ec 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -113,6 +113,12 @@ class ChargeSociales extends CommonObject
*/
public $fk_user;
+ /**
+ * @var double total
+ */
+ public $total;
+
+ public $totalpaid;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index b6a611a47ee..1b83915714d 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -100,6 +100,22 @@ class PaymentSocialContribution extends CommonObject
*/
public $fk_user_modif;
+ /**
+ * @var int ID
+ */
+ public $chid;
+
+ /**
+ * @var integer|string datepaye
+ */
+ public $datepaye;
+
+ /**
+ * @var integer|string paiementtype
+ */
+ public $paiementtype;
+
+
/**
* Constructor
*
diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php
index 6918b2c84ee..3de8687433f 100644
--- a/htdocs/compta/sociales/document.php
+++ b/htdocs/compta/sociales/document.php
@@ -139,7 +139,9 @@ if ($object->id) {
$linkback = ''.$langs->trans("BackToList").' ';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+
+ $morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php
index 4c49a3008c6..8363459171b 100644
--- a/htdocs/compta/sociales/info.php
+++ b/htdocs/compta/sociales/info.php
@@ -81,6 +81,8 @@ $object->info($id);
$head = tax_prepare_head($object);
+$alreadypayed = $object->getSommePaiement();
+
print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
$morehtmlref = '';
@@ -106,8 +108,9 @@ $morehtmlref .= '
';
$linkback = ''.$langs->trans("BackToList").' ';
-$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '';
diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php
index cf9d0cbdec5..0447d3168b1 100644
--- a/htdocs/compta/sociales/note.php
+++ b/htdocs/compta/sociales/note.php
@@ -113,7 +113,9 @@ if ($id > 0 || !empty($ref)) {
// ------------------------------------------------------------
$linkback = '
'.$langs->trans("BackToList").' ';
- //$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ //$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+
+ $morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php
index 43e9d5d4668..d2646d241ea 100644
--- a/htdocs/compta/sociales/payments.php
+++ b/htdocs/compta/sociales/payments.php
@@ -137,7 +137,7 @@ print '
';
$sql = "SELECT c.id, c.libelle as type_label,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
-$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
+$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " u.rowid uid, u.lastname, u.firstname, u.email, u.login, u.admin,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos";
@@ -253,7 +253,7 @@ if (!$resql) {
$i = 0;
$total = 0;
$totalnb = 0;
-$totalpaye = 0;
+$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@@ -346,8 +346,8 @@ while ($i < min($num, $limit)) {
// Paid
print '
';
- if ($obj->totalpaye) {
- print ''.price($obj->totalpaye).' ';
+ if ($obj->totalpaid) {
+ print ''.price($obj->totalpaid).' ';
}
print ' ';
@@ -357,7 +357,7 @@ while ($i < min($num, $limit)) {
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
- $totalpaye = $totalpaye + $obj->totalpaye;
+ $totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
@@ -373,7 +373,7 @@ if (!empty($conf->banque->enabled)) {
print '
';
print '
';
}
-print '
'.price($totalpaye)." ";
+print '
'.price($totalpaid)." ";
print '
';
print "
";
diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php
index 0bef7ff555a..1df7ae4db62 100644
--- a/htdocs/compta/stats/casoc.php
+++ b/htdocs/compta/stats/casoc.php
@@ -179,6 +179,7 @@ $allparams = array_merge($commonparams, $headerparams, $tableparams);
$headerparams = array_merge($commonparams, $headerparams);
$tableparams = array_merge($commonparams, $tableparams);
+$paramslink="";
foreach ($allparams as $key => $value) {
$paramslink .= '&'.$key.'='.$value;
}
@@ -202,6 +203,9 @@ if ($modecompta == "BOOKKEEPINGCOLLECTED") {
$modecompta = "RECETTES-DEPENSES";
}
+$exportlink="";
+$namelink="";
+
// Show report header
if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("Turnover").', '.$langs->trans("ByThirdParties");
diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index e7ec8c61db7..b99002fe609 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -144,6 +144,8 @@ llxHeader();
$form = new Form($db);
+$exportlink="";
+$namelink="";
// Affiche en-tete du rapport
if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("Turnover");
@@ -254,6 +256,11 @@ $sql .= " ORDER BY dm";
$minyearmonth = $maxyearmonth = 0;
+$cum = array();
+$cum_ht = array();
+$total_ht = array();
+$total = array();
+
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
@@ -395,6 +402,12 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
$case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m");
$caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage - 1), "%Y-%m");
+ $total_ht[$annee]=0;
+ $total[$annee]=0;
+ $cum_ht[$case]=0;
+ $cum[$case]=0;
+
+
if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
if ($modecompta == 'CREANCES-DETTES') {
// Value turnover of month w/o VAT
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index 26f8e754dd2..e40b9b9b409 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -273,9 +273,9 @@ if ($action == 'add' && !$cancel) {
if ($action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->fetch($id);
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
- if (empty($totalpaye)) {
+ if (empty($totalpaid)) {
$db->begin();
$ret = $object->delete($user);
@@ -540,7 +540,7 @@ if ($action == 'create') {
if ($id > 0) {
$head = vat_prepare_head($object);
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
// Clone confirmation
if ($action === 'clone') {
@@ -580,7 +580,7 @@ if ($id > 0) {
$linkback = ''.$langs->trans("BackToList").' ';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
@@ -683,7 +683,7 @@ if ($id > 0) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
- $totalpaye = 0;
+ $totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0;
@@ -735,7 +735,7 @@ if ($id > 0) {
}
print ''.price($objp->amount)." \n";
print "";
- $totalpaye += $objp->amount;
+ $totalpaid += $objp->amount;
$i++;
}
} else {
@@ -744,10 +744,10 @@ if ($id > 0) {
print '';
}
- print ''.$langs->trans("AlreadyPaid")." : ".price($totalpaye)." \n";
+ print ''.$langs->trans("AlreadyPaid")." : ".price($totalpaid)." \n";
print ''.$langs->trans("AmountExpected")." : ".price($object->amount)." \n";
- $resteapayer = $object->amount - $totalpaye;
+ $resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print ''.$langs->trans("RemainderToPay")." : ";
@@ -810,7 +810,7 @@ if ($id > 0) {
print '";
}
- if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaye)) {
+ if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
print '';
} else {
print '';
diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php
index 8eaf141b06c..b7500fffaa0 100644
--- a/htdocs/compta/tva/class/paymentvat.class.php
+++ b/htdocs/compta/tva/class/paymentvat.class.php
@@ -96,6 +96,28 @@ class PaymentVAT extends CommonObject
*/
public $fk_user_modif;
+ /**
+ * @var int ID
+ */
+ public $chid;
+
+ /**
+ * @var string lib
+ * @deprecated
+ * @see $label
+ */
+ public $lib;
+
+ /**
+ * @var integer|string datepaye
+ */
+ public $datepaye;
+
+ /**
+ * @var integer|string paiementtype
+ */
+ public $paiementtype;
+
/**
* Constructor
*
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index 30682fa15b4..f54ed42fb06 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -49,6 +49,12 @@ class Tva extends CommonObject
*/
public $picto = 'payment';
+ /**
+ * @deprecated
+ * @see $amount
+ */
+ public $total;
+
public $tms;
public $datep;
public $datev;
@@ -56,6 +62,11 @@ class Tva extends CommonObject
public $type_payment;
public $num_payment;
+ /**
+ * @var integer|string totalpaid
+ */
+ public $totalpaid;
+
/**
* @var string label
*/
@@ -81,6 +92,11 @@ class Tva extends CommonObject
*/
public $fk_user_modif;
+ /**
+ * @var integer|string paiementtype
+ */
+ public $paiementtype;
+
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php
index a0573cf2812..22b3f988a70 100644
--- a/htdocs/compta/tva/document.php
+++ b/htdocs/compta/tva/document.php
@@ -125,8 +125,9 @@ if ($object->id) {
$linkback = ''.$langs->trans("BackToList").' ';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '';
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index fed0cf209c1..16b24361160 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -255,7 +255,7 @@ if ($refresh === true) {
//var_dump($m);
$total = 0;
$subtotalcoll = 0;
- $subtotalpaye = 0;
+ $subtotalpaid = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
@@ -481,7 +481,7 @@ if ($refresh === true) {
print '
' . price(price2num($x_paye_sum, 'MT')) . ' ';
$subtotalcoll = $subtotalcoll + $x_coll_sum;
- $subtotalpaye = $subtotalpaye + $x_paye_sum;
+ $subtotalpaid = $subtotalpaid + $x_paye_sum;
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
@@ -498,12 +498,12 @@ if ($refresh === true) {
print '
';
print '' . $langs->trans("SubTotal") . ' : ';
print '' . price(price2num($subtotalcoll, 'MT')) . ' ';
- print '' . price(price2num($subtotalpaye, 'MT')) . ' ';
+ print '' . price(price2num($subtotalpaid, 'MT')) . ' ';
print '' . price(price2num($subtotal, 'MT')) . ' ';
print ' ';
$i = 0;
$subtotalcoll = 0;
- $subtotalpaye = 0;
+ $subtotalpaid = 0;
$subtotal = 0;
}
}
diff --git a/htdocs/compta/tva/payments.php b/htdocs/compta/tva/payments.php
index cf91df3a775..0279acdeaa4 100644
--- a/htdocs/compta/tva/payments.php
+++ b/htdocs/compta/tva/payments.php
@@ -5,7 +5,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro
* Copyright (C) 2011-2014 Juanjo Menent
* Copyright (C) 2015 Jean-François Ferry
- * Copyright (C) 2021 Gauthier VERDOL
+ * Copyright (C) 2021 Gauthier VERDOL
*
* 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
@@ -141,7 +141,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$sql = "SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
$sql .= ", tva.datev";
$sql .= ", tva.amount as total,";
- $sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaye, ptva.num_paiement as num_payment,";
+ $sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
$sql .= " pct.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva,";
$sql .= " ".MAIN_DB_PREFIX."payment_vat as ptva";
@@ -175,11 +175,15 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$i = 0;
$total = 0;
$totalnb = 0;
- $totalpaye = 0;
+ $totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
+ $tva->id = $obj->rowid;
+ $tva->ref = $obj->rowid;
+ $tva->label = $obj->label;
+
$payment_vat_static->id = $obj->pid;
$payment_vat_static->ref = $obj->pid;
@@ -190,31 +194,32 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
// VAT
print '';
- $tva->id = $obj->rowid;
- $tva->ref = $obj->rowid;
- $tva->label = $obj->label;
print $tva->getNomUrl(1, '20');
print ' ';
// Label
- print ''.$obj->label.' ';
+ print ''.dol_escape_htmltag($obj->label).' ';
// Date
- $date = $obj->datev;
- print ''.dol_print_date($date, 'day').' ';
+ $date = $db->jdate($obj->datev);
+ print ''.dol_print_date($date, 'day').' ';
// Date payment
- print ''.dol_print_date($db->jdate($obj->datep), 'day').' ';
+ $datep = $db->jdate($obj->datep);
+ print ''.dol_print_date($datep, 'day').' ';
// Type payment
- print '';
+ $labelpaymenttype = '';
if ($obj->payment_code) {
- print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
+ $labelpaymenttype = $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
}
+
+ print ' ';
+ print dol_escape_htmltag($labelpaymenttype);
print ' ';
// Chq number
- print ''.$obj->num_payment.' ';
+ print ''.dol_escape_htmltag($obj->num_payment).' ';
if (!empty($conf->banque->enabled)) {
// Bank transaction
@@ -231,21 +236,20 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print '';
}
- // Type
- //print ''.$obj->type_label.' ';
// Expected to pay
print ''.price($obj->total).' ';
+
// Paid
print '';
- if ($obj->totalpaye) {
- print price($obj->totalpaye);
+ if ($obj->totalpaid) {
+ print price($obj->totalpaid);
}
print ' ';
print ' ';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
- $totalpaye = $totalpaye + $obj->totalpaye;
+ $totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
@@ -260,7 +264,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
}
print ' ';
print ' ';
- print ''.price($totalpaye)." ";
+ print ''.price($totalpaid)." ";
print "";
} else {
dol_print_error($db);
diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php
index 0eed6ba6219..98b6ccea3b1 100644
--- a/htdocs/contact/agenda.php
+++ b/htdocs/contact/agenda.php
@@ -251,17 +251,17 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$objthirdparty = $object->thirdparty;
$out = '';
- $permok = $user->rights->agenda->myactions->create;
- if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
- if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
- $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '');
- }
- $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&origin=contact&originid='.$object->id.'&percentage=-1&backtopage='.urlencode($_SERVER['PHP_SELF'].($objcon->id > 0 ? '?id='.$objcon->id : ''));
- $out .= '&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog'));
- }
-
$newcardbutton = '';
if (!empty($conf->agenda->enabled)) {
+ $permok = $user->rights->agenda->myactions->create;
+ if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
+ if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
+ $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '');
+ }
+ $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&origin=contact&originid='.$object->id.'&percentage=-1&backtopage='.urlencode($_SERVER['PHP_SELF'].($objcon->id > 0 ? '?id='.$objcon->id : ''));
+ $out .= '&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog'));
+ }
+
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 1cef1901917..cd12fd12150 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@@ -235,6 +236,9 @@ if (empty($reshook)) {
$object->birthday = dol_mktime(0, 0, 0, GETPOST("birthdaymonth", 'int'), GETPOST("birthdayday", 'int'), GETPOST("birthdayyear", 'int'));
$object->birthday_alert = GETPOST("birthday_alert", 'alpha');
+ //Default language
+ $object->default_lang = GETPOST('default_lang');
+
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
@@ -437,6 +441,9 @@ if (empty($reshook)) {
$object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
+ //Default language
+ $object->default_lang = GETPOST('default_lang');
+
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
if ($ret < 0) {
@@ -557,6 +564,7 @@ if (empty($reshook)) {
*/
$form = new Form($db);
+$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
@@ -635,7 +643,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->country = $tmparray['label'];
}
- $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
+ $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
$linkback = '';
print load_fiche_titre($title, $linkback, 'address');
@@ -872,6 +880,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $form->selectarray('priv', $selectarray, (GETPOST("priv", 'alpha') ?GETPOST("priv", 'alpha') : $object->priv), 0);
print '';
+ //Default language
+ if (!empty($conf->global->MAIN_MULTILANGS)) {
+ print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).' '."\n";
+ print $formadmin->select_language(GETPOST('default_lang', 'alpha') ?GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone', 0, 0, 0, null, 1);
+
+ print ' ';
+ print ' ';
+ }
+
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print ''.$form->editfieldkey('Categories', 'contcats', '', $object, 0).' ';
@@ -1151,6 +1168,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $form->selectarray('priv', $selectarray, $object->priv, 0);
print ' ';
+ //Default language
+ if (!empty($conf->global->MAIN_MULTILANGS)) {
+ print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).' '."\n";
+ print $formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1);
+
+ print ' ';
+ print ' ';
+ }
+
// Note Public
print ''.$langs->trans("NotePublic").' ';
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
@@ -1363,6 +1389,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
}
+ // Default language
+ if (!empty($conf->global->MAIN_MULTILANGS)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ print ''.$langs->trans("DefaultLang").' ';
+ //$s=picto_from_langcode($object->default_lang);
+ //print ($s?$s.' ':'');
+ $langs->load("languages");
+ $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang.'_'.strtoupper($object->default_lang)) : '');
+ print $labellang;
+ print ' ';
+ }
+
print ''.$langs->trans("ContactVisibility").' ';
print $object->LibPubPriv($object->priv);
print ' ';
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 587972fa83b..9fa3602ee4b 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -130,6 +130,13 @@ class Contact extends CommonObject
public $civility_code;
public $civility;
+ /**
+ * @var string The civilite code, not an integer
+ * @deprecated
+ * @see $civility_code
+ */
+ public $civilite;
+
/**
* @var string Address
*/
@@ -1468,13 +1475,6 @@ class Contact extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('contactdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
}
$linkstart = '';
if ($object->thirdparty->client) {
$thirdTypeArray['customer'] = $langs->trans("customer");
- if ($conf->propal->enabled && $user->rights->propal->lire) {
+ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
- if ($conf->commande->enabled && $user->rights->commande->lire) {
+ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
- if ($conf->facture->enabled && $user->rights->facture->lire) {
+ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
- if ($conf->contrat->enabled && $user->rights->contrat->lire) {
+ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
}
@@ -366,7 +366,7 @@ $param .= "&socid=".urlencode($socid);
$param .= "&type_element=".urlencode($type_element);
$total_qty = 0;
-
+$num=0;
if ($sql_select) {
$resql = $db->query($sql);
if (!$resql) {
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 93d61f8a903..e68274ecff2 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -132,31 +132,31 @@ if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('b
}
$offset = $limit * $page;
-$titre = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
+$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
if ($type == "p") {
if (empty($contextpage) || $contextpage == 'contactlist') {
$contextpage = 'contactprospectlist';
}
- $titre .= ' ('.$langs->trans("ThirdPartyProspects").')';
+ $title .= ' ('.$langs->trans("ThirdPartyProspects").')';
$urlfiche = "card.php";
}
if ($type == "c") {
if (empty($contextpage) || $contextpage == 'contactlist') {
$contextpage = 'contactcustomerlist';
}
- $titre .= ' ('.$langs->trans("ThirdPartyCustomers").')';
+ $title .= ' ('.$langs->trans("ThirdPartyCustomers").')';
$urlfiche = "card.php";
} elseif ($type == "f") {
if (empty($contextpage) || $contextpage == 'contactlist') {
$contextpage = 'contactsupplierlist';
}
- $titre .= ' ('.$langs->trans("ThirdPartySuppliers").')';
+ $title .= ' ('.$langs->trans("ThirdPartySuppliers").')';
$urlfiche = "card.php";
} elseif ($type == "o") {
if (empty($contextpage) || $contextpage == 'contactlist') {
$contextpage = 'contactotherlist';
}
- $titre .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
+ $title .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
$urlfiche = "";
}
@@ -709,7 +709,7 @@ print ' ';
print ' ';
print ' ';
-print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1);
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information";
$modelmail = "contact";
diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php
index b725ef6f3f4..71483f6b1aa 100644
--- a/htdocs/contrat/admin/contract_extrafields.php
+++ b/htdocs/contrat/admin/contract_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php
index 70d3193c12f..cc4cf23e37b 100644
--- a/htdocs/contrat/admin/contractdet_extrafields.php
+++ b/htdocs/contrat/admin/contractdet_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 7ad5ceedb85..d17f5399679 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -264,10 +264,6 @@ if (empty($reshook)) {
}
$id = $object->create($user);
- if ($id < 0) {
- setEventMessages($object->error, $object->errors, 'errors');
- }
-
if ($id > 0) {
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
@@ -379,6 +375,9 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
+ if ($error) {
+ $action = 'create';
+ }
} else {
$result = $object->create($user);
if ($result > 0) {
diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php
index 5e534f3e43c..ea228550cae 100644
--- a/htdocs/contrat/class/api_contracts.class.php
+++ b/htdocs/contrat/class/api_contracts.class.php
@@ -278,8 +278,8 @@ class Contracts extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->price_base_type = checkVal($request_data->price_base_type);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->price_base_type = sanitizeVal($request_data->price_base_type);
$updateRes = $this->contract->addline(
$request_data->desc,
@@ -336,8 +336,8 @@ class Contracts extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
- $request_data->price_base_type = checkVal($request_data->price_base_type);
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
+ $request_data->price_base_type = sanitizeVal($request_data->price_base_type);
$updateRes = $this->contract->updateline(
$lineid,
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 85b854f8ba7..b90f3c8ebd0 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -28,8 +28,14 @@
// $permissiontodelete must be defined
// $backurlforlist must be defined
// $backtopage may be defined
+// $noback may be defined
// $triggermodname may be defined
+$hidedetails = isset($hidedetails) ? $hidedetails : '';
+$hidedesc = isset($hidedesc) ? $hidedesc : '';
+$hideref = isset($hideref) ? $hideref : '';
+
+
if (!empty($permissionedit) && empty($permissiontoadd)) {
$permissiontoadd = $permissionedit; // For backward compatibility
}
@@ -137,8 +143,11 @@ if ($action == 'add' && !empty($permissiontoadd)) {
}
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
- header("Location: ".$urltogo);
- exit;
+
+ if (!empty($noback)) {
+ header("Location: " . $urltogo);
+ exit;
+ }
} else {
$error++;
// Creation KO
@@ -311,8 +320,10 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');
- header("Location: ".$backurlforlist);
- exit;
+ if (!empty($noback)) {
+ header("Location: " . $backurlforlist);
+ exit;
+ }
} else {
$error++;
if (!empty($object->errors)) {
@@ -355,8 +366,10 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
- exit;
+ if (!empty($noback)) {
+ header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
+ exit;
+ }
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
@@ -373,10 +386,10 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
if (method_exists($object, 'generateDocument')) {
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
+ if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
@@ -494,8 +507,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
$newid = $result;
}
- header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
- exit;
+ if (!empty($noback)) {
+ header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $newid); // Open record of new object
+ exit;
+ }
} else {
$error++;
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php
index ce9ae57864d..994ba5c42f3 100644
--- a/htdocs/core/ajax/onlineSign.php
+++ b/htdocs/core/ajax/onlineSign.php
@@ -129,8 +129,12 @@ if ($action == "importSignature") {
$pdf->AddPage();
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF
- $tppl = $pdf->importPage(1);
- $pdf->useTemplate($tppl);
+ for ($i=1;$i<($pagecount+1);$i++) {
+ if ($i>1) $pdf->AddPage();
+ $tppl=$pdf->importPage($i);
+ $pdf->useTemplate($tppl);
+ }
+
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
$pdf->Close();
$pdf->Output($newpdffilename, "F");
diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php
index 88d930e9e27..6b25f5d84d0 100644
--- a/htdocs/core/boxes/box_graph_nb_tickets_type.php
+++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php
@@ -131,7 +131,7 @@ class box_graph_nb_tickets_type extends ModeleBoxes
}
foreach ($listofoppcode as $rowid => $code) {
$dataseries[] = array(
- 'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_category', 'code', 'label', $code),
+ 'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_type', 'code', 'label', $code),
'data' => (empty($data[$code]) ? 0 : $data[$code])
);
}
diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php
index 3c8756cf544..c668894d991 100644
--- a/htdocs/core/boxes/box_graph_ticket_by_severity.php
+++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php
@@ -152,7 +152,7 @@ class box_graph_ticket_by_severity extends ModeleBoxes
}
foreach ($listofoppcode as $rowid => $code) {
$dataseries[] = array(
- 'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_category', 'code', 'label', $code),
+ 'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_severity', 'code', 'label', $code),
'data' => (empty($data[$code]) ? 0 : $data[$code])
);
}
diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php
deleted file mode 100644
index e091d58643b..00000000000
--- a/htdocs/core/boxes/box_members.php
+++ /dev/null
@@ -1,195 +0,0 @@
-
- * Copyright (C) 2004-2017 Laurent Destailleur
- * Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2015-2020 Frederic France
- *
- * 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 .
- */
-
-/**
- * \file htdocs/core/boxes/box_members.php
- * \ingroup adherent
- * \brief Module to show box of members
- */
-
-include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
-
-
-/**
- * Class to manage the box to show last members
- */
-class box_members extends ModeleBoxes
-{
- public $boxcode = "lastmembers";
- public $boximg = "object_user";
- public $boxlabel = "BoxLastMembers";
- public $depends = array("adherent");
-
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
- public $param;
- public $enabled = 1;
-
- public $info_box_head = array();
- public $info_box_contents = array();
-
-
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- * @param string $param More parameters
- */
- public function __construct($db, $param = '')
- {
- global $conf, $user;
-
- $this->db = $db;
-
- // disable module for such cases
- $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
- if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
- $this->enabled = 0; // disabled for external users
- }
-
- $this->hidden = !($user->rights->adherent->lire);
- }
-
- /**
- * Load data into info_box_contents array to show array later.
- *
- * @param int $max Maximum number of records to load
- * @return void
- */
- public function loadBox($max = 5)
- {
- global $user, $langs, $conf;
- $langs->load("boxes");
-
- $this->max = $max;
-
- include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $memberstatic = new Adherent($this->db);
-
- $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max));
-
- if ($user->rights->adherent->lire) {
- $sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
- $sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
- $sql .= ' a.photo, a.email, a.gender, a.morphy,';
- $sql .= " t.subscription, t.libelle as label";
- $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
- $sql .= " WHERE a.entity IN (".getEntity('member').")";
- $sql .= " AND a.fk_adherent_type = t.rowid";
- $sql .= " ORDER BY a.tms DESC";
- $sql .= $this->db->plimit($max, 0);
-
- $result = $this->db->query($sql);
- if ($result) {
- $num = $this->db->num_rows($result);
-
- $line = 0;
- while ($line < $num) {
- $objp = $this->db->fetch_object($result);
- $datec = $this->db->jdate($objp->datec);
- $datem = $this->db->jdate($objp->tms);
-
- $memberstatic->lastname = $objp->lastname;
- $memberstatic->firstname = $objp->firstname;
- $memberstatic->id = $objp->rowid;
- $memberstatic->ref = $objp->ref;
- $memberstatic->photo = $objp->photo;
- $memberstatic->gender = $objp->gender;
- $memberstatic->email = $objp->email;
- $memberstatic->morphy = $objp->morphy;
- $memberstatic->company = $objp->company;
- $memberstatic->statut = $objp->status;
- $memberstatic->date_creation = $datec;
- $memberstatic->date_modification = $datem;
- $memberstatic->need_subscription = $objp->subscription;
- $memberstatic->datefin = $this->db->jdate($objp->date_end_subscription);
-
- if (!empty($objp->fk_soc)) {
- $memberstatic->socid = $objp->fk_soc;
- $memberstatic->fetch_thirdparty();
- $memberstatic->name = $memberstatic->thirdparty->name;
- } else {
- $memberstatic->name = $objp->company;
- }
-
- $this->info_box_contents[$line][] = array(
- 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
- 'text' => $memberstatic->getNomUrl(-1),
- 'asis' => 1,
- );
-
- $this->info_box_contents[$line][] = array(
- 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
- 'text' => $memberstatic->company,
- 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid,
- );
-
- $this->info_box_contents[$line][] = array(
- 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
- 'text' => dol_print_date($datem, "day", 'tzuserrel'),
- );
-
- $this->info_box_contents[$line][] = array(
- 'td' => 'class="right" width="18"',
- 'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $this->db->jdate($objp->date_end_subscription), 3),
- );
-
- $line++;
- }
-
- if ($num == 0) {
- $this->info_box_contents[$line][0] = array(
- 'td' => 'class="center"',
- 'text'=>$langs->trans("NoRecordedCustomers"),
- );
- }
-
- $this->db->free($result);
- } else {
- $this->info_box_contents[0][0] = array(
- 'td' => '',
- 'maxlength'=>500,
- 'text' => ($this->db->error().' sql='.$sql),
- );
- }
- } else {
- $this->info_box_contents[0][0] = array(
- 'td' => 'class="nohover opacitymedium left"',
- 'text' => $langs->trans("ReadPermissionNotAllowed")
- );
- }
- }
-
- /**
- * Method to show box
- *
- * @param array $head Array with properties of box title
- * @param array $contents Array with properties of box lines
- * @param int $nooutput No print, only return string
- * @return string
- */
- public function showBox($head = null, $contents = null, $nooutput = 0)
- {
- return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
- }
-}
diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php
index cf70bcafcb1..6b4a033f1a2 100644
--- a/htdocs/core/boxes/box_members_last_modified.php
+++ b/htdocs/core/boxes/box_members_last_modified.php
@@ -28,7 +28,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
- * Class to manage the box to show last modofied members
+ * Class to manage the box to show last modified members
*/
class box_members_last_modified extends ModeleBoxes
{
@@ -92,7 +92,7 @@ class box_members_last_modified extends ModeleBoxes
if ($user->rights->adherent->lire) {
$sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
- $sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
+ $sql .= " a.datec, a.tms as datem, a.statut as status, a.datefin as date_end_subscription,";
$sql .= ' a.photo, a.email, a.gender, a.morphy,';
$sql .= " t.rowid as typeid, t.subscription, t.libelle as label";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
@@ -121,6 +121,8 @@ class box_members_last_modified extends ModeleBoxes
$memberstatic->morphy = $objp->morphy;
$memberstatic->company = $objp->company;
$memberstatic->statut = $objp->status;
+ $memberstatic->date_creation = $datec;
+ $memberstatic->date_modification = $datem;
$memberstatic->need_subscription = $objp->subscription;
$memberstatic->datefin = $this->db->jdate($objp->date_end_subscription);
if (!empty($objp->fk_soc)) {
@@ -140,6 +142,11 @@ class box_members_last_modified extends ModeleBoxes
'asis' => 1,
);
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
+ 'text' =>$memberstatic->company,
+ );
+
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $statictype->getNomUrl(1, 32),
@@ -147,7 +154,7 @@ class box_members_last_modified extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
- 'td' => 'class="center nowraponall"',
+ 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel'),
);
diff --git a/htdocs/core/class/cgenericdic.class.php b/htdocs/core/class/cgenericdic.class.php
new file mode 100644
index 00000000000..ab1023b81f5
--- /dev/null
+++ b/htdocs/core/class/cgenericdic.class.php
@@ -0,0 +1,478 @@
+
+ * Copyright (C) 2014-2016 Juanjo Menent
+ * Copyright (C) 2016 Florian Henry
+ * Copyright (C) 2015 Raphaël Doursenaud
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/core/class/cgenericdic.class.php
+ * \ingroup resource
+ */
+
+/**
+ * Class CGenericDic
+ *
+ * @see CommonObject
+ */
+class CGenericDic
+{
+ /**
+ * @var string Id to identify managed objects
+ */
+ public $element = 'undefined'; // Will be defined into constructor
+
+ /**
+ * @var string Name of table without prefix where object is stored
+ */
+ public $table_element = 'undefined'; // Will be defined into constructor
+
+ /**
+ * @var CtyperesourceLine[] Lines
+ */
+ public $lines = array();
+
+ public $code;
+
+ /**
+ * @var string Type resource label
+ */
+ public $label;
+
+ public $active;
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDb $db Database handler
+ */
+ public function __construct(DoliDB $db)
+ {
+ $this->db = $db;
+
+ // Don't forget to set this->element and this->table_element after the construction
+ }
+
+ /**
+ * Create object into database
+ *
+ * @param User $user User that creates
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ *
+ * @return int <0 if KO, Id of created object if OK
+ */
+ public function create(User $user, $notrigger = false)
+ {
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $fieldlabel = 'label';
+ if ($this->table_element == 'c_stcomm') {
+ $fieldlabel = 'libelle';
+ }
+
+ $error = 0;
+
+ // Clean parameters
+
+ if (isset($this->code)) {
+ $this->code = trim($this->code);
+ }
+ if (isset($this->label)) {
+ $this->label = trim($this->label);
+ }
+ if (isset($this->active)) {
+ $this->active = trim($this->active);
+ }
+
+ // Insert request
+ $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'(';
+ $sql .= 'code,';
+ $sql .= $fieldlabel;
+ $sql .= 'active';
+ $sql .= ') VALUES (';
+ $sql .= ' '.(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").',';
+ $sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").',';
+ $sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active);
+ $sql .= ')';
+
+ $this->db->begin();
+
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+ }
+
+ if (!$error) {
+ $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
+
+ // Uncomment this and change CTYPERESOURCE to your own tag if you
+ // want this action to call a trigger.
+ //if (!$notrigger) {
+
+ // // Call triggers
+ // $result=$this->call_trigger('CTYPERESOURCE_CREATE',$user);
+ // if ($result < 0) $error++;
+ // // End call triggers
+ //}
+ }
+
+ // Commit or rollback
+ if ($error) {
+ $this->db->rollback();
+
+ return -1 * $error;
+ } else {
+ $this->db->commit();
+
+ return $this->id;
+ }
+ }
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param int $id Id object
+ * @param string $code code
+ * @param string $label Label
+ *
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ public function fetch($id, $code = '', $label = '')
+ {
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $fieldrowid = 'rowid';
+ $fieldlabel = 'label';
+ if ($this->table_element == 'c_stcomm') {
+ $fieldrowid = 'id';
+ $fieldlabel = 'libelle';
+ }
+
+ $sql = "SELECT";
+ $sql .= " t.".$fieldrowid.",";
+ $sql .= " t.code,";
+ $sql .= " t.".$fieldlabel." as label,";
+ $sql .= " t.active";
+ $sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
+ if ($id) {
+ $sql .= " WHERE t.".$fieldrowid." = ".((int) $id);
+ } elseif ($code) {
+ $sql .= " WHERE t.code = '".$this->db->escape($code)."'";
+ } elseif ($label) {
+ $sql .= " WHERE t.label = '".$this->db->escape($label)."'";
+ }
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $numrows = $this->db->num_rows($resql);
+ if ($numrows) {
+ $obj = $this->db->fetch_object($resql);
+
+ $this->id = $obj->$fieldrowid;
+
+ $this->code = $obj->code;
+ $this->label = $obj->label;
+ $this->active = $obj->active;
+ }
+
+ // Retrieve all extrafields for invoice
+ // fetch optionals attributes and labels
+ // $this->fetch_optionals();
+
+ // $this->fetch_lines();
+
+ $this->db->free($resql);
+
+ if ($numrows) {
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+
+ return -1;
+ }
+ }
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param string $sortorder Sort Order
+ * @param string $sortfield Sort field
+ * @param int $limit offset limit
+ * @param int $offset offset limit
+ * @param array $filter filter array
+ * @param string $filtermode filter mode (AND or OR)
+ *
+ * @return int <0 if KO, >0 if OK
+ */
+ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
+ {
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $fieldrowid = 'rowid';
+ $fieldlabel = 'label';
+ if ($this->table_element == 'c_stcomm') {
+ $fieldrowid = 'id';
+ $fieldlabel = 'libelle';
+ }
+
+ $sql = "SELECT";
+ $sql .= " t.".$fieldrowid.",";
+ $sql .= " t.code,";
+ $sql .= " t.".$fieldlabel." as label,";
+ $sql .= " t.active";
+ $sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
+
+ // Manage filter
+ $sqlwhere = array();
+ if (count($filter) > 0) {
+ foreach ($filter as $key => $value) {
+ $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
+ }
+ }
+
+ if (count($sqlwhere) > 0) {
+ $sql .= " WHERE ".implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
+ }
+ if (!empty($sortfield)) {
+ $sql .= $this->db->order($sortfield, $sortorder);
+ }
+ if (!empty($limit)) {
+ $sql .= $this->db->plimit($limit, $offset);
+ }
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+
+ while ($obj = $this->db->fetch_object($resql)) {
+ $line = new self($this->db);
+
+ $line->id = $obj->$fieldrowid;
+
+ $line->code = $obj->code;
+ $line->label = $obj->label;
+ $line->active = $obj->active;
+ }
+ $this->db->free($resql);
+
+ return $num;
+ } else {
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+
+ return -1;
+ }
+ }
+
+ /**
+ * Update object into database
+ *
+ * @param User $user User that modifies
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ *
+ * @return int <0 if KO, >0 if OK
+ */
+ public function update(User $user, $notrigger = false)
+ {
+ $error = 0;
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $fieldrowid = 'rowid';
+ $fieldlabel = 'label';
+ if ($this->table_element == 'c_stcomm') {
+ $fieldrowid = 'id';
+ $fieldlabel = 'libelle';
+ }
+
+ // Clean parameters
+
+ if (isset($this->code)) {
+ $this->code = trim($this->code);
+ }
+ if (isset($this->label)) {
+ $this->label = trim($this->label);
+ }
+ if (isset($this->active)) {
+ $this->active = trim($this->active);
+ }
+
+ // Check parameters
+ // Put here code to add a control on parameters values
+
+ // Update request
+ $sql = "UPDATE ".$this->db->prefix().$this->table_element.' SET';
+ $sql .= " code = ".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").',';
+ $sql .= " ".$fieldlabel." = ".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").',';
+ $sql .= " active = ".(isset($this->active) ? $this->active : "null");
+ $sql .= " WHERE ".$fieldrowid." = ".((int) $this->id);
+
+ $this->db->begin();
+
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+ }
+
+ // Uncomment this and change CTYPERESOURCE to your own tag if you
+ // want this action calls a trigger.
+ //if (!$error && !$notrigger) {
+
+ // // Call triggers
+ // $result=$this->call_trigger('CTYPERESOURCE_MODIFY',$user);
+ // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
+ // // End call triggers
+ //}
+
+ // Commit or rollback
+ if ($error) {
+ $this->db->rollback();
+
+ return -1 * $error;
+ } else {
+ $this->db->commit();
+
+ return 1;
+ }
+ }
+
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ *
+ * @return int <0 if KO, >0 if OK
+ */
+ public function delete(User $user, $notrigger = false)
+ {
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $fieldrowid = 'rowid';
+
+ $error = 0;
+
+ $this->db->begin();
+
+ // Uncomment this and change CTYPERESOURCE to your own tag if you
+ // want this action calls a trigger.
+ //if (!$error && !$notrigger) {
+
+ // // Call triggers
+ // $result=$this->call_trigger('CTYPERESOURCE_DELETE',$user);
+ // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
+ // // End call triggers
+ //}
+
+ // If you need to delete child tables to, you can insert them here
+
+ if (!$error) {
+ $sql = "DELETE FROM ".$this->db->prefix().$this->table_element;
+ $sql .= " WHERE ".$fieldrowid." = ".((int) $this->id);
+
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+ }
+ }
+
+ // Commit or rollback
+ if ($error) {
+ $this->db->rollback();
+
+ return -1 * $error;
+ } else {
+ $this->db->commit();
+
+ return 1;
+ }
+ }
+
+ /**
+ * Load an object from its id and create a new one in database
+ *
+ * @param User $user User making the clone
+ * @param int $fromid Id of object to clone
+ * @return int New id of clone
+ */
+ public function createFromClone(User $user, $fromid)
+ {
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $error = 0;
+ $object = new Ctyperesource($this->db);
+
+ $this->db->begin();
+
+ // Load source object
+ $object->fetch($fromid);
+ // Reset object
+ $object->id = 0;
+
+ // Clear fields
+ // ...
+
+ // Create clone
+ $object->context['createfromclone'] = 'createfromclone';
+ $result = $object->create($user);
+
+ // Other options
+ if ($result < 0) {
+ $error++;
+ $this->errors = $object->errors;
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+ }
+
+ unset($object->context['createfromclone']);
+
+ // End
+ if (!$error) {
+ $this->db->commit();
+
+ return $object->id;
+ } else {
+ $this->db->rollback();
+
+ return -1;
+ }
+ }
+
+ /**
+ * Initialise object with example values
+ * Id must be 0 if object instance is a specimen
+ *
+ * @return void
+ */
+ public function initAsSpecimen()
+ {
+ $this->id = 0;
+
+ $this->code = 'CODE';
+ $this->label = 'Label';
+ $this->active = 1;
+ }
+}
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index e80eaa52b14..bee63613bca 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -447,8 +447,9 @@ abstract class CommonDocGenerator
$resarray = array(
$array_key.'_id'=>$object->id,
- $array_key.'_ref'=>$object->ref,
- $array_key.'_ref_ext'=>$object->ref_ext,
+ $array_key.'_ref' => (property_exists($object, 'ref') ? $object->ref : ''),
+ $array_key.'_label' => (property_exists($object, 'label') ? $object->label : ''),
+ $array_key.'_ref_ext' => (property_exists($object, 'ref_ext') ? $object->ref_ext : ''),
$array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
$array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
$array_key.'_source_invoice_ref'=>$invoice_source->ref,
@@ -469,7 +470,7 @@ abstract class CommonDocGenerator
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
- $array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
+ $array_key.'_incoterms' => (method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
$array_key.'_bank_iban'=>$bank_account->iban,
$array_key.'_bank_bic'=>$bank_account->bic,
@@ -612,6 +613,7 @@ abstract class CommonDocGenerator
'line_product_label'=>(empty($line->product_label) ? '' : $line->product_label),
'line_product_type'=>(empty($line->product_type) ? '' : $line->product_type),
'line_product_barcode'=>(empty($line->product_barcode) ? '' : $line->product_barcode),
+ 'line_product_desc'=>(empty($line->product_desc) ? '' : $line->product_desc),
'line_desc'=>$line->desc,
'line_vatrate'=>vatrate($line->tva_tx, true, $line->info_bits),
@@ -833,25 +835,38 @@ abstract class CommonDocGenerator
*
* @param Object $object Dolibarr Object
* @param Translate $outputlangs Language object for output
- * @param boolean $recursive Want to fetch child array or child object
+ * @param boolean|int $recursive Want to fetch child array or child object.
* @return array Array of substitution key->code
*/
- public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = true)
+ public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = 1)
{
// phpcs:enable
$array_other = array();
if (!empty($object)) {
foreach ($object as $key => $value) {
+ if (in_array($key, array('db', 'fields', 'lines', 'modelpdf', 'model_pdf'))) { // discard some properties
+ continue;
+ }
if (!empty($value)) {
if (!is_array($value) && !is_object($value)) {
$array_other['object_'.$key] = $value;
- }
- if (is_array($value) && $recursive) {
- $array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs, false);
+ } elseif (is_array($value) && $recursive) {
+ $tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
+ foreach ($tmparray as $key2 => $value2) {
+ $array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
+ }
+ } elseif (is_object($value) && $recursive) {
+ $tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
+ foreach ($tmparray as $key2 => $value2) {
+ $array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
+ }
}
}
}
}
+
+ //var_dump($array_other);
+
return $array_other;
}
diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php
index e74d1428781..6c707141774 100644
--- a/htdocs/core/class/commonincoterm.class.php
+++ b/htdocs/core/class/commonincoterm.class.php
@@ -64,7 +64,9 @@ trait CommonIncoterm
$result = $this->db->query($sql);
if ($result) {
$res = $this->db->fetch_object($result);
- $out .= $res->code;
+ if ($res) {
+ $out .= $res->code;
+ }
}
}
@@ -76,7 +78,7 @@ trait CommonIncoterm
/**
* Return incoterms informations for pdf display
*
- * @return string incoterms info
+ * @return string|boolean Incoterms info or false
*/
public function getIncotermsForPDF()
{
@@ -86,7 +88,11 @@ trait CommonIncoterm
$num = $this->db->num_rows($resql);
if ($num > 0) {
$res = $this->db->fetch_object($resql);
- return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
+ if ($res) {
+ return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
+ } else {
+ return $res;
+ }
} else {
return '';
}
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index e88b42950f3..155b2ca5819 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -742,17 +742,17 @@ abstract class CommonInvoice extends CommonObject
if ($row[0] == 0) {
$now = dol_now();
- $totalpaye = $this->getSommePaiement();
+ $totalpaid = $this->getSommePaiement();
$totalcreditnotes = $this->getSumCreditNotesUsed();
$totaldeposits = $this->getSumDepositsUsed();
- //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
+ //print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
- //$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
+ //$resteapayer=bcadd($this->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
if (empty($amount)) {
- $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $amount = price2num($this->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
}
if (is_numeric($amount) && $amount != 0) {
@@ -848,7 +848,7 @@ abstract class CommonInvoice extends CommonObject
*/
public function buildZATCAQRString()
{
- global $conf;
+ global $conf, $mysoc;
$tmplang = new Translate('', $conf);
$tmplang->setDefaultLang('en_US');
@@ -885,8 +885,8 @@ abstract class CommonInvoice extends CommonObject
*/
// Using TLV format
- $s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name;
- $s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra;
+ $s = pack('C1', 1).pack('C1', strlen($mysoc->name)).$mysoc->name;
+ $s .= pack('C1', 2).pack('C1', strlen($mysoc->tva_intra)).$mysoc->tva_intra;
$s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring;
$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index bf33cbe224e..b39facd16a4 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -116,7 +116,7 @@ abstract class CommonObject
public $array_languages = null; // Value is array() when load already tried
/**
- * @var array To sotre result of ->liste_contact()
+ * @var array To store result of ->liste_contact()
*/
public $contacts_ids;
@@ -2649,7 +2649,9 @@ abstract class CommonObject
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
- $sql .= " , deposit_percent = " . (! empty($deposit_percent) ? "'".$this->db->escape($deposit_percent)."'" : 'NULL');
+ if (in_array($this->table_element, array('propal', 'commande'))) {
+ $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
+ }
$sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
@@ -6997,7 +6999,7 @@ abstract class CommonObject
$out .= '';
} elseif ($type == 'checkbox') {
$value_arr = explode(',', $value);
- $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
+ $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, $morecss, 0, '100%');
} elseif ($type == 'radio') {
$out = '';
foreach ($param['options'] as $keyopt => $val) {
@@ -7378,18 +7380,18 @@ abstract class CommonObject
$checked = ' checked ';
}
$value = ' ';
- } elseif ($type == 'mail') {
+ } elseif ($type == 'mail' || $type == 'email') {
$value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
} elseif ($type == 'url') {
$value = dol_print_url($value, '_blank', 32, 1);
} elseif ($type == 'phone') {
- $value = dol_print_phone($value, '', 0, 0, '', ' ', 1);
+ $value = dol_print_phone($value, '', 0, 0, '', ' ', 'phone');
} elseif ($type == 'price') {
if (!is_null($value) && $value !== '') {
$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
}
} elseif ($type == 'select') {
- $value = $param['options'][$value];
+ $value = isset($param['options'][$value])?$param['options'][$value]:'';
} elseif ($type == 'sellist') {
$param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
@@ -7982,7 +7984,8 @@ abstract class CommonObject
$datenotinstring = $this->db->jdate($datenotinstring);
}
}
- $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(12, 0, 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
+ $datekey = $keyprefix.'options_'.$key.$keysuffix;
+ $value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring;
}
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) {
$datenotinstring = null;
@@ -7992,15 +7995,20 @@ abstract class CommonObject
$datenotinstring = $this->db->jdate($datenotinstring);
}
}
- $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."sec", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3), 'tzuserrel') : $datenotinstring;
+ $timekey = $keyprefix.'options_'.$key.$keysuffix;
+ $value = (GETPOSTISSET($timekey)) ? dol_mktime(GETPOST($timekey.'hour', 'int', 3), GETPOST($timekey.'min', 'int', 3), GETPOST($timekey.'sec', 'int', 3), GETPOST($timekey.'month', 'int', 3), GETPOST($timekey.'day', 'int', 3), GETPOST($timekey.'year', 'int', 3), 'tzuserrel') : $datenotinstring;
}
// Convert float submited string into real php numeric (value in memory must be a php numeric)
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double'))) {
- $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? price2num($value) : $this->array_options['options_'.$key];
+ if (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) {
+ $value = price2num($value);
+ } elseif (isset($this->array_options['options_'.$key])) {
+ $value = $this->array_options['options_'.$key];
+ }
}
// HTML, text, select, integer and varchar: take into account default value in database if in create mode
- if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int'))) {
+ if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int', 'boolean'))) {
if ($action == 'create') {
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? $value : $extrafields->attributes[$this->table_element]['default'][$key];
}
@@ -8052,7 +8060,7 @@ abstract class CommonObject
// a first td column was already output (and may be another on before if MAIN_VIEW_LINE_NUMBER set), so this td is the next one
$out .= '';
@@ -1205,7 +1207,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
{
var element = jQuery("#opp_status option:selected");
var defaultpercent = element.attr("defaultpercent");
- var defaultcloseproject = '.$defaultcheckedwhenoppclose.';
+ var defaultcloseproject = '.((int) $defaultcheckedwhenoppclose).';
var elemcode = element.attr("elemcode");
var oldpercent = \''.dol_escape_js($object->opp_percent).'\';
diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php
index 59576b961d4..6a522346210 100644
--- a/htdocs/projet/class/api_projects.class.php
+++ b/htdocs/projet/class/api_projects.class.php
@@ -333,7 +333,7 @@ class Projects extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
$updateRes = $this->project->addline(
$request_data->desc,
@@ -400,7 +400,7 @@ class Projects extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
$updateRes = $this->project->updateline(
$lineid,
diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php
index cafb60f2865..0eaf8654421 100644
--- a/htdocs/projet/class/api_tasks.class.php
+++ b/htdocs/projet/class/api_tasks.class.php
@@ -333,7 +333,7 @@ class Tasks extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
$updateRes = $this->project->addline(
$request_data->desc,
@@ -400,7 +400,7 @@ class Tasks extends DolibarrApi
$request_data = (object) $request_data;
- $request_data->desc = checkVal($request_data->desc, 'restricthtml');
+ $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
$updateRes = $this->project->updateline(
$lineid,
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index c9cecd8dc6e..79152c6cfb9 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -481,7 +481,7 @@ class Task extends CommonObjectLine
$newdir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->ref);
if (file_exists($olddir)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $res = dol_move($olddir, $newdir);
+ $res = dol_move_dir($olddir, $newdir);
if (!$res) {
$langs->load("errors");
$this->error = $langs->trans('ErrorFailToRenameDir', $olddir, $newdir);
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index 86eca4be973..31f74118261 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -936,7 +936,7 @@ if (!empty($arrayfields['c.assigned']['checked'])) {
// Opp status
if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
print '';
- print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth100', 1, 0);
+ print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth100 nowrapoption', 1, 0);
print ' ';
}
if (!empty($arrayfields['p.opp_amount']['checked'])) {
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 737bd94e2a7..c08880e44ea 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -103,7 +103,7 @@ $search_date_end_endday = GETPOST('search_date_end_endday', 'int');
$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projecttasklist';
-
+$optioncss = GETPOST('optioncss', 'aZ');
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 0c323d5e058..9fce4072183 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -120,6 +120,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
}
+ } else {
+ $action = 'edit';
}
} else {
$action = 'edit';
diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php
index 9369a9d78a7..8aa910a2d4f 100644
--- a/htdocs/public/cron/cron_run_jobs_by_url.php
+++ b/htdocs/public/cron/cron_run_jobs_by_url.php
@@ -23,6 +23,7 @@
* \ingroup cron
* \brief Execute pendings jobs
*/
+
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Disables token renewal
}
@@ -42,6 +43,11 @@ if (!defined('NOIPCHECK')) {
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
+// So log file will have a suffix
+if (!defined('USESUFFIXINLOG')) {
+ define('USESUFFIXINLOG', '_cron');
+}
+
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index c03aeb4b526..5553ee464c7 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -1051,8 +1051,10 @@ if ($ispaymentok) {
include_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
$paiement = new PaymentDonation($db);
+ $totalpaid = $FinalPaymentAmt;
+
if ($currencyCodeType == $conf->currency) {
- $paiement->amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching with donation
+ $paiement->amounts = array($object->id => $totalpaid); // Array with all payments dispatching with donation
} else {
// PaymentDonation does not support multi currency
$postactionmessages[] = 'Payment donation can\'t be payed with diffent currency than '.$conf->currency;
@@ -1078,7 +1080,9 @@ if ($ispaymentok) {
$postactionmessages[] = 'Payment created';
$ispostactionok = 1;
- if ($totalpayed >= $don->getRemainToPay()) $don->setPaid($don->id);
+ if ($totalpaid >= $don->getRemainToPay()) {
+ $don->setPaid($don->id);
+ }
}
}
diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php
index 8d096e6e99e..a15beff2856 100644
--- a/htdocs/public/ticket/list.php
+++ b/htdocs/public/ticket/list.php
@@ -659,9 +659,9 @@ if ($action == "view_ticketlist") {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($arrayfields["ef.".$key]['checked'])) {
print 'getAlignFlag($key);
- if ($align) {
- print ' align="'.$align.'"';
+ $cssstring = $extrafields->getAlignFlag($key, $object->table_element);
+ if ($cssstring) {
+ print ' class="'.$cssstring.'"';
}
print '>';
$tmpkey = 'options_'.$key;
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index cdd82525b6e..243135fbf6a 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -270,9 +270,9 @@ if (empty($reshook)) {
$object->origin_id = $origin_id;
$object->fk_project = GETPOST('projectid', 'int');
$object->weight = GETPOST('weight', 'int') == '' ? null : GETPOST('weight', 'int');
- $object->sizeH = GETPOST('sizeH', 'int') == '' ? null : GETPOST('sizeH', 'int');
- $object->sizeW = GETPOST('sizeW', 'int') == '' ? null : GETPOST('sizeW', 'int');
- $object->sizeS = GETPOST('sizeS', 'int') == '' ? null : GETPOST('sizeS', 'int');
+ $object->trueHeight = GETPOST('trueHeight', 'int') == '' ? null : GETPOST('trueHeight', 'int');
+ $object->trueWidth = GETPOST('trueWidth', 'int') == '' ? null : GETPOST('trueWidth', 'int');
+ $object->trueDepth = GETPOST('trueDepth', 'int') == '' ? null : GETPOST('trueDepth', 'int');
$object->size_units = GETPOST('size_units', 'int');
$object->weight_units = GETPOST('weight_units', 'int');
@@ -849,9 +849,9 @@ if ($action == 'create') {
// Dim
print ' ';
print $langs->trans("Width").' x '.$langs->trans("Height").' x '.$langs->trans("Depth");
- print ' ';
- print ' x ';
- print ' x ';
+ print ' ';
+ print ' x ';
+ print ' x ';
print ' ';
$text = $formproduct->selectMeasuringUnits("size_units", "size", GETPOST('size_units', 'int'), 0, 2);
$htmltext = $langs->trans("KeepEmptyForAutoCalculation");
@@ -1029,7 +1029,7 @@ if ($action == 'create') {
print ''.$langs->trans("QtyReceived").' ';
print ''.$langs->trans("QtyToReceive");
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
- print ' '.$langs->trans("ByingPrice").' ';
+ print ''.$langs->trans("BuyingPrice").' ';
}
if (empty($conf->productbatch->enabled)) {
print ' ('.$langs->trans("Fill").' ';
@@ -1184,7 +1184,7 @@ if ($action == 'create') {
$defaultqty = GETPOST('qtyl'.$indiceAsked, 'int');
}
print ' ';
- print ' ';
+ print ' ';
} else {
print $langs->trans("NA");
}
@@ -1192,7 +1192,7 @@ if ($action == 'create') {
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
print '';
- print ' ';
+ print ' ';
print ' ';
}
@@ -1669,7 +1669,8 @@ if ($action == 'create') {
print ' ';
print '';
- print '
';
+ print '';
+ print '';
print '';
// #
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
@@ -1734,6 +1735,7 @@ if ($action == 'create') {
print ' ';
}
print " \n";
+ print ' ';
$var = false;
@@ -1799,9 +1801,10 @@ if ($action == 'create') {
$arrayofpurchaselinealreadyoutput = array();
// Loop on each product to send/sent. Warning: $lines must be sorted by ->fk_commandefourndet (it is a regroupment key on output)
+ print '';
for ($i = 0; $i < $num_prod; $i++) {
print ''; // id of order line
- print '';
+ print ' ';
// #
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
@@ -1819,7 +1822,7 @@ if ($action == 'create') {
$label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
}
- print '';
+ print ' ';
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
$text = $lines[$i]->product->getNomUrl(1);
$text .= ' - '.$label;
@@ -1832,7 +1835,7 @@ if ($action == 'create') {
}
print " \n";
} else {
- print "";
+ print ' ';
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
if ($lines[$i]->product_type == Product::TYPE_SERVICE) {
$text = img_object($langs->trans('Service'), 'service');
@@ -1860,7 +1863,7 @@ if ($action == 'create') {
// Qty ordered
- print ' ';
+ print ' ';
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
print $lines[$i]->qty_asked;
}
@@ -1868,7 +1871,7 @@ if ($action == 'create') {
// Qty in other receptions (with reception and warehouse used)
if ($origin && $origin_id > 0) {
- print ' ';
+ print ' ';
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
foreach ($alreadysent as $key => $val) {
if ($lines[$i]->fk_commandefourndet == $key) {
@@ -1939,7 +1942,7 @@ if ($action == 'create') {
print '
';
} else {
// Qty to receive or received
- print ''.$lines[$i]->qty.' ';
+ print ''.$lines[$i]->qty.' ';
// Warehouse source
if (!empty($conf->stock->enabled)) {
@@ -1959,7 +1962,7 @@ if ($action == 'create') {
if (!empty($conf->productbatch->enabled)) {
if (isset($lines[$i]->batch)) {
print '';
- print '';
+ print ' ';
$detail = '';
if ($lines[$i]->product->status_batch) {
$detail .= $langs->trans("Batch").': '.$lines[$i]->batch;
@@ -1983,7 +1986,7 @@ if ($action == 'create') {
}
// Weight
- print ' ';
+ print ' ';
if (!empty($lines[$i]->fk_product_type) && $lines[$i]->fk_product_type == Product::TYPE_PRODUCT) {
print $lines[$i]->product->weight * $lines[$i]->qty.' '.measuringUnitString(0, "weight", $lines[$i]->product->weight_units);
} else {
@@ -1992,7 +1995,7 @@ if ($action == 'create') {
print ' ';
// Volume
- print '';
+ print ' ';
if (!empty($lines[$i]->fk_product_type) && $lines[$i]->fk_product_type == Product::TYPE_PRODUCT) {
print $lines[$i]->product->volume * $lines[$i]->qty.' '.measuringUnitString(0, "volume", $lines[$i]->product->volume_units);
} else {
@@ -2040,6 +2043,7 @@ if ($action == 'create') {
}
}
}
+ print '';
// TODO Show also lines ordered but not delivered
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 2ff316ecb58..958528e2fe7 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -273,9 +273,9 @@ class Reception extends CommonObject
$sql .= ", ".($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : "null");
$sql .= ", '".$this->db->escape($this->tracking_number)."'";
$sql .= ", ".(is_null($this->weight) ? "NULL" : ((double) $this->weight));
- $sql .= ", ".(is_null($this->sizeS) ? "NULL" : ((double) $this->sizeS)); // TODO Should use this->trueDepth
- $sql .= ", ".(is_null($this->sizeW) ? "NULL" : ((double) $this->sizeW)); // TODO Should use this->trueWidth
- $sql .= ", ".(is_null($this->sizeH) ? "NULL" : ((double) $this->sizeH)); // TODO Should use this->trueHeight
+ $sql .= ", ".(is_null($this->trueDepth) ? "NULL" : ((double) $this->trueDepth));
+ $sql .= ", ".(is_null($this->trueWidth) ? "NULL" : ((double) $this->trueWidth));
+ $sql .= ", ".(is_null($this->trueHeight) ? "NULL" : ((double) $this->trueHeight));
$sql .= ", ".(is_null($this->weight_units) ? "NULL" : ((double) $this->weight_units));
$sql .= ", ".(is_null($this->size_units) ? "NULL" : ((double) $this->size_units));
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
@@ -593,22 +593,12 @@ class Reception extends CommonObject
$mouvS->origin = &$this;
$mouvS->setOrigin($this->element, $this->id);
- // get unit price with discount
- $up_ht_disc = $obj->subprice;
- if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) {
- $up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU');
- }
-
if (empty($obj->batch)) {
// line without batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
$inventorycode = '';
- if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
- } else {
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
- }
+ $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$error++;
@@ -622,11 +612,7 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
$inventorycode = '';
- if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
- } else {
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
- }
+ $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
if ($result < 0) {
$error++;
@@ -744,7 +730,6 @@ class Reception extends CommonObject
if (!empty($this->origin) && $this->origin_id > 0 && ($this->origin == 'order_supplier' || $this->origin == 'commandeFournisseur')) {
if (empty($this->commandeFournisseur)) {
- $this->commandeFournisseur = null;
$this->fetch_origin();
if (empty($this->commandeFournisseur->lines)) {
$res = $this->commandeFournisseur->fetch_lines();
@@ -1485,70 +1470,6 @@ class Reception extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Update/create delivery method.
- *
- * @param string $id id method to activate
- *
- * @return void
- */
- public function update_delivery_method($id = '')
- {
- // phpcs:enable
- if ($id == '') {
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
- $sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')";
- $resql = $this->db->query($sql);
- } else {
- $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
- $sql .= " code='".$this->db->escape($this->update['code'])."'";
- $sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'";
- $sql .= ",description='".$this->db->escape($this->update['description'])."'";
- $sql .= ",tracking='".$this->db->escape($this->update['tracking'])."'";
- $sql .= " WHERE rowid=".((int) $id);
- $resql = $this->db->query($sql);
- }
- if ($resql < 0) {
- dol_print_error($this->db, '');
- }
- }
-
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Activate delivery method.
- *
- * @param int $id id method to activate
- *
- * @return void
- */
- public function activ_delivery_method($id)
- {
- // phpcs:enable
- $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
- $sql .= " WHERE rowid = ".((int) $id);
-
- $resql = $this->db->query($sql);
- }
-
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * DesActivate delivery method.
- *
- * @param int $id id method to desactivate
- *
- * @return void
- */
- public function disable_delivery_method($id)
- {
- // phpcs:enable
- $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
- $sql .= " WHERE rowid = ".((int) $id);
-
- $resql = $this->db->query($sql);
- }
-
-
/**
* Forge an set tracking url
*
@@ -1633,7 +1554,8 @@ class Reception extends CommonObject
// TODO possibilite de receptionner a partir d'une propale ou autre origine ?
$sql = "SELECT cd.fk_product, cd.subprice,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
- $sql .= " ed.eatby, ed.sellby, ed.batch";
+ $sql .= " ed.eatby, ed.sellby, ed.batch,";
+ $sql .= " ed.cost_price";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
@@ -1663,7 +1585,7 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$inventorycode = '';
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode);
+ $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@@ -1674,7 +1596,7 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$inventorycode = '';
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
+ $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
@@ -1797,7 +1719,8 @@ class Reception extends CommonObject
// TODO possibilite de receptionner a partir d'une propale ou autre origine
$sql = "SELECT ed.fk_product, cd.subprice,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
- $sql .= " ed.eatby, ed.sellby, ed.batch";
+ $sql .= " ed.eatby, ed.sellby, ed.batch,";
+ $sql .= " ed.cost_price";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
@@ -1828,7 +1751,7 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$inventorycode = '';
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
+ $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
@@ -1840,7 +1763,7 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$inventorycode = '';
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode);
+ $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@@ -1928,7 +1851,8 @@ class Reception extends CommonObject
// TODO possibilite de receptionner a partir d'une propale ou autre origine
$sql = "SELECT cd.fk_product, cd.subprice,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
- $sql .= " ed.eatby, ed.sellby, ed.batch";
+ $sql .= " ed.eatby, ed.sellby, ed.batch,";
+ $sql .= " ed.cost_price";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
@@ -1959,7 +1883,7 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$inventorycode = '';
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode);
+ $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@@ -1971,7 +1895,7 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$inventorycode = '';
- $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
+ $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
diff --git a/htdocs/recruitment/admin/candidature_extrafields.php b/htdocs/recruitment/admin/candidature_extrafields.php
index 1977c4b11fe..73a8398fd80 100644
--- a/htdocs/recruitment/admin/candidature_extrafields.php
+++ b/htdocs/recruitment/admin/candidature_extrafields.php
@@ -81,7 +81,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/recruitment/admin/jobposition_extrafields.php b/htdocs/recruitment/admin/jobposition_extrafields.php
index 641b8b96cd0..95918bdd1c1 100644
--- a/htdocs/recruitment/admin/jobposition_extrafields.php
+++ b/htdocs/recruitment/admin/jobposition_extrafields.php
@@ -81,7 +81,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/recruitment/class/api_recruitment.class.php b/htdocs/recruitment/class/api_recruitment.class.php
index ff6f3c3d65a..af2c87dcdb3 100644
--- a/htdocs/recruitment/class/api_recruitment.class.php
+++ b/htdocs/recruitment/class/api_recruitment.class.php
@@ -364,7 +364,7 @@ class Recruitment extends DolibarrApi
}
// Clean data
- // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml');
+ // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->jobposition->create(DolibarrApiAccess::$user)<0) {
throw new RestException(500, "Error creating jobposition", array_merge(array($this->jobposition->error), $this->jobposition->errors));
@@ -396,7 +396,7 @@ class Recruitment extends DolibarrApi
}
// Clean data
- // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml');
+ // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->candidature->create(DolibarrApiAccess::$user)<0) {
throw new RestException(500, "Error creating candidature", array_merge(array($this->candidature->error), $this->candidature->errors));
@@ -438,7 +438,7 @@ class Recruitment extends DolibarrApi
}
// Clean data
- // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml');
+ // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->jobposition->update(DolibarrApiAccess::$user, false) > 0) {
return $this->get($id);
@@ -481,7 +481,7 @@ class Recruitment extends DolibarrApi
}
// Clean data
- // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml');
+ // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->candidature->update(DolibarrApiAccess::$user, false) > 0) {
return $this->get($id);
diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php
index 835cfe0b7cd..1b4074a6798 100644
--- a/htdocs/recruitment/class/recruitmentcandidature.class.php
+++ b/htdocs/recruitment/class/recruitmentcandidature.class.php
@@ -120,7 +120,7 @@ class RecruitmentCandidature extends CommonObject
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
'lastname' => array('type'=>'varchar(128)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>1,),
'firstname' => array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>1,),
- 'email' => array('type'=>'varchar(255)', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'picto'=>'email'),
+ 'email' => array('type'=>'email', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'picto'=>'email', 'csslist'=>'tdoverflowmax200'),
'phone' => array('type'=>'phone', 'label'=>'Phone', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'picto'=>'phone'),
'date_birth' => array('type'=>'date', 'label'=>'DateOfBirth', 'enabled'=>'1', 'position'=>70, 'visible'=>-1,),
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php
index d978c0fbb94..42279fe3a97 100644
--- a/htdocs/recruitment/class/recruitmentjobposition.class.php
+++ b/htdocs/recruitment/class/recruitmentjobposition.class.php
@@ -115,7 +115,7 @@ class RecruitmentJobPosition extends CommonObject
'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>101, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>102, 'notnull'=>0, 'visible'=>0,),
- 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-4,),
+ 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
diff --git a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php
index 84bfd30401c..089aa720fa7 100644
--- a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php
+++ b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php
@@ -51,7 +51,7 @@ abstract class ModelePDFRecruitmentCandidature extends CommonDocGenerator
// phpcs:enable
global $conf;
- $type = 'recruitmentjobposition';
+ $type = 'recruitmentjobcandidature';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php
index 4ce262c8c92..9a0a21484b1 100644
--- a/htdocs/recruitment/recruitmentcandidature_list.php
+++ b/htdocs/recruitment/recruitmentcandidature_list.php
@@ -30,11 +30,11 @@
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
+//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', '1'); // The main.inc.php does not make a redirect if not logged, instead show simple error message
@@ -129,11 +129,11 @@ $arrayfields = array();
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');
+ $visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
+ 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
@@ -318,7 +318,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add where from hooks
$parameters=array();
-$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
+$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
*/
@@ -326,8 +326,15 @@ $sql = preg_replace('/,\s*$/', '', $sql);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
- $resql = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($resql);
+ /* The fast and low memory method to get and count full list converts the sql into a sql count */
+ $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
+ $resql = $db->query($sqlforcount);
+ if ($resql) {
+ $objforcount = $db->fetch_object($resql);
+ $nbtotalofrecords = $objforcount->nbtotalofrecords;
+ } else {
+ dol_print_error($db);
+ }
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
@@ -543,7 +550,7 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
-if ($permissiontodelete) {
+if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
@@ -560,12 +567,17 @@ print ' ';
print ' ';
print ' ';
-//print ' ';
+print ' ';
print ' ';
print ' ';
print ' ';
-$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.((int) $id)), '', $permissiontoadd);
+
+$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 .= dolGetButtonTitleSeparator();
+$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.((int) $id)), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@@ -577,10 +589,13 @@ $trackid = 'recruitmentapplication'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) {
+ $setupstring = '';
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
+ $setupstring .= $key."=".$val.";";
}
- print ''.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
';
+ print ''."\n";
+ print ''.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n";
}
$moreforfilter = '';
@@ -603,7 +618,7 @@ if (!empty($moreforfilter)) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
-$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
@@ -613,8 +628,16 @@ print '
';
+// Action column
+if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print '';
+ $searchpicto = $form->showFilterButtons('left');
+ print $searchpicto;
+ print ' ';
+}
foreach ($object->fields as $key => $val) {
- $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
+ $searchkey = empty($search[$key]) ? '' : $search[$key];
+ $cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@@ -655,10 +678,12 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
-print '';
-$searchpicto = $form->showFilterButtons();
-print $searchpicto;
-print ' ';
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print '';
+ $searchpicto = $form->showFilterButtons();
+ print $searchpicto;
+ print ' ';
+}
print ''."\n";
$totalarray = array();
@@ -667,6 +692,9 @@ $totalarray['nbfield'] = 0;
// Fields title label
// --------------------------------------------------------------------
print '';
+if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
@@ -675,21 +703,25 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
- } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
+ } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
+ $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
if (!empty($arrayfields['t.'.$key]['checked'])) {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
+ $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);
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
-print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+}
$totalarray['nbfield']++;
print ' '."\n";
@@ -735,7 +767,19 @@ while ($i < $imaxinloop) {
} else {
// Show here line of result
$j = 0;
- print '';
+ print ' ';
+ // Action column
+ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print '';
+ 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 ' ';
+ }
+ print ' ';
+ }
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@@ -756,7 +800,11 @@ while ($i < $imaxinloop) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
- print '';
+ print ' ';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
@@ -789,15 +837,17 @@ while ($i < $imaxinloop) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
- print ' ';
- 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;
+ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print ' ';
+ 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 ' ';
}
- print ' ';
+ print ' ';
}
- print '';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -826,7 +876,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 '
'."\n";
diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php
index cf4bdddb63d..4f63434f9cf 100644
--- a/htdocs/recruitment/recruitmentjobposition_list.php
+++ b/htdocs/recruitment/recruitmentjobposition_list.php
@@ -427,8 +427,8 @@ print '
';
print '
';
$newcardbutton = '';
-$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('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 .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php
index 705c3a70788..8b4e32c05d2 100644
--- a/htdocs/resource/class/html.formresource.class.php
+++ b/htdocs/resource/class/html.formresource.class.php
@@ -101,13 +101,6 @@ class FormResource
}
if ($resourcestat) {
- if (!empty($conf->use_javascript_ajax) && !empty($conf->global->RESOURCE_USE_SEARCH_TO_SELECT) && !$forcecombo) {
- //$minLength = (is_numeric($conf->global->RESOURCE_USE_SEARCH_TO_SELECT)?$conf->global->RESOURCE_USE_SEARCH_TO_SELECT:2);
- $out .= ajax_combobox($htmlname, $event, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
- } else {
- $out .= ajax_combobox($htmlname);
- }
-
// Construct $out and $outarray
$out .= '
'."\n";
if ($showempty) {
@@ -147,6 +140,13 @@ class FormResource
}
$out .= ' '."\n";
+ if (!empty($conf->use_javascript_ajax) && !empty($conf->global->RESOURCE_USE_SEARCH_TO_SELECT) && !$forcecombo) {
+ //$minLength = (is_numeric($conf->global->RESOURCE_USE_SEARCH_TO_SELECT)?$conf->global->RESOURCE_USE_SEARCH_TO_SELECT:2);
+ $out .= ajax_combobox($htmlname, $event, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
+ } else {
+ $out .= ajax_combobox($htmlname);
+ }
+
if ($outputmode != 2) {
$out .= '
';
diff --git a/htdocs/salaries/admin/salaries_extrafields.php b/htdocs/salaries/admin/salaries_extrafields.php
index 2354da8048a..86fc5991757 100644
--- a/htdocs/salaries/admin/salaries_extrafields.php
+++ b/htdocs/salaries/admin/salaries_extrafields.php
@@ -83,7 +83,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '
";
}
diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php
index e5da198c17f..00591b5a32f 100644
--- a/htdocs/salaries/card.php
+++ b/htdocs/salaries/card.php
@@ -323,9 +323,9 @@ if ($action == 'add' && empty($cancel)) {
if ($action == 'confirm_delete') {
$result = $object->fetch($id);
- $totalpaye = $object->getSommePaiement();
+ $totalpaid = $object->getSommePaiement();
- if (empty($totalpaye)) {
+ if (empty($totalpaid)) {
$db->begin();
$ret = $object->delete($user);
@@ -827,8 +827,8 @@ if ($id) {
$morehtmlref .= '
';
- $totalpaye = $object->getSommePaiement();
- $object->totalpaye = $totalpaye;
+ $totalpaid = $object->getSommePaiement();
+ $object->totalpaid = $totalpaid;
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
@@ -945,7 +945,7 @@ if ($id) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
- $totalpaye = 0;
+ $totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0; $total = 0;
@@ -994,7 +994,7 @@ if ($id) {
}
print ' '.price($objp->amount)." \n";
print "";
- $totalpaye += $objp->amount;
+ $totalpaid += $objp->amount;
$i++;
}
} else {
@@ -1003,10 +1003,10 @@ if ($id) {
print '';
}
- print ''.$langs->trans("AlreadyPaid")." : ".price($totalpaye)." \n";
+ print ''.$langs->trans("AlreadyPaid")." : ".price($totalpaid)." \n";
print ''.$langs->trans("AmountExpected")." : ".price($object->amount)." \n";
- $resteapayer = $object->amount - $totalpaye;
+ $resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print ''.$langs->trans("RemainderToPay")." : ";
@@ -1067,7 +1067,7 @@ if ($id) {
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id, '');
}
- if (!empty($user->rights->salaries->delete) && empty($totalpaye)) {
+ if (!empty($user->rights->salaries->delete) && empty($totalpaid)) {
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
} else {
print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php
index 6607efa554d..6b9a872be6c 100644
--- a/htdocs/societe/admin/contact_extrafields.php
+++ b/htdocs/societe/admin/contact_extrafields.php
@@ -83,7 +83,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php
index a785b95c892..1d77831c661 100644
--- a/htdocs/societe/admin/societe_extrafields.php
+++ b/htdocs/societe/admin/societe_extrafields.php
@@ -83,7 +83,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php
index 1aa7093299d..bebe542a6f9 100644
--- a/htdocs/societe/agenda.php
+++ b/htdocs/societe/agenda.php
@@ -147,7 +147,7 @@ if ($socid > 0) {
$objcon = new stdClass();
$out = '';
- $permok = $user->rights->agenda->myactions->create;
+ $permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
$out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 686c301af79..83fe2b22282 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -408,18 +408,40 @@ class Societe extends CommonObject
*/
public $idprof1;
+ /**
+ * @var string Professional ID 1
+ * @deprecated
+ * @see $idprof1
+ */
+ public $siren;
+
+
/**
* Professional ID 2 (Ex: Siret in France)
* @var string
*/
public $idprof2;
+ /**
+ * @var string Professional ID 2
+ * @deprecated
+ * @see $idprof2
+ */
+ public $siret;
+
/**
* Professional ID 3 (Ex: Ape in France)
* @var string
*/
public $idprof3;
+ /**
+ * @var string Professional ID 3
+ * @deprecated
+ * @see $idprof3
+ */
+ public $ape;
+
/**
* Professional ID 4 (Ex: RCS in France)
* @var string
@@ -920,8 +942,8 @@ class Societe extends CommonObject
$sql .= ", accountancy_code_sell";
}
$sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".((int) $this->entity).", '".$this->db->idate($now)."'";
- $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null");
$sql .= ", ".(!empty($user->id) ? ((int) $user->id) : "null");
+ $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null");
$sql .= ", ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null");
$sql .= ", ".((int) $this->status);
$sql .= ", ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null");
@@ -1083,7 +1105,7 @@ class Societe extends CommonObject
}
}
- if (!empty($error)) {
+ if (empty($error)) {
dol_syslog(get_class($this)."::create_individual success");
$this->db->commit();
} else {
@@ -2719,13 +2741,6 @@ class Societe extends CommonObject
if (in_array($target, $target_value)) {
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
}
-
- /*
- $hookmanager->initHooks(array('thirdpartydao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
}
$linkstart .= $linkclose.'>';
$linkend = '';
diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php
index 8cae5ef49f8..597fc4b80ea 100644
--- a/htdocs/societe/index.php
+++ b/htdocs/societe/index.php
@@ -177,7 +177,8 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
$statstring .= ''.$langs->trans("Customers").' '.round($third['customer']).' ';
$statstring .= " ";
}
- if ((($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
+ $statstring2 = '';
+ if (((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
$statstring2 = "";
$statstring2 .= ''.$langs->trans("Suppliers").' '.round($third['supplier']).' ';
$statstring2 .= " ";
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 91368ec9dc7..a92ca5ed11c 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -678,20 +678,28 @@ $parameters = array('fieldstosearchall' => $fieldstosearchall);
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
-$sql .= $db->order($sortfield, $sortorder);
-
-// Count total nb of records
+// Count total nb of records with no order and no limits
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
- $result = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($result);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $nbtotalofrecords = $db->num_rows($resql);
+ } else {
+ dol_print_error($db);
+ }
+
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
+ $db->free($resql);
}
-$sql .= $db->plimit($limit + 1, $offset);
+// Complete request and execute it with limit
+$sql .= $db->order($sortfield, $sortorder);
+if ($limit) {
+ $sql .= $db->plimit($limit + 1, $offset);
+}
$resql = $db->query($sql);
if (!$resql) {
@@ -701,6 +709,7 @@ if (!$resql) {
$num = $db->num_rows($resql);
+
$arrayofselected = is_array($toselect) ? $toselect : array();
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') {
@@ -860,8 +869,8 @@ if (GETPOST('delsoc')) {
// 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"),
+ 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
+ //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->societe->creer) {
@@ -1668,7 +1677,8 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
// Prospect status
print '';
- print '
'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
+ print '
';
+ print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
print '
-
';
foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
$titlealt = 'default';
diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php
index 05079d263a9..d9b3d3127f9 100644
--- a/htdocs/societe/partnership.php
+++ b/htdocs/societe/partnership.php
@@ -1,6 +1,7 @@
* Copyright (C) 2021 NextGestion
+ * Copyright (C) 2022 Charlene Benke
*
* 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
@@ -180,25 +181,25 @@ if ($id > 0) {
print '';
if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
- print ''.$langs->trans('Prefix').' '.$societe->prefix_comm.' ';
+ print ''.$langs->trans('Prefix').' '.$object->prefix_comm.' ';
}
- if ($societe->client) {
+ if ($object->client) {
print '';
print $langs->trans('CustomerCode').' ';
- print showValueWithClipboardCPButton(dol_escape_htmltag($societe->code_client));
- $tmpcheck = $societe->check_codeclient();
+ print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
+ $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' ('.$langs->trans("WrongCustomerCode").') ';
}
print ' ';
}
- if ($societe->fournisseur) {
+ if ($object->fournisseur) {
print '';
print $langs->trans('SupplierCode').' ';
- print showValueWithClipboardCPButton(dol_escape_htmltag($societe->code_fournisseur));
- $tmpcheck = $societe->check_codefournisseur();
+ print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
+ $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' ('.$langs->trans("WrongSupplierCode").') ';
}
diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php
index f1a7a5c7877..0d8b5e03435 100644
--- a/htdocs/stripe/class/actions_stripe.class.php
+++ b/htdocs/stripe/class/actions_stripe.class.php
@@ -175,6 +175,8 @@ class ActionsStripeconnect
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql .= ' WHERE pf.fk_facture = '.((int) $object->id);
+ $totalpaid = 0;
+
$result = $this->db->query($sql);
if ($result) {
$i = 0;
@@ -182,14 +184,14 @@ class ActionsStripeconnect
while ($i < $num) {
$objp = $this->db->fetch_object($result);
- $totalpaye += $objp->amount;
+ $totalpaid += $objp->amount;
$i++;
}
} else {
dol_print_error($this->db, '');
}
- $resteapayer = $object->total_ttc - $totalpaye;
+ $resteapayer = $object->total_ttc - $totalpaid;
// Request a direct debit order
if ($object->statut > Facture::STATUS_DRAFT && $object->statut < Facture::STATUS_ABANDONED && $object->paye == 0) {
$stripe = new Stripe($this->db);
diff --git a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php
index 66bcf2c61e4..e77a72ea6c4 100644
--- a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php
+++ b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php
@@ -78,7 +78,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php
index 5a061101fab..304cbbd1e3a 100644
--- a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php
+++ b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index df54da4132c..5f11b6e3c02 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -321,8 +321,20 @@ if (empty($reshook)) {
if (!$error) {
if ($origin && $originid) {
- $element = 'supplier_proposal';
- $subelement = 'supplier_proposal';
+ $element = $subelement = $origin;
+ if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
+ $element = $regs[1];
+ $subelement = $regs[2];
+ }
+
+ // For compatibility
+ if ($element == 'order') {
+ $element = $subelement = 'commande';
+ }
+ if ($element == 'propal') {
+ $element = 'comm/propal';
+ $subelement = 'propal';
+ }
$object->origin = $origin;
$object->origin_id = $originid;
@@ -1138,8 +1150,20 @@ if ($action == 'create') {
// Load objectsrc
if (!empty($origin) && !empty($originid)) {
- $element = 'supplier_proposal';
- $subelement = 'supplier_proposal';
+ $element = $subelement = GETPOST('origin');
+ if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'), $regs)) {
+ $element = $regs[1];
+ $subelement = $regs[2];
+ }
+
+ // For compatibility
+ if ($element == 'order' || $element == 'commande') {
+ $element = $subelement = 'commande';
+ }
+ if ($element == 'propal') {
+ $element = 'comm/propal';
+ $subelement = 'propal';
+ }
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php
index 5168c370592..9f7483319b3 100644
--- a/htdocs/takepos/ajax/ajax.php
+++ b/htdocs/takepos/ajax/ajax.php
@@ -103,7 +103,7 @@ if ($action == 'getProducts') {
'rowid' => $thirdparty->id,
'name' => $thirdparty->name,
'barcode' => $thirdparty->barcode,
- 'object' => 'thirdparty'
+ 'object' => 'thirdparty'
);
echo json_encode($rows);
exit;
@@ -267,6 +267,7 @@ if ($action == 'getProducts') {
$resql = $db->query($sql);
if ($resql) {
$rows = array();
+
while ($obj = $db->fetch_object($resql)) {
$objProd = new Product($db);
$objProd->fetch($obj->rowid);
@@ -303,17 +304,23 @@ if ($action == 'getProducts') {
$parameters=array();
$parameters['row'] = $row;
$parameters['obj'] = $obj;
-
$reshook = $hookmanager->executeHooks('completeAjaxReturnArray', $parameters);
if ($reshook > 0) {
// replace
- $row = $hookmanager->resArray;
+ if (count($hookmanager->resArray)) {
+ $row = $hookmanager->resArray;
+ } else {
+ $row = array();
+ }
} else {
// add
- $rows[] = $hookmanager->resArray;
+ if (count($hookmanager->resArray)) {
+ $rows[] = $hookmanager->resArray;
+ }
+ $rows[] = $row;
}
- $rows[] = $row;
}
+
echo json_encode($rows);
} else {
echo 'Failed to search product : '.$db->lasterror();
diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php
index 45130981876..acb195af15c 100644
--- a/htdocs/takepos/css/pos.css.php
+++ b/htdocs/takepos/css/pos.css.php
@@ -141,7 +141,9 @@ button.calcbutton2 {
margin: 1px;
border-radius: 3px;
}
-
+button.calcbutton2.clicked {
+ background-color: #8855AA;
+}
button.calcbutton2 .iconwithlabel {
padding-bottom: 10px;
}
@@ -436,8 +438,9 @@ tr.selected, tr.selected td {
/* font-weight: bold; */
background-color: rgb(240,230,210) !important;
}
-.order {
- color: limegreen;
+.order td {
+ color: green;
+ /* background-color: #f5f5f5; */
}
.colorwhite {
diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php
index 73e84109116..9dc4f843b5b 100644
--- a/htdocs/takepos/floors.php
+++ b/htdocs/takepos/floors.php
@@ -128,22 +128,20 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php
index d5bd8e4405f..ee6a6c85d80 100644
--- a/htdocs/takepos/index.php
+++ b/htdocs/takepos/index.php
@@ -205,6 +205,9 @@ if(localStorage.hasKeyboard) {
function ClearSearch() {
console.log("ClearSearch");
$("#search").val('');
+ $("#qty").html("trans("Qty"); ?>").removeClass('clicked');
+ $("#price").html("trans("Price"); ?>").removeClass('clicked');
+ $("#reduction").html("trans("ReductionShort"); ?>").removeClass('clicked');
browser->layout == 'classic') { ?>
setFocusOnSearchField();
@@ -720,8 +723,9 @@ function Search2(keyCodeForEnter, moreorless) {
}
+/* Function called on an action into the PAD */
function Edit(number) {
- console.log("We click on PAD on number="+number);
+ console.log("We click on PAD on key="+number);
if (typeof(selectedtext) == "undefined") {
return; // We click on an action on the number pad but there is no line selected
@@ -730,20 +734,19 @@ function Edit(number) {
var text=selectedtext+" ";
- if (number=='c'){
- editnumber="";
+ if (number=='c') {
+ editnumber='';
Refresh();
- $("#qty").html("trans("Qty"); ?>");
- $("#price").html("trans("Price"); ?>");
- $("#reduction").html("trans("ReductionShort"); ?>");
+ $("#qty").html("trans("Qty"); ?>").removeClass('clicked');
+ $("#price").html("trans("Price"); ?>").removeClass('clicked');
+ $("#reduction").html("trans("ReductionShort"); ?>").removeClass('clicked');
return;
- }
- else if (number=='qty'){
- if (editaction=='qty' && editnumber!=""){
+ } else if (number=='qty') {
+ if (editaction=='qty' && editnumber != '') {
$("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
editnumber="";
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
- $("#qty").html("trans("Qty"); ?>");
+ $("#qty").html("trans("Qty"); ?>").removeClass('clicked');
});
setFocusOnSearchField();
@@ -752,13 +755,12 @@ function Edit(number) {
else {
editaction="qty";
}
- }
- else if (number=='p'){
- if (editaction=='p' && editnumber!=""){
+ } else if (number=='p') {
+ if (editaction=='p' && editnumber!="") {
$("#poslines").load("invoice.php?action=updateprice&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
editnumber="";
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
- $("#price").html("trans("Price"); ?>");
+ $("#price").html("trans("Price"); ?>").removeClass('clicked');
});
ClearSearch();
@@ -767,13 +769,12 @@ function Edit(number) {
else {
editaction="p";
}
- }
- else if (number=='r'){
- if (editaction=='r' && editnumber!=""){
+ } else if (number=='r') {
+ if (editaction=='r' && editnumber!="") {
$("#poslines").load("invoice.php?action=updatereduction&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
editnumber="";
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
- $("#reduction").html("trans("ReductionShort"); ?>");
+ $("#reduction").html("trans("ReductionShort"); ?>").removeClass('clicked');
});
ClearSearch();
@@ -788,21 +789,21 @@ function Edit(number) {
}
if (editaction=='qty'){
text=text+"trans("Modify")." -> ".$langs->trans("Qty").": "; ?>";
- $("#qty").html("OK");
- $("#price").html("trans("Price"); ?>");
- $("#reduction").html("trans("ReductionShort"); ?>");
+ $("#qty").html("OK").addClass("clicked");
+ $("#price").html("trans("Price"); ?>").removeClass('clicked');
+ $("#reduction").html("trans("ReductionShort"); ?>").removeClass('clicked');
}
if (editaction=='p'){
text=text+"trans("Modify")." -> ".$langs->trans("Price").": "; ?>";
- $("#qty").html("trans("Qty"); ?>");
- $("#price").html("OK");
- $("#reduction").html("trans("ReductionShort"); ?>");
+ $("#qty").html("trans("Qty"); ?>").removeClass('clicked');
+ $("#price").html("OK").addClass("clicked");
+ $("#reduction").html("trans("ReductionShort"); ?>").removeClass('clicked');
}
if (editaction=='r'){
text=text+"trans("Modify")." -> ".$langs->trans("ReductionShort").": "; ?>";
- $("#qty").html("trans("Qty"); ?>");
- $("#price").html("trans("Price"); ?>");
- $("#reduction").html("OK");
+ $("#qty").html("trans("Qty"); ?>").removeClass('clicked');
+ $("#price").html("trans("Price"); ?>").removeClass('clicked');
+ $("#reduction").html("OK").addClass("clicked");
}
$('#'+selectedline).find("td:first").html(text+editnumber);
}
@@ -1136,7 +1137,7 @@ if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
}
}
- if (empty($paiementsModes)) {
+ if (empty($paiementsModes) && !empty($conf->banque->enabled)) {
$langs->load('errors');
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 6aca4e01a5d..b4111094063 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -204,7 +204,7 @@ if (empty($reshook)) {
}
}
- if ($bankaccount <= 0 && $pay != "delayed") {
+ if ($bankaccount <= 0 && $pay != "delayed" && !empty($conf->banque->enabled)) {
$errormsg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount"));
$error++;
}
@@ -804,7 +804,7 @@ if (empty($reshook)) {
$printer->orderprinter = 1;
echo "";
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed
@@ -836,7 +836,7 @@ if (empty($reshook)) {
$printer->orderprinter = 2;
echo "";
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed
@@ -868,7 +868,7 @@ if (empty($reshook)) {
$printer->orderprinter = 3;
echo "";
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id; // Set as printed
@@ -913,7 +913,7 @@ if (empty($reshook)) {
$sectionwithinvoicelink .= ' '.$langs->trans('SendTicket').' ';
}
- if ($remaintopay <= 0 && getDolGlobalString('TAKEPOS_AUTO_PRINT_TICKETS')) {
+ if ($remaintopay <= 0 && getDolGlobalString('TAKEPOS_AUTO_PRINT_TICKETS') && $action != "history") {
$sectionwithinvoicelink .= '';
}
}
@@ -1444,7 +1444,11 @@ if ($placeid > 0) {
if ($line->special_code == "4") {
$htmlsupplements[$line->fk_parent_line] .= ' order';
}
- $htmlsupplements[$line->fk_parent_line] .= '" id="'.$line->id.'">';
+ $htmlsupplements[$line->fk_parent_line] .= '" id="'.$line->id.'"';
+ if ($line->special_code == "4") {
+ $htmlsupplements[$line->fk_parent_line] .= ' title="'.dol_escape_htmltag($langs->trans("AlreadyPrinted")).'"';
+ }
+ $htmlsupplements[$line->fk_parent_line] .= '>';
$htmlsupplements[$line->fk_parent_line] .= ' ';
$htmlsupplements[$line->fk_parent_line] .= img_picto('', 'rightarrow');
if ($line->product_label) {
@@ -1483,7 +1487,11 @@ if ($placeid > 0) {
if ($line->special_code == "4") {
$htmlforlines .= ' order';
}
- $htmlforlines .= '" id="'.$line->id.'">';
+ $htmlforlines .= '" id="'.$line->id.'"';
+ if ($line->special_code == "4") {
+ $htmlforlines .= ' title="'.dol_escape_htmltag($langs->trans("AlreadyPrinted")).'"';
+ }
+ $htmlforlines .= '>';
$htmlforlines .= ' ';
if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) {
$htmlforlines .= ''.$line->qty." x ";
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index ffa33fbe8fc..40d873654c6 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -111,6 +111,9 @@ if ($resql) {
$arrayOfValidBankAccount[$conf->global->$accountname] = $conf->global->$accountname;
$arrayOfValidPaymentModes[] = $obj;
}
+ if (empty($conf->banque->enabled)) {
+ if ($paycode == 'CASH' || $paycode == 'CB') $arrayOfValidPaymentModes[] = $obj;
+ }
}
}
?>
diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php
index 338b4cf2759..0ca47fbd2bb 100644
--- a/htdocs/theme/eldy/dropdown.inc.php
+++ b/htdocs/theme/eldy/dropdown.inc.php
@@ -396,7 +396,7 @@ a.dropdown-item {
content: "\f35d";
}
-.dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus {
+.dropdown-item.active, .dropdown-item:hover, .dropdown-item:hover span::before, .dropdown-item:focus {
color: # !important;
text-decoration: none;
background: rgb();
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 19abdd3ba9b..930d28550c3 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -149,7 +149,8 @@ select.vmenusearchselectcombo {
background-color: unset;
}
-table.liste th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), table.liste td.wrapcolumntitle.liste_titre:not(.maxwidthsearch) {
+table.liste th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), table.liste td.wrapcolumntitle.liste_titre:not(.maxwidthsearch),
+table.liste th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), table.liste td.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch) {
overflow: hidden;
white-space: nowrap;
max-width: 100px;
@@ -227,6 +228,9 @@ input {
padding: 4px;
padding-left: 5px;
}
+.tableforfield input {
+ padding: 2px;
+}
select {
padding-top: 4px;
padding-right: 4px;
@@ -281,7 +285,7 @@ div.tabBar textarea:focus {
border: 1px solid #aaa !important;
}
input:focus:not(.button):not(.select2-search__field):not(#top-bookmark-search-input):not(.search_component_input):not(.input-search-takepos),
- select:focus, .select2-container--open .select2-selection--single {
+ select:focus, .select2-container--open [aria-expanded="false"].select2-selection--single {
/* div.tabBar input:focus, div.tabBar select:focus { */
border-bottom: 1px solid #666 !important;
border-bottom-left-radius: 0 !important;
@@ -6024,7 +6028,7 @@ span.select2.select2-container.select2-container--default {
}
span.select2.select2-container.select2-container--default {
global->THEME_SHOW_BORDER_ON_INPUT)) { ?>
- //border-bottom: solid 1px var(--inputbordercolor);
+ /*border-bottom: solid 1px var(--inputbordercolor);*/
}
@@ -6343,6 +6347,17 @@ ul.select2-results__options li {
font-size: 0.95em;
}
+@media only screen and (min-width: 767px)
+{
+ .select2-container.select2-container--open .select2-dropdown.ui-dialog {
+ min-width: 200px !important;
+ }
+ .select2-container--open .select2-dropdown--below {
+ border-top: 1px solid var(--inputbordercolor);
+ /* border-top: 1px solid #aaaaaa; */
+ }
+}
+
/* ============================================================================== */
/* For categories */
@@ -7630,6 +7645,11 @@ if (!empty($conf->global->THEME_CUSTOM_CSS)) {
?>
+ div.extra_inline_chkbxlst,
+ div.extra_inline_checkbox {
+ min-width:150px;
+ }
+
/* Must be at end */
div.flot-text .flot-tick-label .tickLabel, .fa-color-unset {
color: unset;
diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php
index 2d33a716692..77270b9d818 100644
--- a/htdocs/theme/eldy/info-box.inc.php
+++ b/htdocs/theme/eldy/info-box.inc.php
@@ -10,7 +10,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) {
*/
.info-box-module.--external span.info-box-icon-version {
- background: #bbb;
+ background: rgba(0,0,0,0.2);
}
.info-box-module.--external.--need-update span.info-box-icon-version{
diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php
index 615951bbbd9..1f60f0b7c2a 100644
--- a/htdocs/theme/md/dropdown.inc.php
+++ b/htdocs/theme/md/dropdown.inc.php
@@ -400,7 +400,7 @@ a.dropdown-item {
content: "\f35d";
}
-.dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus {
+.dropdown-item.active, .dropdown-item:hover, .dropdown-item:hover::before, .dropdown-item:hover span::before, .dropdown-item:focus {
color: # !important;
text-decoration: none;
background: rgb();
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 261e89c64be..298b8b5c46a 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -403,7 +403,8 @@ textarea.cke_source:focus
box-shadow: none;
}
-th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), td.wrapcolumntitle.liste_titre:not(.maxwidthsearch) {
+th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), td.wrapcolumntitle.liste_titre:not(.maxwidthsearch),
+th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), td.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch) {
overflow: hidden;
white-space: nowrap;
max-width: 120px;
@@ -487,7 +488,7 @@ section.setupsection {
border-radius: 5px;
}
-.field-error-icon { color: #ea1212; !important; }
+.field-error-icon { color: #ea1212 !important; }
textarea {
border-radius: 0;
@@ -3569,7 +3570,7 @@ td.border, div.tagtable div div.border {
left: 0;
top: 0;
max-width: 150px !important;
- //background-color: inherit;
+ /*background-color: inherit;*/
background-color: gainsboro;
z-index: 2;
}
@@ -3582,7 +3583,7 @@ td.border, div.tagtable div div.border {
right: 0;
top: 0;
max-width: 150px !important;
- //background-color: inherit;
+ /*background-color: inherit;*/
background-color: gainsboro;
z-index: 2;
}
@@ -4163,7 +4164,7 @@ tr.liste_sub_total, tr.liste_sub_total td {
}
.paymenttable tr td:first-child, .margintable tr td:first-child
{
- //padding-left: 2px;
+ /*padding-left: 2px;*/
}
.paymenttable, .margintable tr td {
height: 22px;
@@ -7319,3 +7320,4 @@ if (is_object($db)) {
div.flot-text .flot-tick-label .tickLabel, .fa-color-unset {
color: unset;
}
+
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index ce791613bcb..efa2eba0999 100755
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -386,20 +386,24 @@ if (empty($reshook)) {
if (!$error) { // Update list of contacts
// Si déjà un user assigné on le supprime des contacts
if ($useroriginassign > 0) {
- $internal_contacts = $object->listeContact(-1, 'internal');
-
+ $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC');
foreach ($internal_contacts as $key => $contact) {
- if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) {
- }
- {
- //print "user à effacer : ".$useroriginassign;
- $object->delete_contact($contact['rowid']);
+ if ($contact['id'] !== $usertoassign) {
+ $result = $object->delete_contact($contact['rowid']);
+ if ($result<0) {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
}
}
}
- if ($usertoassign > 0) {
- $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
+ if ($usertoassign > 0 && $usertoassign!==$useroriginassign) {
+ $result = $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
+ if ($result<0) {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
}
}
@@ -408,8 +412,8 @@ if (empty($reshook)) {
$object->fetch_user($usertoassign);
//$log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs));
- setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
+ setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
header("Location: card.php?track_id=".$object->track_id."&action=view");
exit;
} else {
@@ -1051,7 +1055,7 @@ if ($action == 'create' || $action == 'presend') {
print ' ';
print ' ';
//print ''.$langs->trans("AssignUser").' ';
- print $form->select_dolusers($user->id, 'fk_user_assign', 1);
+ print $form->select_dolusers(empty($object->fk_user_assign)?$user->id:$object->fk_user_assign, 'fk_user_assign', 1);
print ' ';
print '';
}
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index e267ffce6c1..3ac3727af13 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -496,6 +496,13 @@ class Ticket extends CommonObject
}
}
+ if (!$error && $this->fk_user_assign > 0) {
+ if ($this->add_contact($this->fk_user_assign, 'SUPPORTTEC', 'internal') < 0) {
+ $error++;
+ }
+ }
+
+
//Update extrafield
if (!$error) {
$result = $this->insertExtraFields();
@@ -2194,6 +2201,10 @@ class Ticket extends CommonObject
$sql .= " AND tc.source = 'external'";
}
+ if (!empty($code)) {
+ $sql .= " AND tc.code = '".$this->db->escape($code)."'";
+ }
+
$sql .= " AND tc.active=1";
if ($status >= 0) {
$sql .= " AND ec.statut = ".((int) $status);
diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php
index 093aaf5de1e..ee76045ffec 100644
--- a/htdocs/ticket/contact.php
+++ b/htdocs/ticket/contact.php
@@ -84,7 +84,32 @@ if ($action == 'addcontact' && $user->rights->ticket->write) {
if ($result > 0 && ($id > 0 || (!empty($track_id)))) {
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
- $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
+
+ $error = 0;
+
+ $codecontact = dol_getIdFromCode($db, $typeid, 'c_type_contact', 'rowid', 'code');
+ if ($codecontact=='SUPPORTTEC') {
+ $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC');
+ foreach ($internal_contacts as $key => $contact) {
+ if ($contact['id'] !== $contactid) {
+ //print "user à effacer : ".$useroriginassign;
+ $result = $object->delete_contact($contact['rowid']);
+ if ($result<0) {
+ $error ++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+ }
+ $ret = $object->assignUser($user, $contactid);
+ if ($ret < 0) {
+ $error ++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+
+ if (empty($error)) {
+ $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
+ }
}
if ($result >= 0) {
@@ -112,6 +137,16 @@ if ($action == 'swapstatut' && $user->rights->ticket->write) {
// Efface un contact
if ($action == 'deletecontact' && $user->rights->ticket->write) {
if ($object->fetch($id, '', $track_id)) {
+ $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC');
+ foreach ($internal_contacts as $key => $contact) {
+ if ($contact['rowid'] == $lineid && $object->fk_user_assign==$contact['id']) {
+ $ret = $object->assignUser($user, null);
+ if ($ret < 0) {
+ $error ++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+ }
$result = $object->delete_contact($lineid);
if ($result >= 0) {
diff --git a/htdocs/user/admin/group_extrafields.php b/htdocs/user/admin/group_extrafields.php
index b258f991a47..b31104d12b3 100644
--- a/htdocs/user/admin/group_extrafields.php
+++ b/htdocs/user/admin/group_extrafields.php
@@ -85,7 +85,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/user/admin/user_extrafields.php b/htdocs/user/admin/user_extrafields.php
index 7e22a1c7122..7dc15ca8447 100644
--- a/htdocs/user/admin/user_extrafields.php
+++ b/htdocs/user/admin/user_extrafields.php
@@ -84,7 +84,7 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '";
}
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 821d6748eb6..f0b362b383e 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -333,18 +333,26 @@ if (empty($reshook)) {
$id = $object->create($user);
if ($id > 0) {
+ $resPass = 0;
if (GETPOST('password', 'none')) {
- $object->setPassword($user, GETPOST('password', 'none'));
+ $resPass = $object->setPassword($user, GETPOST('password', 'none'));
}
- if (!empty($conf->categorie->enabled)) {
- // Categories association
- $usercats = GETPOST('usercats', 'array');
- $object->setCategories($usercats);
- }
- $db->commit();
+ if ($resPass < 0) {
+ $langs->load("errors");
+ $db->rollback();
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = "create"; // Go back to create page
+ } else {
+ if (! empty($conf->categorie->enabled)) {
+ // Categories association
+ $usercats = GETPOST('usercats', 'array');
+ $object->setCategories($usercats);
+ }
+ $db->commit();
- header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
- exit;
+ header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
+ exit;
+ }
} else {
$langs->load("errors");
$db->rollback();
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index cb76b25cc5a..11d21f4e957 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -2805,13 +2805,6 @@ class User extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('userdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
}
$linkstart .= $linkclose.'>';
@@ -2926,7 +2919,7 @@ class User extends CommonObject
*/
public function getLibStatut($mode = 0)
{
- return $this->LibStatut(isset($this->statut) ? $this->statut : $this->status, $mode);
+ return $this->LibStatut(isset($this->statut) ? (int) $this->statut : (int) $this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 5c83e8ce94c..41ac859f558 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -761,13 +761,6 @@ class UserGroup extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('groupdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
}
$linkstart = 'rights->user->user->lire && !$user->admin) {
- accessforbidden();
-}
-
// Load translation files required by page
$langs->loadLangs(array('users', 'companies'));
@@ -51,7 +47,6 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa
// Load mode employee
$mode = GETPOST("mode", 'alpha');
-$userstatic = new User($db);
$search_statut = GETPOST('search_statut', 'int');
if ($search_statut == '' || $search_statut == '0') {
@@ -62,9 +57,16 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_statut = "";
}
+$userstatic = new User($db);
+
// Define value to know what current user can do on users
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
+if (!$user->rights->user->user->lire && !$user->admin) {
+ accessforbidden();
+}
+
+$childids = $user->getAllChildIds(1);
/*
@@ -73,19 +75,25 @@ $canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
$form = new Form($db);
-$title = $langs->trans("Users").' - '.$langs->trans("HierarchicView");
+$help_url = 'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios|DE:Modul_Benutzer';
+$title = $langs->trans("Users");
$arrayofjs = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
'/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js',
);
$arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
-llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'bodyforlist');
+llxHeader('', $title, $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', 'bodyforlist');
// Load hierarchy of users
$user_arbo = $userstatic->get_full_tree(0, ($search_statut != '' && $search_statut >= 0) ? "statut = ".$search_statut : '');
+
+// Count total nb of records
+$nbtotalofrecords = count($user_arbo);
+
+
if (!is_array($user_arbo) && $user_arbo < 0) {
setEventMessages($userstatic->error, $userstatic->errors, 'warnings');
} else {
@@ -142,12 +150,12 @@ if (!is_array($user_arbo) && $user_arbo < 0) {
//var_dump($data);
- $param = "search_statut=".urlencode($search_statut);
+ $param = "&search_statut=".urlencode($search_statut);
$newcardbutton = '';
- $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=kanban'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
- $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
- $newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu=', '', $canadduser);
@@ -155,18 +163,19 @@ if (!is_array($user_arbo) && $user_arbo < 0) {
$num = 0;
$limit = 0;
- print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, $newcardbutton, '', $limit, 0, 0, 1);
+ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $newcardbutton, '', $limit, 0, 0, 1);
print ''."\n";
if ($optioncss != '') {
print ' ';
}
print ' ';
+ print ' ';
print ' ';
print ' ';
print ' ';
- print ' ';
print ' ';
+ print ' ';
print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '
';
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index 6478df005d6..53eed056695 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -339,6 +339,7 @@ if ($contextpage == 'employeelist' && $search_employee == 1) {
}
$morejs = array();
$morecss = array();
+$morehtmlright = "";
// Build and execute select
// --------------------------------------------------------------------
@@ -561,7 +562,7 @@ if ($search_api_key != '') {
if ($search_supervisor > 0) {
$param .= "&search_supervisor=".urlencode($search_supervisor);
}
-if ($search_statut != '' && $search_statut >= 0) {
+if ($search_statut != '') {
$param .= "&search_statut=".urlencode($search_statut);
}
if ($optioncss != '') {
@@ -612,9 +613,9 @@ if (!empty($socid)) {
}
$newcardbutton = '';
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
+$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 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('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
-$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
@@ -726,7 +727,7 @@ if (!empty($arrayfields['u.employee']['checked'])) {
// Supervisor
if (!empty($arrayfields['u.fk_user']['checked'])) {
print '';
- print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, array(), 0, '', 0, 0, 0, 0, '', 0, '', 'maxwidth200');
+ print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, array(), 0, '', 0, 0, 0, 0, '', 0, '', 'maxwidth150');
print ' ';
}
if (!empty($arrayfields['u.accountancy_code']['checked'])) {
@@ -1104,7 +1105,7 @@ while ($i < $imaxinloop) {
}
}
if (!empty($arrayfields['u.fk_soc']['checked'])) {
- print '';
+ print ' ';
if ($obj->fk_soc > 0) {
$companystatic->id = $obj->fk_soc;
$companystatic->name = $obj->name;
diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php
index 889599e2fa9..55876016680 100644
--- a/htdocs/user/perms.php
+++ b/htdocs/user/perms.php
@@ -340,7 +340,7 @@ if ($result) {
$obj = $db->fetch_object($result);
// If line is for a module that does not exist anymore (absent of includes/module), we ignore it
- if (empty($modules[$obj->module])) {
+ if (!isset($obj->module) || empty($modules[$obj->module])) {
$i++;
continue;
}
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index bb46729145c..0a342d1ad62 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -1209,7 +1209,7 @@ class Website extends CommonObject
}
// Load sql record
- $runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); // The maxrowid of table is searched into this function two
+ $runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1, 0, 0, 1); // The maxrowid of table is searched into this function two
if ($runsql <= 0) {
$this->errors[] = 'Failed to load sql file '.$sqlfile;
$error++;
diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php
index e27658838bd..d2e656d15f1 100644
--- a/htdocs/zapier/class/hook.class.php
+++ b/htdocs/zapier/class/hook.class.php
@@ -537,13 +537,6 @@ class Hook extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('hookdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php
index 647b1405d71..25ea4b4d415 100755
--- a/scripts/cron/cron_run_jobs.php
+++ b/scripts/cron/cron_run_jobs.php
@@ -22,7 +22,7 @@
/**
* \file scripts/cron/cron_run_jobs.php
* \ingroup cron
- * \brief Execute pendings jobs
+ * \brief Execute pendings jobs from command line
*/
if (!defined('NOTOKENRENEWAL')) {
@@ -44,6 +44,11 @@ if (!defined('NOSESSION')) {
define('NOSESSION', '1');
}
+// So log file will have a suffix
+if (!defined('USESUFFIXINLOG')) {
+ define('USESUFFIXINLOG', '_cron');
+}
+
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = __DIR__.'/';
diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php
index 48a00c8214d..8c819c6de64 100644
--- a/test/phpunit/FilesLibTest.php
+++ b/test/phpunit/FilesLibTest.php
@@ -559,4 +559,72 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
$user->rights->facture->lire = $savpermlire;
$user->rights->facture->creer = $savpermcreer;
}
+
+ /**
+ * testDolDirMove
+ *
+ * @return void
+ */
+ public function testDolDirMove()
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ // To test a move of empty directory that should work
+ $dirsrcpath = $conf->admin->dir_temp.'/directory';
+ $dirdestpath = $conf->admin->dir_temp.'/directory2';
+ $file=dirname(__FILE__).'/Example_import_company_1.csv';
+ dol_mkdir($dirsrcpath);
+ dol_delete_dir_recursive($dirdestpath, 0, 1);
+ $result=dol_move_dir($dirsrcpath, $dirdestpath, 1, 1, 1);
+ print __METHOD__." result=".$result."\n";
+ $this->assertTrue($result, 'move of directory with empty directory');
+
+ // To test a move on existing directory with overwrite
+ dol_mkdir($dirsrcpath);
+ $result=dol_move_dir($dirsrcpath, $dirdestpath, 1, 1, 1);
+ print __METHOD__." result=".$result."\n";
+ $this->assertTrue($result, 'move of directory on existing directory with empty directory');
+
+ // To test a move on existing directory without overwrite
+ dol_mkdir($dirsrcpath);
+ $result=dol_move_dir($dirsrcpath, $dirdestpath, 0, 1, 1);
+ print __METHOD__." result=".$result."\n";
+ $this->assertFalse($result, 'move of directory on existing directory without overwrite');
+
+ // To test a move with a file to rename in src directory
+ dol_mkdir($dirsrcpath);
+ dol_delete_dir_recursive($dirdestpath, 0, 1);
+ dol_copy($file, $dirsrcpath.'/directory_file.csv');
+ $result=dol_move_dir($dirsrcpath, $dirdestpath, 1, 1, 1);
+ print __METHOD__." result=".$result."\n";
+ $this->assertTrue($result, 'move of directory with file in directory');
+
+ // To test a move without a file to rename in src directory
+ dol_mkdir($dirsrcpath);
+ dol_delete_dir_recursive($dirdestpath, 0, 1);
+ dol_copy($file, $dirsrcpath.'/file.csv');
+ $result=dol_move_dir($dirsrcpath, $dirdestpath, 1, 1, 1);
+ print __METHOD__." result=".$result."\n";
+ $this->assertTrue($result, 'move of directory with file whitout rename needed in directory');
+
+ // To test a move with a directory to rename in src directory
+ dol_mkdir($dirsrcpath);
+ dol_delete_dir_recursive($dirdestpath, 0, 1);
+ dol_mkdir($dirsrcpath.'/directory');
+ $result=dol_move_dir($dirsrcpath, $dirdestpath, 1, 1, 1);
+ print __METHOD__." result=".$result."\n";
+ $this->assertTrue($result, 'move of directory with file with rename needed in directory');
+
+ // To test a move without a directory to rename in src directory
+ dol_mkdir($dirsrcpath);
+ dol_delete_dir_recursive($dirdestpath, 0, 1);
+ dol_mkdir($dirsrcpath.'/notorename');
+ $result=dol_move_dir($dirsrcpath, $dirdestpath, 1, 1, 1);
+ print __METHOD__." result=".$result."\n";
+ $this->assertTrue($result, 'move of directory with directory whitout rename needed in directory');
+ }
}
diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php
index 1bf3b6378fb..82205369c86 100644
--- a/test/phpunit/FunctionsLibTest.php
+++ b/test/phpunit/FunctionsLibTest.php
@@ -166,6 +166,26 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
print __METHOD__."\n";
}
+ /**
+ * testNum2Alpha
+ *
+ * @return void
+ */
+ public function testNum2Alpha()
+ {
+ $result = num2Alpha(0);
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals($result, 'A', 'Check num2Alpha 0');
+
+ $result = num2Alpha(5);
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals($result, 'F', 'Check num2Alpha 5');
+
+ $result = num2Alpha(26);
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals($result, 'AA', 'Check num2Alpha 26');
+ }
+
/**
* testIsValidEmail
*