mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge remote-tracking branch 'upstream/develop' into 16a12_assets_sql
This commit is contained in:
commit
19616982c7
|
|
@ -18,9 +18,10 @@ filter:
|
|||
- dev/*
|
||||
- doc/*
|
||||
- documents/*
|
||||
- htdocs/includes/*
|
||||
- node_modules/*
|
||||
- test/*
|
||||
dependency_paths:
|
||||
- htdocs/includes/*
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
|
|
|
|||
60
ChangeLog
60
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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 '<tr class="oddeven">';
|
||||
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class AccountancyExport
|
|||
*/
|
||||
public function getType()
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $hookmanager;
|
||||
|
||||
$listofexporttypes = array(
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
|
||||
|
|
@ -137,7 +137,7 @@ class AccountancyExport
|
|||
);
|
||||
|
||||
// allow modules to define export formats
|
||||
global $hookmanager;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('getType', $parameters, $listofexporttypes);
|
||||
|
||||
ksort($listofexporttypes, SORT_NUMERIC);
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ if ($action == 'set_default') {
|
|||
$res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled) {
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
|
|
@ -256,7 +256,7 @@ print '</td>';
|
|||
print "</tr>\n";
|
||||
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled) {
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td>';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
|
|
@ -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 '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
|
||||
// Line for filters fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
|
|
@ -807,15 +820,24 @@ if (!empty($arrayfields['d.statut']['checked'])) {
|
|||
print $form->selectarray('search_status', $liststatus, $search_status, -3);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
// Action column
|
||||
print '<td class="liste_titre middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
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 "</tr>\n";
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -936,7 +963,7 @@ while ($i < min($num, $limit)) {
|
|||
print '<tr class="oddeven">';
|
||||
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print '<td class="center">'.$obj->rowid.'</td>';
|
||||
print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
|
@ -1172,21 +1199,31 @@ while ($i < min($num, $limit)) {
|
|||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
print '<td class="center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
|
||||
print dol_escape_htmltag($obj->import_key);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
// Action column
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1067,12 +1067,12 @@ if ($rowid > 0) {
|
|||
// Bank account
|
||||
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
|
||||
print img_picto('', 'bank_account');
|
||||
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
|
||||
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Payment mode
|
||||
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
|
||||
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Date of payment
|
||||
|
|
|
|||
|
|
@ -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 "</td>";
|
|||
// Active
|
||||
if ($conf->global->BANK_COLORIZE_MOVEMENT) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetbankcolorizemovement&token='.newToken().'">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetbankcolorizemovement&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
|
@ -483,13 +473,13 @@ print '</td>';
|
|||
// Active
|
||||
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetreportlastnumreleve&token='.newToken().'">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetreportlastnumreleve&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1490,11 +1490,13 @@ if ($id > 0) {
|
|||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
$tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : '');
|
||||
|
||||
$tdsoffields .= '<th'.($class ? ' class="'.$class.'"' : '').'>';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
$tdsoffields .= '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
$tdsoffields .= $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) {
|
||||
$tdsoffields .= '<a href="'.$tooltiphelp.'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif ($tooltiphelp) {
|
||||
$tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
|
||||
} else {
|
||||
$tdsoffields .= $valuetoshow;
|
||||
}
|
||||
|
|
@ -1643,8 +1645,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
|
||||
|
|
@ -1850,10 +1852,12 @@ if ($id > 0) {
|
|||
|
||||
// Show field title
|
||||
if ($showfield) {
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
$newvaluetoshow = '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} 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 = '<a href="'.$tooltiphelp.'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif ($tooltiphelp) {
|
||||
$newvaluetoshow = $form->textwithpicto($valuetoshow, $tooltiphelp);
|
||||
} else {
|
||||
$newvaluetoshow = $valuetoshow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -592,15 +593,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
'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';
|
||||
|
|
|
|||
|
|
@ -101,9 +101,14 @@ if ($action == 'update') {
|
|||
if ($mode == 'template') {
|
||||
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), '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 == '') {
|
||||
|
|
|
|||
|
|
@ -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 != '') {
|
||||
|
|
|
|||
|
|
@ -528,8 +528,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
$moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitleSeparator();
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= '</li></ul></div>';
|
||||
|
||||
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
|
|
|
|||
|
|
@ -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 '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
if (!empty($conf->propal->enabled)) {
|
||||
print load_fiche_titre($langs->trans("Proposal"), '', '');
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE");
|
||||
print ' <span class="opacitymedium">('.$langs->trans("RandomlySelectedIfSeveral").')</span>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
|
||||
|
|
@ -112,6 +115,29 @@ if (!empty($conf->propal->enabled)) {
|
|||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
print load_fiche_titre($langs->trans("Invoices"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('INVOICE_ADD_ZATCA_QR_CODE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("INVOICE_ADD_ZATCA_QR_CODE", $arrval, $conf->global->INVOICE_ADD_ZATCA_QR_CODE);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
/*
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ print "</td>\n";
|
|||
print "</tr>\n";
|
||||
|
||||
// Option to force stock to be enough before adding a line into document
|
||||
if ($conf->invoice->enabled) {
|
||||
if (!empty($conf->invoice->enabled)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
||||
print '<td class="right">';
|
||||
|
|
@ -408,7 +408,7 @@ if ($conf->invoice->enabled) {
|
|||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($conf->order->enabled) {
|
||||
if (!empty($conf->order->enabled)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
||||
print '<td class="right">';
|
||||
|
|
@ -422,7 +422,7 @@ if ($conf->order->enabled) {
|
|||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($conf->expedition->enabled) {
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
||||
print '<td class="right">';
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
|
|||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
if ($conf->banque->enabled) {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td> </td><td class="right">';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ if (in_array($type, array('pgsql'))) {
|
|||
$prefix = 'pg_dump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall", 'tzuser').'.'.$ext;
|
||||
print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
|
@ -559,10 +559,10 @@ print '</table>';
|
|||
print "</div> <!-- end div fichehalfleft -->\n";
|
||||
|
||||
|
||||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div id="backupdatabaseright" class="fichehalfright">';
|
||||
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:480px; overflow: auto;"');
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
|
@ -594,7 +594,7 @@ print load_fiche_titre($title);
|
|||
print '<label for="zipfilename_template" class="line-height-large paddingbottom">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||
$prefix = 'documents';
|
||||
$ext = 'zip';
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall", 'tzuser');
|
||||
print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
|
||||
print '<br>';
|
||||
|
||||
|
|
@ -639,10 +639,10 @@ print '</div>';
|
|||
|
||||
print '</div>';
|
||||
|
||||
print '<div id="backupfileright" class="fichehalfright" style="height:250px; overflow: auto;">';
|
||||
print '<div id="backupfileright" class="fichehalfright">';
|
||||
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"');
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -88,9 +88,9 @@ class DolibarrApi
|
|||
// phpcs:enable
|
||||
// TODO Use type detected in $object->fields
|
||||
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
|
||||
return checkVal($value, 'restricthtml');
|
||||
return sanitizeVal($value, 'restricthtml');
|
||||
} else {
|
||||
return checkVal($value, 'alphanohtml');
|
||||
return sanitizeVal($value, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ class AssetModel extends CommonObject
|
|||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1'),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',),
|
||||
'asset_type' => array('type'=>'smallint', 'label'=>'AssetType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetTypeIntangible', '1'=>'AssetTypeTangible', '2'=>'AssetTypeInProgress', '3'=>'AssetTypeFinancial'), 'validate'=>'1',),
|
||||
'fk_pays' =>array('type'=>'integer:Ccountry:core/class/ccountry.class.php', 'label'=>'Country', 'enabled'=>1, 'visible'=>1, 'position'=>50),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>300, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>301, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/model/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ if (empty($action) && empty($id) && empty($ref)) {
|
|||
// Load object
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $permissiontoadd; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
|
|
|||
|
|
@ -121,9 +121,9 @@ 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');
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write)));
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->delete)));
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write)));
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete)));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->asset->enabled)) {
|
||||
|
|
@ -131,15 +131,18 @@ if (empty($conf->asset->enabled)) {
|
|||
}
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
$socid = 0; if ($user->socid > 0) $socid = $user->socid;
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->asset->enabled)) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
|
@ -300,19 +303,20 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin
|
|||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
*/
|
||||
/* The slow method does not consume memory on mysql (not tested on pgsql) */
|
||||
/*$resql = $db->query($sql, 0, 'auto', 1);
|
||||
while ($db->fetch_object($resql)) {
|
||||
$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);
|
||||
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
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;
|
||||
$offset = 0;
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2020 Laurent Destailleur <eldy@destailleur.fr>
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2020 Laurent Destailleur <eldy@destailleur.fr>
|
||||
* Copyright (C) 2022 charlene benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -139,76 +140,53 @@ class BlockedLog
|
|||
|
||||
$this->trackedevents = array();
|
||||
|
||||
if ($conf->facture->enabled) {
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['PAYMENT_CUSTOMER_CREATE'] = 'logPAYMENT_CUSTOMER_CREATE';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['PAYMENT_CUSTOMER_DELETE'] = 'logPAYMENT_CUSTOMER_DELETE';
|
||||
}
|
||||
|
||||
/* Supplier
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
|
||||
if (!empty($conf->fournisseur->enabled)) {
|
||||
$this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
|
||||
$this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
|
||||
$this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
|
||||
$this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
|
||||
$this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
|
||||
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
|
||||
}
|
||||
*/
|
||||
|
||||
if ($conf->don->enabled) {
|
||||
if (!empty($conf->don->enabled)) {
|
||||
$this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
|
||||
}
|
||||
if ($conf->don->enabled) {
|
||||
$this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
|
||||
}
|
||||
//if ($conf->don->enabled) $this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
|
||||
|
||||
if ($conf->don->enabled) {
|
||||
//$this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
|
||||
$this->trackedevents['DONATION_PAYMENT_CREATE'] = 'logDONATION_PAYMENT_CREATE';
|
||||
}
|
||||
if ($conf->don->enabled) {
|
||||
$this->trackedevents['DONATION_PAYMENT_DELETE'] = 'logDONATION_PAYMENT_DELETE';
|
||||
}
|
||||
|
||||
/*
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
|
||||
if (!empty($conf->salary->enabled)) {
|
||||
$this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
|
||||
}
|
||||
*/
|
||||
|
||||
if ($conf->adherent->enabled) {
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
$this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
|
||||
}
|
||||
if ($conf->adherent->enabled) {
|
||||
$this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
|
||||
}
|
||||
if ($conf->adherent->enabled) {
|
||||
$this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
|
||||
}
|
||||
if ($conf->banque->enabled) {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
|
||||
}
|
||||
if ($conf->banque->enabled) {
|
||||
$this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
|
||||
}
|
||||
if ($conf->banque->enabled) {
|
||||
$this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
|
||||
}
|
||||
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php';
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mrp", "other"));
|
||||
|
|
@ -581,47 +583,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
console.log($(this).html().indexOf('folder-open'));
|
||||
if($(this).html().indexOf('folder-open') <= 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Show all the sub bom lines
|
||||
$("#show_all").click(function() {
|
||||
console.log("We click on show all");
|
||||
$("[class^=sub_bom_lines]").show();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Hide all the sub bom lines
|
||||
$("#hide_all").click(function() {
|
||||
console.log("We click on hide all");
|
||||
$("[class^=sub_bom_lines]").hide();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
print mrpCollapseBomManagement();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -136,3 +136,55 @@ function bomPrepareHead($object)
|
|||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage collapse bom display
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function mrpCollapseBomManagement()
|
||||
{
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
console.log($(this).html().indexOf('folder-open'));
|
||||
if($(this).html().indexOf('folder-open') <= 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Show all the sub bom lines
|
||||
$("#show_all").click(function() {
|
||||
console.log("We click on show all");
|
||||
$("[class^=sub_bom_lines]").show();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Hide all the sub bom lines
|
||||
$("#hide_all").click(function() {
|
||||
console.log("We click on hide all");
|
||||
$("[class^=sub_bom_lines]").hide();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -919,7 +919,7 @@ class Categorie extends CommonObject
|
|||
|
||||
$categories = array();
|
||||
|
||||
$type = checkVal($type, 'aZ09');
|
||||
$type = sanitizeVal($type, 'aZ09');
|
||||
|
||||
$sub_type = $type;
|
||||
$subcol_name = "fk_".$type;
|
||||
|
|
|
|||
|
|
@ -1241,7 +1241,7 @@ if ($action == 'create') {
|
|||
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container">';
|
||||
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 ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.(empty($societe->id) ? '' : $societe->id).'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">';
|
||||
print '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
|
|
|
|||
|
|
@ -1220,11 +1220,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) {
|
||||
|
|
|
|||
|
|
@ -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 .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
|
|
@ -282,7 +287,8 @@ $nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$
|
|||
$now = dol_now();
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
$title = $langs->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
|
||||
|
|
@ -804,44 +804,57 @@ print '<td class="liste_titre" align="middle">';
|
|||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
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 +862,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 "</tr>\n";
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
$now = dol_now();
|
||||
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
|
||||
|
||||
|
|
@ -869,8 +885,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 +1115,20 @@ while ($i < min($num, $limit)) {
|
|||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 '<td class="nowraponall">';
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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 '<div class="tagtd center">';
|
||||
if ($nbofrecipient >= 0) {
|
||||
if ($nbofrecipient === '' || $nbofrecipient >= 0) {
|
||||
print $nbofrecipient;
|
||||
} else {
|
||||
print $langs->trans("Error").' '.img_error($obj->error);
|
||||
|
|
|
|||
|
|
@ -185,6 +185,11 @@ class Mailing extends CommonObject
|
|||
*/
|
||||
public $substitutionarray;
|
||||
|
||||
/**
|
||||
* @var array substitutionarrayfortest
|
||||
*/
|
||||
public $substitutionarrayfortest;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
|
|||
|
|
@ -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 = '';
|
||||
|
|
|
|||
|
|
@ -351,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,
|
||||
|
|
@ -496,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);
|
||||
|
|
|
|||
|
|
@ -1697,8 +1697,8 @@ if ($action == 'create' && $usercancreate) {
|
|||
if ($socid > 0) {
|
||||
// Contacts (ask contact only if thirdparty already defined).
|
||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
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 '</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
|
|
@ -1755,7 +1755,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
// Shipping Method
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
|
||||
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 '</td></tr>';
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -350,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,
|
||||
|
|
@ -418,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,
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -616,9 +616,18 @@ foreach ($accounts as $key => $type) {
|
|||
|
||||
// Transactions to reconcile
|
||||
if (!empty($arrayfields['toreconcile']['checked'])) {
|
||||
print '<td class="center tdoverflowmax125">';
|
||||
|
||||
$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 '<td class="center tdoverflowmax125"'.($labeltoshow ? ' title="'.dol_escape_htmltag($labeltoshow).'"' : '').'>';
|
||||
if ($conciliate == -2) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("CashAccount").'</span>';
|
||||
} elseif ($conciliate == -3) {
|
||||
|
|
|
|||
|
|
@ -647,7 +647,7 @@ if (empty($action) || $action == "view" || $action == "close") {
|
|||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright">>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
|
@ -659,11 +659,11 @@ if (empty($action) || $action == "view" || $action == "close") {
|
|||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="middle">'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td><td>';
|
||||
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
print '<span class="amount">'.price($object->opening, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
print "</td></tr>";
|
||||
foreach ($arrayofpaymentmode as $key => $val) {
|
||||
print '<tr><td valign="middle">'.$langs->trans($val).'</td><td>';
|
||||
print price($object->$key, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
print '<span class="amount">'.price($object->$key, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 '<td class="right">';
|
||||
if ($obj->totalpaye) {
|
||||
print price($obj->totalpaye);
|
||||
if ($obj->totalpaid) {
|
||||
print price($obj->totalpaid);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total = $total + $obj->total;
|
||||
$totalnb = $totalnb + $obj->nb;
|
||||
$totalpaye = $totalpaye + $obj->totalpaye;
|
||||
$totalpaid = $totalpaid + $obj->totalpaid;
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
|
|
@ -258,7 +258,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
|||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price($totalpaye)."</td>";
|
||||
print '<td class="liste_total right">'.price($totalpaid)."</td>";
|
||||
print "</tr>";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
|
|
|||
|
|
@ -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 .= '</div>';
|
||||
|
||||
$object->totalpaid = $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, '', '');
|
||||
|
||||
|
|
@ -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 '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaid).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
|
@ -5072,7 +5072,7 @@ if ($action == 'create') {
|
|||
} else {
|
||||
print $langs->trans('AlreadyPaid');
|
||||
}
|
||||
print '</span></td><td class="right'.(($totalpaye > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaye).'</td><td> </td></tr>';
|
||||
print '</span></td><td class="right'.(($totalpaid > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaid).'</td><td> </td></tr>';
|
||||
|
||||
$resteapayeraffiche = $resteapayer;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
|
|
@ -5125,7 +5125,7 @@ if ($action == 'create') {
|
|||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
|
|
@ -5135,7 +5135,7 @@ if ($action == 'create') {
|
|||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td> </td></tr>';
|
||||
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</td><td> </td></tr>';
|
||||
// $resteapayeraffiche=0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
|
|
@ -5145,7 +5145,7 @@ if ($action == 'create') {
|
|||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
|
|
@ -5159,7 +5159,7 @@ if ($action == 'create') {
|
|||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
|
|
@ -5220,7 +5220,7 @@ if ($action == 'create') {
|
|||
// Total already paid back
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaid).'</span></td><td> </td></tr>';
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right"><span class="opacitymedium">'.$langs->trans("Billed").'</span></td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
||||
|
|
@ -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 '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
||||
} 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()
|
||||
|
|
|
|||
|
|
@ -428,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,
|
||||
|
|
@ -718,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) {
|
||||
|
|
@ -1425,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();
|
||||
|
||||
|
|
@ -1567,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');
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,7 +171,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaid = $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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 .= '</div>';
|
||||
|
||||
$object->totalpaid = $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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 .= '</div>';
|
||||
|
||||
$object->totalpaid = $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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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 .= '</div>';
|
||||
|
||||
$object->totalpaid = $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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -384,7 +384,7 @@ if ($object->id > 0) {
|
|||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaid = $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, '', '');
|
||||
|
||||
|
|
@ -667,7 +667,7 @@ if ($object->id > 0) {
|
|||
// Total with tax
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="nowrap">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
|
||||
$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 '<tr><td>'.$langs->trans('RemainderToPay').'</td><td class="nowrap">'.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
|
|
|
|||
|
|
@ -102,11 +102,9 @@ print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'bill');
|
|||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
//print getCustomerInvoicePieChart($socid);
|
||||
print getNumberInvoicesPieChart('customers');
|
||||
print '<br>';
|
||||
print getNumberInvoicesPieChart('fourn');
|
||||
//print getPurchaseInvoicePieChart($socid);
|
||||
print '<br>';
|
||||
print getCustomerInvoiceDraftTable($max, $socid);
|
||||
print '<br>';
|
||||
|
|
|
|||
|
|
@ -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 '<td class="nowrap right">'.price(price2num($x_paye_sum, 'MT')).'</td>';
|
||||
|
||||
$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 '<tr class="liste_total">';
|
||||
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtotalcoll, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtotalpaye, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtotalpaid, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
|
||||
print '<td> </td></tr>';
|
||||
$i = 0;
|
||||
$subtotalcoll = 0;
|
||||
$subtotalpaye = 0;
|
||||
$subtotalpaid = 0;
|
||||
$subtotal = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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'";
|
||||
|
|
|
|||
|
|
@ -394,10 +394,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) {
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ if ($id > 0) {
|
|||
print $fac->error."<br>";
|
||||
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)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
@ -576,7 +576,7 @@ if ($id > 0) {
|
|||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$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 '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
$totalpaid += $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -757,10 +757,10 @@ if ($id > 0) {
|
|||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaye)."</td></tr>\n";
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaid)."</td></tr>\n";
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right">'.price($object->amount)."</td></tr>\n";
|
||||
|
||||
$resteapayer = $object->amount - $totalpaye;
|
||||
$resteapayer = $object->amount - $totalpaid;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
|
||||
|
|
@ -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 '<div class="inline-block divButAction"><a class="butActionDelete" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ class ChargeSociales extends CommonObject
|
|||
*/
|
||||
public $total;
|
||||
|
||||
public $totalpaid;
|
||||
|
||||
const STATUS_UNPAID = 0;
|
||||
const STATUS_PAID = 1;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,9 @@ if ($object->id) {
|
|||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = '<div class="refidno">';
|
||||
|
|
@ -106,8 +108,9 @@ $morehtmlref .= '</div>';
|
|||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$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 '<div class="fichecenter">';
|
||||
|
|
|
|||
|
|
@ -113,7 +113,9 @@ if ($id > 0 || !empty($ref)) {
|
|||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
//$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);
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ print '<input type="hidden" name="page" value="'.$page.'">';
|
|||
|
||||
$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 '<td class="right">';
|
||||
if ($obj->totalpaye) {
|
||||
print '<span class="amount">'.price($obj->totalpaye).'</span>';
|
||||
if ($obj->totalpaid) {
|
||||
print '<span class="amount">'.price($obj->totalpaid).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -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 '<td></td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price($totalpaye)."</td>";
|
||||
print '<td class="liste_total right">'.price($totalpaid)."</td>";
|
||||
print '<td></td>';
|
||||
print "</tr>";
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$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 '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
$totalpaid += $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -744,10 +744,10 @@ if ($id > 0) {
|
|||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaye)."</td></tr>\n";
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaid)."</td></tr>\n";
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected")." :</td><td class=\"right\">".price($object->amount)."</td></tr>\n";
|
||||
|
||||
$resteapayer = $object->amount - $totalpaye;
|
||||
$resteapayer = $object->amount - $totalpaid;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
|
||||
|
|
@ -810,7 +810,7 @@ if ($id > 0) {
|
|||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id.'&token='.newToken().'&action=clone">'.$langs->trans("ToClone")."</a></div>";
|
||||
}
|
||||
|
||||
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaye)) {
|
||||
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -101,6 +101,13 @@ class PaymentVAT extends CommonObject
|
|||
*/
|
||||
public $chid;
|
||||
|
||||
/**
|
||||
* @var string lib
|
||||
* @deprecated
|
||||
* @see $label
|
||||
*/
|
||||
public $lib;
|
||||
|
||||
/**
|
||||
* @var integer|string datepaye
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -62,6 +62,11 @@ class Tva extends CommonObject
|
|||
public $type_payment;
|
||||
public $num_payment;
|
||||
|
||||
/**
|
||||
* @var integer|string totalpaid
|
||||
*/
|
||||
public $totalpaid;
|
||||
|
||||
/**
|
||||
* @var string label
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -125,8 +125,9 @@ if ($object->id) {
|
|||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$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 '<div class="fichecenter">';
|
||||
|
|
|
|||
|
|
@ -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 '<td class="nowrap right"><span class="amount">' . price(price2num($x_paye_sum, 'MT')) . '</span></td>';
|
||||
|
||||
$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 '<tr class="liste_total">';
|
||||
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q=' . round($m / 3) . '&year=' . $y . '">' . $langs->trans("SubTotal") . '</a>:</td>';
|
||||
print '<td class="nowrap right">' . price(price2num($subtotalcoll, 'MT')) . '</td>';
|
||||
print '<td class="nowrap right">' . price(price2num($subtotalpaye, 'MT')) . '</td>';
|
||||
print '<td class="nowrap right">' . price(price2num($subtotalpaid, 'MT')) . '</td>';
|
||||
print '<td class="nowrap right">' . price(price2num($subtotal, 'MT')) . '</td>';
|
||||
print '<td> </td></tr>';
|
||||
$i = 0;
|
||||
$subtotalcoll = 0;
|
||||
$subtotalpaye = 0;
|
||||
$subtotalpaid = 0;
|
||||
$subtotal = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -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 '<td>';
|
||||
$tva->id = $obj->rowid;
|
||||
$tva->ref = $obj->rowid;
|
||||
$tva->label = $obj->label;
|
||||
print $tva->getNomUrl(1, '20');
|
||||
print '</td>';
|
||||
|
||||
// Label
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label).'</td>';
|
||||
|
||||
// Date
|
||||
$date = $obj->datev;
|
||||
print '<td>'.dol_print_date($date, 'day').'</td>';
|
||||
$date = $db->jdate($obj->datev);
|
||||
print '<td class="center nowraponall">'.dol_print_date($date, 'day').'</td>';
|
||||
|
||||
// Date payment
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
|
||||
$datep = $db->jdate($obj->datep);
|
||||
print '<td class="center nowraponalls">'.dol_print_date($datep, 'day').'</td>';
|
||||
|
||||
// Type payment
|
||||
print '<td>';
|
||||
$labelpaymenttype = '';
|
||||
if ($obj->payment_code) {
|
||||
print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||
$labelpaymenttype = $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||
}
|
||||
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelpaymenttype).'">';
|
||||
print dol_escape_htmltag($labelpaymenttype);
|
||||
print '</td>';
|
||||
|
||||
// Chq number
|
||||
print '<td>'.$obj->num_payment.'</td>';
|
||||
print '<td>'.dol_escape_htmltag($obj->num_payment).'</td>';
|
||||
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
// Bank transaction
|
||||
|
|
@ -231,21 +236,20 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
|||
print '</td>';
|
||||
}
|
||||
|
||||
// Type
|
||||
//print '<td><a href="../tva/list.php?filtre=tva.fk_type:'.$obj->type.'">'.$obj->type_label.'</a></td>';
|
||||
// Expected to pay
|
||||
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
|
||||
|
||||
// Paid
|
||||
print '<td class="right"><span class="amount">';
|
||||
if ($obj->totalpaye) {
|
||||
print price($obj->totalpaye);
|
||||
if ($obj->totalpaid) {
|
||||
print price($obj->totalpaid);
|
||||
}
|
||||
print '</span></td>';
|
||||
print '</tr>';
|
||||
|
||||
$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 '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td class="liste_total right">'.price($totalpaye)."</td>";
|
||||
print '<td class="liste_total right">'.price($totalpaid)."</td>";
|
||||
print "</tr>";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 '</td></tr>';
|
||||
|
||||
//Default language
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\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 '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).'</td><td colspan="3">';
|
||||
|
|
@ -1151,6 +1168,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
print $form->selectarray('priv', $selectarray, $object->priv, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
//Default language
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
|
||||
print $formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1);
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Note Public
|
||||
print '<tr><td class="tdtop"><label for="note_public">'.$langs->trans("NotePublic").'</label></td><td colspan="3">';
|
||||
$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 '</td></tr>';
|
||||
}
|
||||
|
||||
// Default language
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td>';
|
||||
//$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 '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("ContactVisibility").'</td><td>';
|
||||
print $object->LibPubPriv($object->priv);
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -153,16 +153,16 @@ print '</td></tr>';
|
|||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -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 '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
|
||||
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";
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
// $permissiontodelete must be defined
|
||||
// $backurlforlist must be defined
|
||||
// $backtopage may be defined
|
||||
// $noback may be defined
|
||||
// $triggermodname may be defined
|
||||
|
||||
if (!empty($permissionedit) && empty($permissiontoadd)) {
|
||||
|
|
@ -137,8 +138,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 +315,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 +361,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');
|
||||
|
|
@ -494,8 +502,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');
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
);
|
||||
}
|
||||
|
|
|
|||
478
htdocs/core/class/cgenericdic.class.php
Normal file
478
htdocs/core/class/cgenericdic.class.php
Normal file
|
|
@ -0,0 +1,478 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -6997,7 +6997,7 @@ abstract class CommonObject
|
|||
$out .= '</select>';
|
||||
} 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,12 +7378,12 @@ abstract class CommonObject
|
|||
$checked = ' checked ';
|
||||
}
|
||||
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
|
||||
} 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);
|
||||
|
|
@ -7982,7 +7982,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,7 +7993,8 @@ 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'))) {
|
||||
|
|
@ -8000,7 +8002,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,30 +99,22 @@ class Ctypent // extends CommonObject
|
|||
$this->module = trim($this->module);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_typent(";
|
||||
|
||||
$sql .= "id,";
|
||||
$sql .= "code,";
|
||||
$sql .= "libelle,";
|
||||
$sql .= "active,";
|
||||
$sql .= "module";
|
||||
|
||||
|
||||
$sql .= ") VALUES (";
|
||||
|
||||
$sql .= " ".(!isset($this->id) ? 'NULL' : "'".$this->db->escape($this->id)."'").",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
|
||||
$sql .= " ".(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'").",";
|
||||
$sql .= " ".(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'")."";
|
||||
|
||||
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -276,7 +268,7 @@ class Ctypent // extends CommonObject
|
|||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."c_typent";
|
||||
$sql .= " WHERE id=".$this->id;
|
||||
$sql .= " WHERE id = ".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@
|
|||
/**
|
||||
* Class Ctyperesource
|
||||
*
|
||||
* Put here description of your class
|
||||
*
|
||||
* @see CommonObject
|
||||
*/
|
||||
class Ctyperesource
|
||||
|
|
@ -93,26 +91,15 @@ class Ctyperesource
|
|||
$this->active = trim($this->active);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'(';
|
||||
|
||||
$sql .= 'code,';
|
||||
$sql .= 'label';
|
||||
$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();
|
||||
|
|
@ -177,7 +164,6 @@ class Ctyperesource
|
|||
$sql .= " WHERE t.label = '".$this->db->escape($label)."'";
|
||||
}
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
|
|
@ -308,12 +294,9 @@ class Ctyperesource
|
|||
|
||||
// Update request
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET';
|
||||
|
||||
$sql .= ' code = '.(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").',';
|
||||
$sql .= ' label = '.(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").',';
|
||||
$sql .= ' active = '.(isset($this->active) ? $this->active : "null");
|
||||
|
||||
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
* {dol_cut_paper_partial} Cut ticket partially
|
||||
* {dol_open_drawer} Open cash drawer
|
||||
* {dol_beep} Activate buzzer
|
||||
* {dol_beep_alternative} Activate buzzer (alternative mode)
|
||||
* {dol_print_barcode} Print barcode
|
||||
* {dol_print_logo} Print logo stored on printer. Example : <print_logo>32|32
|
||||
* {dol_print_logo_old} Print logo stored on printer. Must be followed by logo code. For old printers.
|
||||
|
|
@ -52,6 +53,7 @@
|
|||
* {dol_print_order_lines} Print order lines for Printer
|
||||
* {dol_print_object_lines_with_notes} Print object lines with notes
|
||||
* {dol_print_payment} Print payment method
|
||||
* {dol_print_curr_date} Print the current date/time. Must be followed by format string.
|
||||
*
|
||||
* Code which can be placed everywhere
|
||||
* <dol_value_date> Replaced by date AAAA-MM-DD
|
||||
|
|
@ -178,6 +180,7 @@ class dolReceiptPrinter extends Printer
|
|||
'dol_cut_paper_partial' => 'DOL_CUT_PAPER_PARTIAL',
|
||||
'dol_open_drawer' => 'DOL_OPEN_DRAWER',
|
||||
'dol_beep' => 'DOL_BEEP',
|
||||
'dol_beep_alternative' => 'DOL_BEEP_ALTERNATIVE',
|
||||
'dol_print_text' => 'DOL_PRINT_TEXT',
|
||||
'dol_print_barcode' => 'DOL_PRINT_BARCODE',
|
||||
'dol_value_date' => 'DateInvoice',
|
||||
|
|
@ -189,6 +192,7 @@ class dolReceiptPrinter extends Printer
|
|||
'dol_value_day_letters' => 'DOL_VALUE_DAY',
|
||||
'dol_value_currentdate' => 'DOL_VALUE_CURRENTDATE',
|
||||
'dol_print_payment' => 'DOL_PRINT_PAYMENT',
|
||||
'dol_print_curr_date' => 'DOL_PRINT_CURR_DATE',
|
||||
'dol_print_logo' => 'DOL_PRINT_LOGO',
|
||||
'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD',
|
||||
'dol_value_object_id' => 'InvoiceID',
|
||||
|
|
@ -712,6 +716,10 @@ class dolReceiptPrinter extends Printer
|
|||
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
|
||||
$this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
break;
|
||||
case 'DOL_PRINT_CURR_DATE':
|
||||
if (strlen($vals[$tplline]['value'])<2) $this->printer->text(date('d/m/Y H:i:s')."\n");
|
||||
else $this->printer->text(date($vals[$tplline]['value'])."\n");
|
||||
break;
|
||||
case 'DOL_LINE_FEED':
|
||||
$this->printer->feed();
|
||||
break;
|
||||
|
|
@ -794,6 +802,9 @@ class dolReceiptPrinter extends Printer
|
|||
case 'DOL_BEEP':
|
||||
$this->printer->getPrintConnector() -> write("\x1e");
|
||||
break;
|
||||
case 'DOL_BEEP_ALTERNATIVE': //if DOL_BEEP not works
|
||||
$this->printer->getPrintConnector() -> write(Printer::ESC . "B" . chr(4) . chr(1));
|
||||
break;
|
||||
case 'DOL_PRINT_ORDER_LINES':
|
||||
foreach ($object->lines as $line) {
|
||||
if ($line->special_code == $this->orderprinter) {
|
||||
|
|
|
|||
|
|
@ -1067,35 +1067,56 @@ class ExtraFields
|
|||
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> ';
|
||||
} elseif ($type == 'select') {
|
||||
$out = '';
|
||||
if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
|
||||
}
|
||||
if ($mode) {
|
||||
$options = array();
|
||||
foreach ($param['options'] as $okey => $val) {
|
||||
if ((string) $okey == '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val) {
|
||||
if ((string) $key == '') {
|
||||
continue;
|
||||
if ($langfile && $val) {
|
||||
$options[$okey] = $langs->trans($val);
|
||||
} else {
|
||||
$options[$okey] = $val;
|
||||
}
|
||||
}
|
||||
$valarray = explode('|', $val);
|
||||
$val = $valarray[0];
|
||||
$parent = '';
|
||||
if (!empty($valarray[1])) {
|
||||
$parent = $valarray[1];
|
||||
$selected = array();
|
||||
if (!is_array($value)) {
|
||||
$selected = explode(',', $value);
|
||||
}
|
||||
$out .= '<option value="'.$key.'"';
|
||||
$out .= (((string) $value == (string) $key) ? ' selected' : '');
|
||||
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
|
||||
$out .= '>';
|
||||
if ($langfile && $val) {
|
||||
$out .= $langs->trans($val);
|
||||
} else {
|
||||
$out .= $val;
|
||||
|
||||
$out .= $form->multiselectarray($keyprefix.$key.$keysuffix, $options, $selected, 0, 0, $morecss, 0, 0, '', '', '', !empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2));
|
||||
} else {
|
||||
if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
|
||||
}
|
||||
$out .= '</option>';
|
||||
|
||||
$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val) {
|
||||
if ((string) $key == '') {
|
||||
continue;
|
||||
}
|
||||
$valarray = explode('|', $val);
|
||||
$val = $valarray[0];
|
||||
$parent = '';
|
||||
if (!empty($valarray[1])) {
|
||||
$parent = $valarray[1];
|
||||
}
|
||||
$out .= '<option value="'.$key.'"';
|
||||
$out .= (((string) $value == (string) $key) ? ' selected' : '');
|
||||
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
|
||||
$out .= '>';
|
||||
if ($langfile && $val) {
|
||||
$out .= $langs->trans($val);
|
||||
} else {
|
||||
$out .= $val;
|
||||
}
|
||||
$out .= '</option>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
} elseif ($type == 'sellist') {
|
||||
$out = '';
|
||||
if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
|
||||
|
|
@ -2133,6 +2154,16 @@ class ExtraFields
|
|||
} else {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
}
|
||||
} elseif ($key_type == 'select') {
|
||||
// to detect if we are in search context
|
||||
if (GETPOSTISARRAY($keysuffix."options_".$key.$keyprefix)) {
|
||||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix, 'array:aZ09');
|
||||
// Make sure we get an array even if there's only one selected
|
||||
$value_arr = (array) $value_arr;
|
||||
$value_key = implode(',', $value_arr);
|
||||
} else {
|
||||
$value_key = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
}
|
||||
} elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
|
|
|
|||
|
|
@ -867,17 +867,17 @@ class Form
|
|||
/**
|
||||
* Return combo list of activated countries, into language of user
|
||||
*
|
||||
* @param string $selected Id or Code or Label of preselected country
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption More html options on select object
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @param int $showempty Show empty choice
|
||||
* @param int $disablefavorites 1=Disable favorites,
|
||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||
* @param array $exclude_country_code Array of country code (iso2) to exclude
|
||||
* @param int $hideflags Hide flags
|
||||
* @param string $selected Id or Code or Label of preselected country
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption More html options on select object
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @param int|string $showempty Show empty choice
|
||||
* @param int $disablefavorites 1=Disable favorites,
|
||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||
* @param array $exclude_country_code Array of country code (iso2) to exclude
|
||||
* @param int $hideflags Hide flags
|
||||
* @return string HTML string with select
|
||||
*/
|
||||
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array(), $hideflags = 0)
|
||||
|
|
@ -926,7 +926,11 @@ class Form
|
|||
}
|
||||
|
||||
if ($showempty) {
|
||||
$out .= '<option value=""> </option>'."\n";
|
||||
if (is_numeric($showempty)) {
|
||||
$out .= '<option value=""> </option>'."\n";
|
||||
} else {
|
||||
$out .= '<option value="">'.$langs->trans($showempty).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($addspecialentries) { // Add dedicated entries for groups of countries
|
||||
|
|
@ -1279,7 +1283,6 @@ class Form
|
|||
|
||||
// mode 1
|
||||
$urloption = 'htmlname='.urlencode(str_replace('.', '_', $htmlname)).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : '');
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
|
||||
$out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>';
|
||||
if (empty($hidelabel)) {
|
||||
|
|
@ -1294,6 +1297,8 @@ class Form
|
|||
if ($hidelabel == 3) {
|
||||
$out .= img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
} else {
|
||||
// Immediate load of all database
|
||||
$out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids);
|
||||
|
|
@ -8431,12 +8436,13 @@ class Form
|
|||
/**
|
||||
* Show linked object block.
|
||||
*
|
||||
* @param CommonObject $object Object we want to show links to
|
||||
* @param string $morehtmlright More html to show on right of title
|
||||
* @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
* @param CommonObject $object Object we want to show links to
|
||||
* @param string $morehtmlright More html to show on right of title
|
||||
* @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
|
||||
* @param string $title Title
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false)
|
||||
public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false, $title = 'RelatedObjects')
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
global $bc, $action;
|
||||
|
|
@ -8455,7 +8461,7 @@ class Form
|
|||
$nbofdifferenttypes = count($object->linkedObjects);
|
||||
|
||||
print '<!-- showLinkedObjectBlock -->';
|
||||
print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '', 0, 0, 'showlinkedobjectblock');
|
||||
print load_fiche_titre($langs->trans($title), $morehtmlright, '', 0, 0, 'showlinkedobjectblock');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
|
|
@ -8526,11 +8532,6 @@ class Form
|
|||
if (empty($conf->expedition->enabled)) {
|
||||
continue; // Do not show if module disabled
|
||||
}
|
||||
} elseif ($objecttype == 'mo') {
|
||||
$tplpath = 'mrp/mo';
|
||||
if (empty($conf->mrp->enabled)) {
|
||||
continue; // Do not show if module disabled
|
||||
}
|
||||
} elseif ($objecttype == 'ficheinter') {
|
||||
$tplpath = 'fichinter';
|
||||
if (empty($conf->ficheinter->enabled)) {
|
||||
|
|
@ -9435,7 +9436,6 @@ class Form
|
|||
if ($resql) {
|
||||
// Enhance with select2
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
$out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
|
||||
|
||||
|
|
@ -9477,6 +9477,8 @@ class Form
|
|||
$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
|
||||
$out .= ajax_combobox($htmlname);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ class FormCompany extends Form
|
|||
if (!empty($htmlname) && $user->admin) {
|
||||
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '<input type="submit" class="button button-save valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ class FormCompany extends Form
|
|||
if (!empty($htmlname) && $user->admin) {
|
||||
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '<input type="submit" class="button button-save valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1162,12 +1162,13 @@ class FormFile
|
|||
* @param string $sortfield Sort field ('name', 'size', 'position', ...)
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
|
||||
* @param int $addfilterfields Add line with filters
|
||||
* @param int $addfilterfields Add the line with filters
|
||||
* @param int $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitely to 0 or 1)
|
||||
* @param string $moreattrondiv More attributes on the div for responsive. Example 'style="height:280px; overflow: auto;"'
|
||||
* @return int <0 if KO, nb of files shown if OK
|
||||
* @see list_of_autoecmfiles()
|
||||
*/
|
||||
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1)
|
||||
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1, $moreattrondiv = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $conf, $langs, $hookmanager, $form;
|
||||
|
|
@ -1272,7 +1273,7 @@ class FormFile
|
|||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<div class="div-table-responsive-no-min"'.($moreattrondiv ? ' '.$moreattrondiv : '').'>';
|
||||
print '<table id="tablelines" class="centpercent liste noborder nobottom">'."\n";
|
||||
|
||||
if (!empty($addfilterfields)) {
|
||||
|
|
@ -1340,7 +1341,8 @@ class FormFile
|
|||
print '<!-- Line list_of_documents '.$key.' relativepath = '.$relativepath.' -->'."\n";
|
||||
// Do we have entry into database ?
|
||||
print '<!-- In database: position='.(array_key_exists('position', $filearray[$key]) ? $filearray[$key]['position'] : 0).' -->'."\n";
|
||||
print '<tr class="oddeven" id="row-'.(array_key_exists('rowid', $filearray[$key]) ? ($filearray[$key]['rowid'] > 0) : 0) ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1).'">';
|
||||
print '<tr class="oddeven" id="row-'.((array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
|
||||
|
||||
|
||||
// File name
|
||||
print '<td class="minwith200 tdoverflowmax500">';
|
||||
|
|
|
|||
|
|
@ -191,14 +191,9 @@ class FormProjets
|
|||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Use select2 selector
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
||||
$out .= $comboenhancement;
|
||||
$morecss .= ' minwidth100';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlid.'" name="'.$htmlname.'">';
|
||||
}
|
||||
|
|
@ -284,6 +279,15 @@ class FormProjets
|
|||
if (empty($option_only)) {
|
||||
$out .= '</select>';
|
||||
}
|
||||
|
||||
// Use select2 selector
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
||||
$out .= $comboenhancement;
|
||||
$morecss .= ' minwidth100';
|
||||
}
|
||||
|
||||
if (empty($nooutput)) {
|
||||
print $out;
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ class FormTicket
|
|||
}
|
||||
}
|
||||
|
||||
if ($conf->knowledgemanagement->enabled) {
|
||||
if (!empty($conf->knowledgemanagement->enabled)) {
|
||||
// KM Articles
|
||||
print '<tr id="KWwithajax"></tr>';
|
||||
print '<!-- Script to manage change of ticket group -->
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ class Utils
|
|||
$prefix = 'pg_dump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall", 'tzuser').'.'.$ext;
|
||||
}
|
||||
|
||||
$outputdir = $conf->admin->dir_output.'/backup';
|
||||
|
|
@ -276,7 +276,7 @@ class Utils
|
|||
$param = $dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
|
||||
$param .= " -u ".$dolibarr_main_db_user;
|
||||
if (!empty($dolibarr_main_db_port)) {
|
||||
$param .= " -P ".$dolibarr_main_db_port;
|
||||
$param .= " -P ".$dolibarr_main_db_port." --protocol=tcp";
|
||||
}
|
||||
if (GETPOST("use_transaction", "alpha")) {
|
||||
$param .= " --single-transaction";
|
||||
|
|
|
|||
|
|
@ -71,25 +71,24 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
|||
|
||||
if ($canedit) {
|
||||
print '<div class="divsearchfield">';
|
||||
|
||||
// Type
|
||||
$multiselect = 0;
|
||||
if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
|
||||
$multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
|
||||
}
|
||||
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
|
||||
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500');
|
||||
print img_picto($langs->trans("ActionType"), 'square', 'class="pictofixedwidth inline-block" style="color: #ddd;"');
|
||||
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500 widthcentpercentminusx');
|
||||
print '</div>';
|
||||
|
||||
// Assigned to user
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="fawidth30 inline-block"');
|
||||
print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="pictofixedwidth inline-block"');
|
||||
print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'minwidth150 maxwidth500 widthcentpercentminusxx');
|
||||
print '</div>';
|
||||
|
||||
// Assigned to user group
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("ToUserOfGroup"), 'object_group', 'class="fawidth30 inline-block"');
|
||||
print img_picto($langs->trans("ToUserOfGroup"), 'object_group', 'class="pictofixedwidth inline-block"');
|
||||
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit, '', '', '0', false, 'minwidth100 maxwidth500 widthcentpercentminusxx');
|
||||
print '</div>';
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
|||
|
||||
// Resource
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("Resource"), 'object_resource', 'class="fawidth30 inline-block"');
|
||||
print img_picto($langs->trans("Resource"), 'object_resource', 'class="pictofixedwidth inline-block"');
|
||||
print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2, 0, 'maxwidth500');
|
||||
print '</div>';
|
||||
}
|
||||
|
|
@ -107,7 +106,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
|||
|
||||
if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) {
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("ThirdParty"), 'company', 'class="fawidth30 inline-block"');
|
||||
print img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth inline-block"');
|
||||
print $form->select_company($socid, 'search_socid', '', ' ', 0, 0, null, 0, 'minwidth100 maxwidth500');
|
||||
print '</div>';
|
||||
}
|
||||
|
|
@ -117,7 +116,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
|||
$formproject = new FormProjets($db);
|
||||
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("Project"), 'project', 'class="fawidth30 inline-block"');
|
||||
print img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth inline-block"');
|
||||
print $formproject->select_projects($socid ? $socid : -1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print '</div>';
|
||||
}
|
||||
|
|
@ -125,7 +124,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
|||
if ($canedit && !preg_match('/list/', $_SERVER["PHP_SELF"])) {
|
||||
// Status
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("Status"), 'setup', 'class="fawidth30 inline-block"');
|
||||
print img_picto($langs->trans("Status"), 'setup', 'class="pictofixedwidth inline-block"');
|
||||
$formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
|
||||
print '</div>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -964,6 +964,69 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a directory into another name.
|
||||
*
|
||||
* @param string $srcdir Source directory
|
||||
* @param string $destdir Destination directory
|
||||
* @param int $overwriteifexists Overwrite directory if exists (1 by default)
|
||||
* @param int $indexdatabase Index new file into database.
|
||||
* @param int $renamedircontent Rename contents inside srcdir.
|
||||
*
|
||||
* @return boolean True if OK, false if KO
|
||||
*/
|
||||
function dol_move_dir($srcdir, $destdir, $overwriteifexists = 1, $indexdatabase = 1, $renamedircontent = 1)
|
||||
{
|
||||
|
||||
global $user, $db, $conf;
|
||||
$result = false;
|
||||
|
||||
dol_syslog("files.lib.php::dol_move_dir srcdir=".$srcdir." destdir=".$destdir." overwritifexists=".$overwriteifexists." indexdatabase=".$indexdatabase." renamedircontent=".$renamedircontent);
|
||||
$srcexists = dol_is_dir($srcdir);
|
||||
$srcbasename = basename($srcdir);
|
||||
$destexists = dol_is_dir($destdir);
|
||||
|
||||
if (!$srcexists) {
|
||||
dol_syslog("files.lib.php::dol_move_dir srcdir does not exists. we ignore the move request.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($overwriteifexists || !$destexists) {
|
||||
$newpathofsrcdir = dol_osencode($srcdir);
|
||||
$newpathofdestdir = dol_osencode($destdir);
|
||||
|
||||
$result = @rename($newpathofsrcdir, $newpathofdestdir);
|
||||
|
||||
if ($result && $renamedircontent) {
|
||||
if (file_exists($newpathofdestdir)) {
|
||||
$destbasename = basename($newpathofdestdir);
|
||||
$files = dol_dir_list($newpathofdestdir);
|
||||
if (!empty($files) && is_array($files)) {
|
||||
foreach ($files as $key => $file) {
|
||||
if (!file_exists($file["fullname"])) continue;
|
||||
$filepath = $file["path"];
|
||||
$oldname = $file["name"];
|
||||
|
||||
$newname = str_replace($srcbasename, $destbasename, $oldname);
|
||||
if (!empty($newname) && $newname !== $oldname) {
|
||||
if ($file["type"] == "dir") {
|
||||
$res = dol_move_dir($filepath.'/'.$oldname, $filepath.'/'.$newname, $overwriteifexists, $indexdatabase, $renamedircontent);
|
||||
} else {
|
||||
$res = dol_move($filepath.'/'.$oldname, $filepath.'/'.$newname);
|
||||
}
|
||||
if (!$res) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unescape a file submitted by upload.
|
||||
* PHP escape char " (%22) or char ' (%27) into $FILES.
|
||||
|
|
|
|||
|
|
@ -370,6 +370,32 @@ function GETPOSTISSET($paramname)
|
|||
return $isset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the parameter $paramname is submit from a POST OR GET as an array.
|
||||
* Can be used before GETPOST to know if the $check param of GETPOST need to check an array or a string
|
||||
*
|
||||
* @param string $paramname Name or parameter to test
|
||||
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
|
||||
* @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty)
|
||||
*/
|
||||
function GETPOSTISARRAY($paramname, $method = 0)
|
||||
{
|
||||
// for $method test need return the same $val as GETPOST
|
||||
if (empty($method)) {
|
||||
$val = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] : '');
|
||||
} elseif ($method == 1) {
|
||||
$val = isset($_GET[$paramname]) ? $_GET[$paramname] : '';
|
||||
} elseif ($method == 2) {
|
||||
$val = isset($_POST[$paramname]) ? $_POST[$paramname] : '';
|
||||
} elseif ($method == 3) {
|
||||
$val = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : '');
|
||||
} else {
|
||||
$val = 'BadFirstParameterForGETPOST';
|
||||
}
|
||||
|
||||
return is_array($val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value of a param into GET or POST supervariable.
|
||||
* Use the property $user->default_values[path]['createform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
||||
|
|
@ -660,11 +686,11 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
|
|||
$tmpcheck = 'alphanohtml';
|
||||
}
|
||||
foreach ($out as $outkey => $outval) {
|
||||
$out[$outkey] = checkVal($outval, $tmpcheck, $filter, $options);
|
||||
$out[$outkey] = sanitizeVal($outval, $tmpcheck, $filter, $options);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$out = checkVal($out, $check, $filter, $options);
|
||||
$out = sanitizeVal($out, $check, $filter, $options);
|
||||
}
|
||||
|
||||
// Sanitizing for special parameters.
|
||||
|
|
@ -713,9 +739,11 @@ function GETPOSTINT($paramname, $method = 0)
|
|||
return (int) GETPOST($paramname, 'int', $method, null, null, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a value after checking on a rule. A sanitization may also have been done.
|
||||
* Return a sanitized or empty value after checking value against a rule.
|
||||
*
|
||||
* @deprecated
|
||||
* @param string|array $out Value to check/clear.
|
||||
* @param string $check Type of check/sanitizing
|
||||
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
|
||||
|
|
@ -723,9 +751,24 @@ function GETPOSTINT($paramname, $method = 0)
|
|||
* @return string|array Value sanitized (string or array). It may be '' if format check fails.
|
||||
*/
|
||||
function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = null)
|
||||
{
|
||||
return sanitizeVal($out, $check, $filter, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a sanitized or empty value after checking value against a rule.
|
||||
*
|
||||
* @param string|array $out Value to check/clear.
|
||||
* @param string $check Type of check/sanitizing
|
||||
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
|
||||
* @param mixed $options Options to pass to filter_var when $check is set to 'custom'
|
||||
* @return string|array Value sanitized (string or array). It may be '' if format check fails.
|
||||
*/
|
||||
function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// TODO : use class "Validate" to perform tests (and add missing tests) if needed for factorize
|
||||
// Check is done after replacement
|
||||
switch ($check) {
|
||||
case 'none':
|
||||
|
|
@ -2115,9 +2158,9 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
|||
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
|
||||
}
|
||||
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva', 'salary'))) {
|
||||
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
|
||||
$tmptxt = $object->getLibStatut(6, $object->totalpaid);
|
||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
|
||||
$tmptxt = $object->getLibStatut(5, $object->totalpaye);
|
||||
$tmptxt = $object->getLibStatut(5, $object->totalpaid);
|
||||
}
|
||||
$morehtmlstatus .= $tmptxt;
|
||||
} elseif ($object->element == 'contrat' || $object->element == 'contract') {
|
||||
|
|
@ -2261,7 +2304,7 @@ function dol_bc($var, $moreclass = '')
|
|||
*/
|
||||
function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0, $extralangcode = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$ret = '';
|
||||
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR', 'CN'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
||||
|
|
@ -2328,6 +2371,14 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
|||
$langs->load("dict");
|
||||
$ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)));
|
||||
}
|
||||
if ($hookmanager) {
|
||||
$parameters = array('withcountry' => $withcountry, 'sep' => $sep, 'outputlangs' => $outputlangs,'mode' => $mode, 'extralangcode' => $extralangcode);
|
||||
$reshook = $hookmanager->executeHooks('formatAddress', $parameters, $object);
|
||||
if ($reshook > 0) {
|
||||
$ret = '';
|
||||
}
|
||||
$ret .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
|
@ -2453,6 +2504,9 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
|
|||
} elseif ($format == 'dayhourlog') {
|
||||
// Format not sensitive to language
|
||||
$format = '%Y%m%d%H%M%S';
|
||||
} elseif ($format == 'dayhourlogsmall') {
|
||||
// Format not sensitive to language
|
||||
$format = '%Y%m%d%H%M';
|
||||
} elseif ($format == 'dayhourldap') {
|
||||
$format = '%Y%m%d%H%M%SZ';
|
||||
} elseif ($format == 'dayhourxcard') {
|
||||
|
|
@ -3714,6 +3768,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
|
|||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||
$url = DOL_URL_ROOT;
|
||||
$theme = isset($conf->theme) ? $conf->theme : null;
|
||||
|
|
@ -3732,15 +3787,25 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||
}
|
||||
} else {
|
||||
$pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
|
||||
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
|
||||
|
||||
if (strpos($pictowithouttext, 'fontawesome_') !== false) {
|
||||
$pictowithouttext = explode('_', $pictowithouttext);
|
||||
if (strpos($pictowithouttext, 'fontawesome_') !== false || preg_match('/^fa-/', $pictowithouttext)) {
|
||||
// This is a font awesome image 'fonwtawesome_xxx' or 'fa-xxx'
|
||||
$pictowithouttext = str_replace('fa-', '', $pictowithouttext);
|
||||
$pictowithouttextarray = explode('_', $pictowithouttext);
|
||||
$marginleftonlyshort = 0;
|
||||
|
||||
$fakey = 'fa-'.$pictowithouttext[1];
|
||||
$fa = $pictowithouttext[2] ? $pictowithouttext[2] : 'fa';
|
||||
$facolor = $pictowithouttext[3] ? $pictowithouttext[3] : '';
|
||||
$fasize = $pictowithouttext[4] ? $pictowithouttext[4] : '';
|
||||
if (!empty($pictowithouttextarray[1])) {
|
||||
$fakey = 'fa-'.$pictowithouttextarray[1];
|
||||
$fa = empty($pictowithouttextarray[2]) ? 'fa' : $pictowithouttextarray[2];
|
||||
$facolor = empty($pictowithouttextarray[3]) ? '' : $pictowithouttextarray[3];
|
||||
$fasize = empty($pictowithouttextarray[4]) ? '' : $pictowithouttextarray[4];
|
||||
} else {
|
||||
$fakey = 'fa-'.$pictowithouttext;
|
||||
$fa = 'fa';
|
||||
$facolor = '';
|
||||
$fasize = '';
|
||||
}
|
||||
|
||||
// This snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only.
|
||||
// class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes.
|
||||
|
|
@ -3766,7 +3831,6 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||
return $enabledisablehtml;
|
||||
}
|
||||
|
||||
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
|
|
@ -4904,10 +4968,10 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
|||
$liste_titre = 'liste_titre_sel';
|
||||
}
|
||||
|
||||
$out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
|
||||
$tagstart = '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
|
||||
//$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
|
||||
$out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
|
||||
$out .= '>';
|
||||
$tagstart .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
|
||||
$tagstart .= '>';
|
||||
|
||||
if (empty($thead) && $field && empty($disablesortlink)) { // If this is a sort field
|
||||
$options = preg_replace('/sortfield=([a-zA-Z0-9,\s\.]+)/i', '', (is_scalar($moreparam) ? $moreparam : ''));
|
||||
|
|
@ -4921,12 +4985,10 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
|||
if ($field1 != $sortfield1) { // We are on another field than current sorted field
|
||||
if (preg_match('/^DESC/i', $sortorder)) {
|
||||
$sortordertouseinlink .= str_repeat('desc,', count(explode(',', $field)));
|
||||
} else // We reverse the var $sortordertouseinlink
|
||||
{
|
||||
} else { // We reverse the var $sortordertouseinlink
|
||||
$sortordertouseinlink .= str_repeat('asc,', count(explode(',', $field)));
|
||||
}
|
||||
} else // We are on field that is the first current sorting criteria
|
||||
{
|
||||
} else { // We are on field that is the first current sorting criteria
|
||||
if (preg_match('/^ASC/i', $sortorder)) { // We reverse the var $sortordertouseinlink
|
||||
$sortordertouseinlink .= str_repeat('desc,', count(explode(',', $field)));
|
||||
} else {
|
||||
|
|
@ -4965,19 +5027,19 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
|||
if (preg_match('/^DESC/', $sortorder)) {
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>';
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",1).'</a>';
|
||||
$sortimg .= '<span class="nowrap">'.img_up("Z-A", 0, 'paddingleft').'</span>';
|
||||
$sortimg .= '<span class="nowrap">'.img_up("Z-A", 0, 'paddingright').'</span>';
|
||||
}
|
||||
if (preg_match('/^ASC/', $sortorder)) {
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",1).'</a>';
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",0).'</a>';
|
||||
$sortimg .= '<span class="nowrap">'.img_down("A-Z", 0, 'paddingleft').'</span>';
|
||||
$sortimg .= '<span class="nowrap">'.img_down("A-Z", 0, 'paddingright').'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$out .= $sortimg;
|
||||
$tagend = '</'.$tag.'>';
|
||||
|
||||
$out .= '</'.$tag.'>';
|
||||
$out = $tagstart.$sortimg.$out.$tagend;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,246 +245,6 @@ function supplier_invoice_rec_prepare_head($object)
|
|||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a HTML table that contains a pie chart of customer invoices
|
||||
*
|
||||
* @param int $socid (Optional) Show only results from the customer with this id
|
||||
* @return string A HTML table that contains a pie chart of customer invoices
|
||||
*/
|
||||
function getCustomerInvoicePieChart($socid = 0)
|
||||
{
|
||||
global $conf, $db, $langs, $user;
|
||||
|
||||
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql = "SELECT count(f.rowid), f.fk_statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture').")";
|
||||
if ($user->socid) {
|
||||
$sql .= ' AND f.fk_soc = '.((int) $user->socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " GROUP BY f.fk_statut";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
return '';
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$total = 0;
|
||||
$vals = array();
|
||||
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) {
|
||||
$vals[$row[1]] = $row[0];
|
||||
$total += $row[0];
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
$result = '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder nohover centpercent">';
|
||||
$result .= '<tr class="liste_titre">';
|
||||
$result .= '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomerInvoice").'</td>';
|
||||
$result .= '</tr>';
|
||||
|
||||
$objectstatic = new Facture($db);
|
||||
$array = array(Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_CLOSED, Facture::STATUS_ABANDONED);
|
||||
$dataseries = array();
|
||||
|
||||
foreach ($array as $status) {
|
||||
$objectstatic->statut = $status;
|
||||
$objectstatic->paye = $status == Facture::STATUS_CLOSED ? -1 : 0;
|
||||
|
||||
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
|
||||
if ($status == Facture::STATUS_DRAFT) {
|
||||
$colorseries[$status] = '-'.$badgeStatus0;
|
||||
}
|
||||
if ($status == Facture::STATUS_VALIDATED) {
|
||||
$colorseries[$status] = $badgeStatus1;
|
||||
}
|
||||
if ($status == Facture::STATUS_CLOSED) {
|
||||
$colorseries[$status] = $badgeStatus9;
|
||||
}
|
||||
if ($status == Facture::STATUS_ABANDONED) {
|
||||
$colorseries[$status] = $badgeStatus6;
|
||||
}
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td>'.$objectstatic->getLibStatut(0).'</td>';
|
||||
$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
|
||||
$result .= '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->SetDataColor(array_values($colorseries));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(['pie']);
|
||||
$dolgraph->setHeight('150');
|
||||
$dolgraph->setWidth('300');
|
||||
$dolgraph->draw('idgraphcustomerinvoices');
|
||||
|
||||
$result .= '<tr>';
|
||||
$result .= '<td align="center" colspan="2">'.$dolgraph->show($total ? 0 : 1).'</td>';
|
||||
$result .= '</tr>';
|
||||
}
|
||||
|
||||
$result .= '<tr class="liste_total">';
|
||||
$result .= '<td>'.$langs->trans("Total").'</td>';
|
||||
$result .= '<td class="right">'.$total.'</td>';
|
||||
$result .= '</tr>';
|
||||
|
||||
$result .= '</table>';
|
||||
$result .= '</div>';
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a HTML table that contains a pie chart of supplier invoices
|
||||
*
|
||||
* @param int $socid (Optional) Show only results from the supplier with this id
|
||||
* @return string A HTML table that contains a pie chart of supplier invoices
|
||||
*/
|
||||
function getPurchaseInvoicePieChart($socid = 0)
|
||||
{
|
||||
global $conf, $db, $langs, $user;
|
||||
|
||||
if (!((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql = "SELECT count(f.rowid), f.fk_statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
|
||||
if ($user->socid) {
|
||||
$sql .= ' AND f.fk_soc = '.((int) $user->socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " GROUP BY f.fk_statut";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
return '';
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$total = 0;
|
||||
$vals = array();
|
||||
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) {
|
||||
$vals[$row[1]] = $row[0];
|
||||
$total += $row[0];
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
$result = '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder nohover centpercent">';
|
||||
|
||||
$result .= '<tr class="liste_titre">';
|
||||
$result .= '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SupplierInvoice").'</td>';
|
||||
$result .= '</tr>';
|
||||
|
||||
$objectstatic = new FactureFournisseur($db);
|
||||
$array = array(FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_CLOSED, FactureFournisseur::STATUS_ABANDONED);
|
||||
$dataseries = array();
|
||||
|
||||
foreach ($array as $status) {
|
||||
$objectstatic->statut = $status;
|
||||
$objectstatic->paye = $status == FactureFournisseur::STATUS_CLOSED ? -1 : 0;
|
||||
|
||||
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
|
||||
if ($status == FactureFournisseur::STATUS_DRAFT) {
|
||||
$colorseries[$status] = '-'.$badgeStatus0;
|
||||
}
|
||||
if ($status == FactureFournisseur::STATUS_VALIDATED) {
|
||||
$colorseries[$status] = $badgeStatus1;
|
||||
}
|
||||
if ($status == FactureFournisseur::STATUS_CLOSED) {
|
||||
$colorseries[$status] = $badgeStatus9;
|
||||
}
|
||||
if ($status == FactureFournisseur::STATUS_ABANDONED) {
|
||||
$colorseries[$status] = $badgeStatus6;
|
||||
}
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td>'.$objectstatic->getLibStatut(0).'</td>';
|
||||
$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
|
||||
$result .= '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->SetDataColor(array_values($colorseries));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(['pie']);
|
||||
$dolgraph->setHeight('150');
|
||||
$dolgraph->setWidth('300');
|
||||
$dolgraph->draw('idgraphpurchaseinvoices');
|
||||
|
||||
$result .= '<tr>';
|
||||
$result .= '<td align="center" colspan="2">'.$dolgraph->show($total ? 0 : 1).'</td>';
|
||||
$result .= '</tr>';
|
||||
}
|
||||
|
||||
$result .= '<tr class="liste_total">';
|
||||
$result .= '<td>'.$langs->trans("Total").'</td>';
|
||||
$result .= '<td class="right">'.$total.'</td>';
|
||||
$result .= '</tr>';
|
||||
|
||||
$result .= '</table>';
|
||||
$result .= '</div>';
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an HTML table that contains a pie chart of the number of customers or supplier invoices
|
||||
*
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user