Merge branch '14.0' of github.com:Dolibarr/dolibarr into FIX_commandeFourn_Stats
This commit is contained in:
commit
958be422e2
190
ChangeLog
190
ChangeLog
@ -2,6 +2,165 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 14.0.4 compared to 14.0.3 *****
|
||||
|
||||
FIX: $totalarray is overwritten, totals were lost
|
||||
FIX: 13.0 - due to a typo in the 'mode' parameter, the "first name" column of the list of members displays the full name
|
||||
FIX: 13.0: end date required to edit a ticket message
|
||||
FIX: 13.0 feedback of PR #18993: make ticket messages punctual events with attr percentage = -1
|
||||
FIX: 13.0 PR #18993: add comment on modified part
|
||||
FIX: 13.0: sometimes firstname was mistyped as fistname
|
||||
FIX: 14.0 - civility field of private third party creation form has inadequate width
|
||||
FIX: 14.0 - civility field width inadequate due to select2 calculating the width while the field has no width (display: none)
|
||||
FIX: 14.0 - due to a typo in the 'mode' parameter, the "first name" co…
|
||||
FIX: #18634 : Problem of virtual stock with reception module enabled
|
||||
FIX: #18695 Added ref_ext to supplier invoice
|
||||
FIX: #18698 Supplier invoice list - "alert" checkbox not working
|
||||
FIX: #18735
|
||||
FIX: #18767 : Adherent delete
|
||||
FIX: #18797
|
||||
FIX: #18854
|
||||
FIX: #18875 in v14
|
||||
FIX: #18910
|
||||
FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
|
||||
FIX: #18912 Accountancy - SQL error when custom group is added without country defined
|
||||
FIX: #18934 on-registration in the extrafieldsline database for deliveries
|
||||
FIX: #18968
|
||||
FIX: #19008
|
||||
FIX: #19014 - the properties of some fields are not updated when you submit the form
|
||||
FIX: #19210
|
||||
FIX: #19214 : PostgreSQL error on admin/limits.php
|
||||
FIX: #19241 Project - Fix display salary in overview
|
||||
FIX: #19305
|
||||
FIX: 2 columns for total labels
|
||||
FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
|
||||
FIX: Accountancy - If deposit invoice is used, force binding in deposit accounting account to solve transaction
|
||||
FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
|
||||
FIX: Accountancy - Option of export popup are inverted
|
||||
FIX: Accountancy - PHP8
|
||||
FIX: Accountancy - Product admin - SQL error when we affect accounting account with product_perentity activated
|
||||
FIX: Accountancy simplified - Salaries are not present in report
|
||||
FIX: Accountancy - Some correction on export name
|
||||
FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
|
||||
FIX: add warehouse in projects' overview count
|
||||
FIX: also on customer index for automatic binding
|
||||
FIX: Attachment of pdf into shipment when sending email
|
||||
FIX: autocalculation of the supplier price in main currency.
|
||||
FIX: avoid warning if $categories is an id
|
||||
FIX: bad sign of amount stored for multicurrency columns on credit notes
|
||||
FIX: Bad use of a forced contact of another company on PDF/ODT documents
|
||||
FIX: Bad use of dol_concatdesc()
|
||||
FIX: Button text on proposal card for create a invoice
|
||||
FIX: calculateCosts of BOM must not be included into fetch
|
||||
FIX: calculation of balance in conciliation page on desc sorting.
|
||||
FIX: card.php
|
||||
FIX: Change date format of the inventorycode to be equal as mass stock transfert
|
||||
FIX: check if greater 0
|
||||
FIX: close cash with some terminals in TakePOS
|
||||
FIX: compatibility with Multicompany
|
||||
FIX: consistent UX when calling a tab from the invoice card with empty ref/id
|
||||
FIX: default language defined for IN country
|
||||
FIX: Expense report - In edit mode, field qty doesn't accept decimal unlike the create mode
|
||||
FIX: fetch of product with modulebuilder load too much data
|
||||
FIX: filter for export of accounting documents
|
||||
FIX: Filter on categories
|
||||
FIX: generate documents with PDF options
|
||||
FIX: indentation
|
||||
FIX: init hookmanager after loading $conf values
|
||||
FIX: invoice: inpossible to create an invoice because of very bad check + warnings when trying to print tabs for invoice with no ID
|
||||
FIX: legal issue on expense report pdf (must also show price without tax)
|
||||
FIX: list of categories in stats of supplier invoices
|
||||
FIX: load tranlate array after setting lang
|
||||
FIX: lost superadmin grade after edit user card
|
||||
FIX: missing filter status=1 on rss feeds
|
||||
FIX: missing permission check reported by me@lainwir3d.net on product api
|
||||
FIX: missing return status
|
||||
FIX: missing sql filter by entity
|
||||
FIX: move fetch_optionnal into $ac_static->fetch()
|
||||
FIX: only a superadmin can modify entity
|
||||
FIX: only ones value is return for dictionaries
|
||||
FIX: optional visibility on create card
|
||||
FIX: payment style and html5 tags
|
||||
FIX: payment using wrong type in takepos when too many payment mode
|
||||
FIX: PR#18931 Remove useless explicit call to dol_shutdown
|
||||
FIX: Product accountancy affectation with product_perentity activated (PR #18620)
|
||||
FIX: products/services card: hidden extrafields were overridden
|
||||
FIX: project task list: extrafields could not be displayed
|
||||
FIX: Propal list - Problem of pagination on date
|
||||
FIX: reload user lang
|
||||
FIX: Remove not complete order from the virtual stock
|
||||
FIX: Replenish: SQL error when no warehouse has been created + Warning when there are no warehouses
|
||||
FIX: resource list : Use standard code to handle list filters
|
||||
FIX: restrictedArea for payment delete
|
||||
FIX: Ret PR
|
||||
FIX: second approval back in stable feature as is the setting for minimum amount (last part from PR#14286)
|
||||
FIX: selected lines on supplier invoice create
|
||||
FIX: Selection of type "people" for membership must hide the company
|
||||
FIX: select list of orders not complete when field type of company is on
|
||||
FIX: show end hours in events linked to objects
|
||||
FIX: support of localtax on expense report
|
||||
FIX: task time: can't filter by user with pgsql + show error message
|
||||
FIX: task time: keep on using natural_search
|
||||
FIX: tcpdf vulnerability to roman numeral bomb, cf. tecnickom/TCPDF issue #315
|
||||
FIX: Test when date of invoie is in future (pb with TZ and offset)
|
||||
FIX: Ticket - Card - Wrong font awesome library
|
||||
FIX: Ticket - Duplicate field project when we create ticket from project
|
||||
FIX: translation into email for member at membership validation.
|
||||
FIX: Travis Sanitize SQL
|
||||
FIX: unprivileged user can see task associated with a not allowed project
|
||||
FIX: URGENT: impossible to create an invoice
|
||||
FIX: Use of accent into filename of GED
|
||||
FIX: user date timezone offset
|
||||
FIX: User salary card - translation problem
|
||||
FIX: user without permission can set ticket subject
|
||||
FIX: We need a default price base type in variant creation case with multiprices when parent has been created with only one level price
|
||||
FIX: wrong array key value
|
||||
FIX: wrong check
|
||||
FIX: wrong position of error message
|
||||
Sync transifex.
|
||||
|
||||
***** ChangeLog for 14.0.3 compared to 14.0.2 *****
|
||||
|
||||
FIX: #18698 Supplier invoice list - "alert" checkbox not working
|
||||
FIX: #18735
|
||||
FIX: #18767 : Member delete
|
||||
FIX: #18854
|
||||
FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
|
||||
FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
|
||||
FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
|
||||
FIX: Accountancy - Option of export popup are inverted
|
||||
FIX: Accountancy - Some correction on export name
|
||||
FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
|
||||
FIX: add warehouse in projects' overview count
|
||||
FIX: autocalculation of the supplier price in main currency.
|
||||
FIX: avoid warning if $categories is an id
|
||||
FIX: Bad use of a forced contact of another company on PDF/ODT documents
|
||||
FIX: Button text on proposal card to create a invoice
|
||||
FIX: calculateCosts of BOM must not be included into fetch
|
||||
FIX: check if greater 0
|
||||
FIX: default language defined for IN country
|
||||
FIX: fetch of product with modulebuilder load too much data
|
||||
FIX: Filter on categories
|
||||
FIX: indentation
|
||||
FIX: init hookmanager after loading $conf values
|
||||
FIX: legal issue on expense report pdf (must also show price without tax)
|
||||
FIX: missing filter status=1 on rss feeds
|
||||
FIX: move fetch_optionnal into $ac_static->fetch()
|
||||
FIX: payment using wrong type in takepos when too many payment mode
|
||||
FIX: Product accountancy affectation with product_perentity activated (PR #18620)
|
||||
FIX: products/services card: hidden extrafields were overridden
|
||||
FIX: Propal list - Problem of pagination on date
|
||||
FIX: selected lines on supplier invoice create
|
||||
FIX: Selection of type "people" for membership must hide the company
|
||||
FIX: select list of orders not complete when field type of company is on
|
||||
FIX: support of localtax on expense report
|
||||
FIX: task time: can't filter by user with pgsql + show error message
|
||||
FIX: task time: keep on using natural_search
|
||||
FIX: Test when date of invoie is in future (pb with TZ and offset)
|
||||
FIX: translation into email for member at membership validation.
|
||||
FIX: unprivileged user can see task associated with a not allowed project
|
||||
FIX: user without permission can set ticket subject
|
||||
|
||||
***** ChangeLog for 14.0.2 compared to 14.0.1 *****
|
||||
|
||||
FIX: #18353 Invoice list translation issue
|
||||
@ -316,6 +475,37 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
|
||||
|
||||
FIX: 13.0: class CommandeFournisseurDispatch provides trigger for UPDATE but not for CREATE / DELETE
|
||||
FIX: #18389 Accountancy - Bug on LDcompta10 export for supplier invoice
|
||||
FIX: #18591 : Remove double quotes of SQL Queries for postgresql compatibility
|
||||
FIX: Accountancy - Debug Export Sage50 / CIEL Compta / CIEL Compta Evo (Format XIMPORT)
|
||||
FIX: Accountancy - Some problems of length with general & subledger account
|
||||
FIX: add DISTINCT
|
||||
FIX: an approved holiday can be canceled by an admin.
|
||||
FIX: autocalculation of the supplier price in main currency.
|
||||
FIX: better sql request
|
||||
FIX: cannot add time spend when column ref is not displayed
|
||||
FIX: compatibility postgre sql
|
||||
FIX: holiday card: hooks uninitialized
|
||||
FIX: Invoice - Missing button to reopen an abandoned situation invoice
|
||||
FIX: invoice validation: when checking if any VAT rate has a negative amount, prevent false positives with -1.0E-14 amounts
|
||||
FIX: list of categories in stats of supplier invoices
|
||||
FIX: Manage credit note on situation invoice for calculate margin
|
||||
FIX: method_exists needs object at first param
|
||||
FIX: move fetch_optionnal into $ac_static->fetch()
|
||||
FIX: multicompany transverse mode compatibility
|
||||
FIX: on supplier order, JOIN with product fourn price table must be done with fk_soc too to avoid display several times a same line (because of same supplier product ref)
|
||||
FIX: postgre filter select search extrafield
|
||||
FIX: products/services card: hidden extrafields were overridden
|
||||
FIX: shipping validation workflow: 'ORDER_NEW' trigger called from wrong object
|
||||
FIX: task time: can't filter by user with pgsql + show error message
|
||||
FIX: task time: keep on using natural_search
|
||||
FIX: wrong users count in multicompany transverse mode
|
||||
|
||||
|
||||
***** ChangeLog for 13.0.4 compared to 13.0.3 *****
|
||||
|
||||
FIX: Allow disabling of a module (not a dangerous action) even if there is problem with token (due to bugged modules).
|
||||
|
||||
11
README.md
11
README.md
@ -154,18 +154,18 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
|
||||
### Other application/modules
|
||||
|
||||
- Electronic Document Management (EDM)
|
||||
- Electronic Document Management (EDM)
|
||||
- Bookmarks management
|
||||
- Reporting
|
||||
- Data export/import
|
||||
- Barcodes
|
||||
- Barcodes
|
||||
- Margin calculations
|
||||
- LDAP connectivity
|
||||
- ClickToDial integration
|
||||
- Mass emailing
|
||||
- RSS integration
|
||||
- Skype integration
|
||||
- Social platforms linking
|
||||
- Social platforms linking
|
||||
- Payment platforms integration (PayPal, Stripe, Paybox...)
|
||||
- Email-Collector
|
||||
|
||||
@ -179,14 +179,11 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Multi-Users and groups with finely grained rights
|
||||
- Multi-Currency
|
||||
- Multi-Company (by adding of an external module)
|
||||
|
||||
- Very user friendly and easy to use
|
||||
- customizable Dashboard
|
||||
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
|
||||
|
||||
- APIs (REST, SOAP)
|
||||
- Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture)
|
||||
|
||||
- Support a lot of country specific features:
|
||||
- Spanish Tax RE and ISPF
|
||||
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
|
||||
@ -197,7 +194,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Compatible with European GDPR rules
|
||||
- ...
|
||||
- Flexible PDF & ODT generation for invoices, proposals, orders...
|
||||
- …
|
||||
- ...
|
||||
|
||||
|
||||
### System Environment / Requirements
|
||||
|
||||
@ -168,6 +168,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
||||
- protected $default_monospaced_font = 'courier';
|
||||
+ protected $default_monospaced_font = 'freemono';
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
|
||||
of the function, replace:
|
||||
|
||||
$roman = '';
|
||||
|
||||
with:
|
||||
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.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
|
||||
@ -91,19 +91,19 @@ $tabsql[32] = "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account
|
||||
$tabsqlsort = array();
|
||||
$tabsqlsort[32] = "position ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
// Name of the fields in the result of select to display the dictionary
|
||||
$tabfield = array();
|
||||
$tabfield[32] = "code,label,range_account,category_type,formula,position,country";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
// Name of editing fields for record modification
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[32] = "code,label,range_account,category_type,formula,position,country_id";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
// Name of the fields in the table for inserting a record
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[32] = "code,label,range_account,category_type,formula,position,fk_country";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Name of the rowid if the field is not of type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
||||
$tabrowid = array();
|
||||
@ -151,7 +151,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
if ($value == 'range_account' && empty($_POST['range_account'])) {
|
||||
continue;
|
||||
}
|
||||
if ($value == 'country' || $value == 'country_id') {
|
||||
if (($value == 'country' || $value == 'country_id') && (!empty($_POST['country_id']))) {
|
||||
continue;
|
||||
}
|
||||
if (!GETPOSTISSET($value) || GETPOST($value) == '') {
|
||||
@ -176,6 +176,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
if ($fieldnamekey == 'category_type') {
|
||||
$fieldnamekey = 'Calculated';
|
||||
}
|
||||
if ($fieldnamekey == 'country') {
|
||||
$fieldnamekey = 'Country';
|
||||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@ -263,7 +266,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
}
|
||||
}
|
||||
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
// If check ok and action modify, we modify the line
|
||||
if ($ok && GETPOST('actionmodify', 'alpha')) {
|
||||
if ($tabrowid[$id]) {
|
||||
$rowidcol = $tabrowid[$id];
|
||||
@ -430,12 +433,12 @@ print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'</span><br><br>';
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
// Confirmation of the deletion of the line
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id > 0 ? '&search_country_id='.$search_country_id : ''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
// Complete search query with sorting criteria
|
||||
$sql = $tabsql[$id];
|
||||
|
||||
if ($search_country_id > 0) {
|
||||
@ -634,14 +637,14 @@ if ($resql) {
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield = 1; // By defaut
|
||||
// Determines the name of the field in relation to the possible names
|
||||
// in data dictionaries
|
||||
$showfield = 1; // By default
|
||||
$class = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By default
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'source') {
|
||||
$valuetoshow = $langs->trans("Contact");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -260,6 +260,22 @@ $linkback = '';
|
||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($title, $linkback, 'accountancy');
|
||||
|
||||
// Show message if accountancy hidden options are activated to help to resolve some problems
|
||||
if (!$user->admin) {
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
@ -186,18 +186,35 @@ if ($action == 'update') {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$db->begin();
|
||||
|
||||
$sql = '';
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_perentity (fk_product, entity, '".$db->escape($accountancy_field_name)."')";
|
||||
$sql .= " VALUES (".((int) $productid).", ".((int) $conf->entity).", '".$db->escape($accounting->account_number)."')";
|
||||
$sql .= " ON DUPLICATE KEY UPDATE ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'";
|
||||
$sql_exists = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_perentity";
|
||||
$sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity);
|
||||
$resql_exists = $db->query($sql_exists);
|
||||
if (!$resql_exists) {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$nb_exists = $db->num_rows($resql_exists);
|
||||
if ($nb_exists <= 0) {
|
||||
// insert
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")";
|
||||
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
|
||||
} else {
|
||||
$obj_exists = $db->fetch_object($resql_exists);
|
||||
// update
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "product_perentity";
|
||||
$sql .= " SET " . $accountancy_field_name . " = '" . $db->escape($accounting->account_number) . "'";
|
||||
$sql .= " WHERE rowid = " . ((int) $obj_exists->rowid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."product";
|
||||
$sql .= " SET ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'";
|
||||
$sql .= " WHERE rowid = ".((int) $productid);
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$ok++;
|
||||
|
||||
@ -429,7 +429,7 @@ if ($action != 'export_csv') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$accounting_account.'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">'.price($opening_balance).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price(price2num($opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
|
||||
$urlzoom = '';
|
||||
@ -443,9 +443,9 @@ if ($action != 'export_csv') {
|
||||
}
|
||||
}
|
||||
// Debit
|
||||
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price($line->debit).'</a></td>';
|
||||
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price(price2num($line->debit, 'MT')).'</a></td>';
|
||||
// Credit
|
||||
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price($line->credit).'</a></td>';
|
||||
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price(price2num($line->credit, 'MT')).'</a></td>';
|
||||
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
|
||||
@ -466,10 +466,10 @@ if ($action != 'export_csv') {
|
||||
if (!empty($show_subgroup)) {
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">'.price($sous_total_opening_balance).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price(price2num($sous_total_opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price($sous_total_credit).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price(price2num($sous_total_debit, 'MT')).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price(price2num($sous_total_credit, 'MT')).'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||
} else {
|
||||
@ -481,10 +481,10 @@ if ($action != 'export_csv') {
|
||||
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="nowrap right">'.price($total_opening_balance).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($total_opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($total_debit).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price($total_credit).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price(price2num($total_debit, 'MT')).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price(price2num($total_credit, 'MT')).'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>';
|
||||
} else {
|
||||
|
||||
@ -591,7 +591,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
|
||||
|
||||
if (!empty($accountancyexport->errors)) {
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
} elseif (!$notifiedexportdate || !$notifiedvalidationdate) {
|
||||
} elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
|
||||
// Specify as export : update field date_export or date_validated
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
@ -602,17 +602,17 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET";
|
||||
if (!$notifiedexportdate && !$notifiedvalidationdate) {
|
||||
if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
$sql .= ", date_validated = '".$db->idate($now)."'";
|
||||
} elseif (!$notifiedexportdate) {
|
||||
} elseif (!empty($notifiedexportdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
} elseif (!$notifiedvalidationdate) {
|
||||
} elseif (!empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_validated = '".$db->idate($now)."'";
|
||||
}
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
|
||||
@ -119,8 +119,8 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
|
||||
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
|
||||
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
|
||||
self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinum_v3'),
|
||||
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
|
||||
self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinumv3'),
|
||||
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinumv5'),
|
||||
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
||||
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
|
||||
);
|
||||
@ -516,14 +516,19 @@ class AccountancyExport
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : Quadratus
|
||||
* Export format : Quadratus (Format ASCII)
|
||||
* Format since 2015 compatible QuadraCOMPTA
|
||||
* Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr)
|
||||
*
|
||||
* Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
|
||||
* In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
|
||||
*
|
||||
* @param array $TData data
|
||||
* @return void
|
||||
*/
|
||||
public function exportQuadratus(&$TData)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $db;
|
||||
|
||||
$end_line = "\r\n";
|
||||
|
||||
@ -536,6 +541,44 @@ class AccountancyExport
|
||||
$code_compta = $data->subledger_account;
|
||||
}
|
||||
|
||||
$Tab = array();
|
||||
|
||||
if (!empty($data->subledger_account)) {
|
||||
$Tab['type_ligne'] = 'C';
|
||||
$Tab['num_compte'] = str_pad(self::trunc($data->subledger_account, 8), 8);
|
||||
$Tab['lib_compte'] = str_pad(self::trunc($data->subledger_label, 30), 30);
|
||||
|
||||
if ($data->doc_type == 'customer_invoice') {
|
||||
$Tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc($data->subledger_label, 6), 6));
|
||||
$Tab['filler'] = str_repeat(' ', 52);
|
||||
$Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8);
|
||||
} elseif ($data->doc_type == 'supplier_invoice') {
|
||||
$Tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc($data->subledger_label, 6), 6));
|
||||
$Tab['filler'] = str_repeat(' ', 52);
|
||||
$Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8);
|
||||
} else {
|
||||
$Tab['filler'] = str_repeat(' ', 59);
|
||||
$Tab['coll_compte'] = str_pad(' ', 8);
|
||||
}
|
||||
|
||||
$Tab['filler2'] = str_repeat(' ', 110);
|
||||
$Tab['Maj'] = 2; // Partial update (alpha key, label, address, collectif, RIB)
|
||||
|
||||
if ($data->doc_type == 'customer_invoice') {
|
||||
$Tab['type_compte'] = 'C';
|
||||
} elseif ($data->doc_type == 'supplier_invoice') {
|
||||
$Tab['coll_compte'] = 'F';
|
||||
} else {
|
||||
$Tab['coll_compte'] = 'G';
|
||||
}
|
||||
|
||||
$Tab['filler3'] = str_repeat(' ', 235);
|
||||
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode($Tab);
|
||||
}
|
||||
|
||||
$Tab = array();
|
||||
$Tab['type_ligne'] = 'M';
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
||||
|
||||
@ -937,7 +937,6 @@ class BookKeeping extends CommonObject
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validated);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validation);
|
||||
|
||||
$this->lines[] = $line;
|
||||
@ -1090,7 +1089,6 @@ class BookKeeping extends CommonObject
|
||||
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validated);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validation);
|
||||
|
||||
$this->lines[] = $line;
|
||||
@ -1751,7 +1749,6 @@ class BookKeeping extends CommonObject
|
||||
$line->date_creation = $obj->date_creation;
|
||||
$line->date_modification = $obj->date_modification;
|
||||
$line->date_export = $obj->date_export;
|
||||
$line->date_validation = $obj->date_validated;
|
||||
$line->date_validation = $obj->date_validation;
|
||||
|
||||
$this->linesmvt[] = $line;
|
||||
@ -1816,7 +1813,6 @@ class BookKeeping extends CommonObject
|
||||
$line->sens = $obj->sens;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_validation = $obj->date_validated;
|
||||
$line->date_validation = $obj->date_validation;
|
||||
|
||||
$this->linesexport[] = $line;
|
||||
|
||||
@ -170,6 +170,8 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$num_lines = $db->num_rows($result);
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
|
||||
$isSellerInEEC = isInEEC($mysoc);
|
||||
|
||||
$i = 0;
|
||||
@ -213,6 +215,18 @@ if ($action == 'validatehistory') {
|
||||
}
|
||||
}
|
||||
|
||||
// Manage Deposit
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
|
||||
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new AccountingAccount($db);
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
$objp->code_sell_l = $accountdeposittoventilated->ref;
|
||||
$objp->code_sell_p = '';
|
||||
$objp->code_sell_t = '';
|
||||
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
|
||||
}
|
||||
}
|
||||
|
||||
if ($objp->aarowid_suggest > 0) {
|
||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
|
||||
|
||||
@ -369,9 +369,9 @@ if ($result) {
|
||||
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneCustomer").'</span><br>';
|
||||
|
||||
print '<br><div class="inline-block divButAction">'.$langs->trans("ChangeAccount").'<br>';
|
||||
print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' ';
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
@ -637,11 +637,15 @@ if ($result) {
|
||||
}
|
||||
|
||||
// Manage Deposit
|
||||
if ($objp->description == "(DEPOSIT)") {
|
||||
$accountdeposittoventilated = new AccountingAccount($db);
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
$objp->code_sell_l = $accountdeposittoventilated->ref;
|
||||
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
|
||||
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new AccountingAccount($db);
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
$objp->code_sell_l = $accountdeposittoventilated->ref;
|
||||
$objp->code_sell_p = '';
|
||||
$objp->code_sell_t = '';
|
||||
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($objp->code_sell_p)) {
|
||||
|
||||
@ -369,9 +369,9 @@ if ($result) {
|
||||
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneSupplier").'</span><br>';
|
||||
|
||||
print '<br><div class="inline-block divButAction">'.$langs->trans("ChangeAccount").'<br>';
|
||||
print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' ';
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
@ -38,10 +38,12 @@ header('Content-Type: text/csv');
|
||||
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") { // Specific filename for FEC model export into the general ledger
|
||||
// Specific filename for FEC model export into the general ledger
|
||||
if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountancyexport->getFormatCode($formatexportset) == 'fec2')
|
||||
&& $type_export == "general_ledger") {
|
||||
// FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle
|
||||
if (empty($search_date_end)) {
|
||||
// TODO Get the max date into bookeeping table
|
||||
// TODO Get the max date into bookkeeping table
|
||||
$search_date_end = dol_now();
|
||||
}
|
||||
$datetouseforfilename = $search_date_end;
|
||||
@ -58,7 +60,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
|
||||
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
|
||||
|
||||
$completefilename = $siren."FEC".$endaccountingperiod.".txt";
|
||||
} elseif ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_CIEL && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
|
||||
} elseif ($accountancyexport->getFormatCode($formatexportset) == 'ciel' && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
|
||||
$completefilename = "XIMPORT.TXT";
|
||||
} else {
|
||||
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
|
||||
|
||||
@ -228,7 +228,7 @@ print "</td></tr>\n";
|
||||
// Allow members to change type on renewal forms
|
||||
/* To test during next beta
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MemberAllowchangeOfType").'</td><td>';
|
||||
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
|
||||
print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
|
||||
print "</td></tr>\n";
|
||||
*/
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') {
|
||||
|
||||
if ($action == 'update') {
|
||||
$public = GETPOST('MEMBER_ENABLE_PUBLIC');
|
||||
$amount = GETPOST('MEMBER_NEWFORM_AMOUNT');
|
||||
$amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2);
|
||||
$editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
|
||||
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
|
||||
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int');
|
||||
@ -205,7 +205,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td class="right">';
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
|
||||
print '<input type="text" class="right width75" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
|
||||
@ -645,7 +645,7 @@ if (empty($reshook)) {
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
|
||||
@ -716,7 +716,7 @@ if (empty($reshook)) {
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
|
||||
@ -787,7 +787,7 @@ if (empty($reshook)) {
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
|
||||
@ -913,7 +913,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$object->country_id = GETPOST('country_id', 'int') ?GETPOST('country_id', 'int') : $mysoc->country_id;
|
||||
$object->country_id = GETPOST('country_id', 'int') ? GETPOST('country_id', 'int') : $mysoc->country_id;
|
||||
if ($object->country_id) {
|
||||
$tmparray = getCountry($object->country_id, 'all');
|
||||
$object->country_code = $tmparray['code'];
|
||||
@ -921,12 +921,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
if (!empty($socid)) {
|
||||
$object = new Societe($db);
|
||||
$soc = new Societe($db);
|
||||
if ($socid > 0) {
|
||||
$object->fetch($socid);
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
if (!($object->id > 0)) {
|
||||
if (!($soc->id > 0)) {
|
||||
$langs->load("errors");
|
||||
print($langs->trans('ErrorRecordNotFound'));
|
||||
exit;
|
||||
@ -1009,7 +1009,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $object->company).'"></td></tr>';
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $soc->name).'"></td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||
@ -1033,7 +1033,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
|
||||
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
|
||||
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $soc->email).'"></td></tr>';
|
||||
|
||||
// Website
|
||||
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', '', $object, 0).'</td>';
|
||||
@ -1041,21 +1041,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $soc->address).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $soc->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
print ' ';
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $soc->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
|
||||
if (empty($soc->country_id)) {
|
||||
$soc->country_id = $mysoc->country_id;
|
||||
$soc->country_code = $mysoc->country_code;
|
||||
$soc->state_id = $mysoc->state_id;
|
||||
}
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
||||
print img_picto('', 'country', 'class="pictofixedwidth"');
|
||||
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
|
||||
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $soc->country_id, 'country_id');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
@ -1064,9 +1068,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// State
|
||||
if (empty($conf->global->MEMBER_DISABLE_STATE)) {
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($object->country_id) {
|
||||
if ($soc->country_id) {
|
||||
print img_picto('', 'state', 'class="pictofixedwidth"');
|
||||
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
|
||||
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $soc->state_id, $soc->country_code);
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
@ -1075,7 +1079,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Pro phone
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
|
||||
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>';
|
||||
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $soc->phone).'"></td></tr>';
|
||||
|
||||
// Personal phone
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
|
||||
@ -1506,7 +1510,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
|
||||
@ -1836,7 +1840,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Login Dolibarr
|
||||
// Login Dolibarr - Link to user
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
|
||||
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
|
||||
|
||||
@ -1900,8 +1900,8 @@ class Adherent extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = ".self::STATUS_VALIDATED;
|
||||
$sql .= ", datevalid = '".$this->db->idate($now)."'";
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$sql .= ", fk_user_valid=".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::validate", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -961,7 +961,7 @@ while ($i < min($num, $limit)) {
|
||||
// Firstname
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">';
|
||||
print $memberstatic->getNomUrl(0, 0, 'card', 'fistname');
|
||||
print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
|
||||
//print $obj->firstname;
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
|
||||
@ -195,9 +195,7 @@ foreach ($data as $val) {
|
||||
}
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td class="center">';
|
||||
//print '<a href="month.php?year='.$year.'">';
|
||||
print $year;
|
||||
//print '</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?date_select='.((int) $year).'">'.$year.'</a>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.$val['nb'].'</td>';
|
||||
print '<td class="right amount nowraponall"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
|
||||
|
||||
@ -623,7 +623,7 @@ if ($rowid > 0) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Login Dolibarr
|
||||
// Login Dolibarr - Link to user
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrUser");
|
||||
@ -641,7 +641,9 @@ if ($rowid > 0) {
|
||||
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
|
||||
} else {
|
||||
if ($object->user_id) {
|
||||
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
|
||||
$linkeduser = new User($db);
|
||||
$linkeduser->fetch($object->user_id);
|
||||
print $linkeduser->getNomUrl(-1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
|
||||
}
|
||||
@ -941,8 +943,10 @@ if ($rowid > 0) {
|
||||
}
|
||||
if (!$datefrom) {
|
||||
$datefrom = $object->datevalid;
|
||||
if ($object->datefin > 0) {
|
||||
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
|
||||
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
|
||||
} else {
|
||||
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));
|
||||
}
|
||||
}
|
||||
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
|
||||
@ -961,7 +965,7 @@ if ($rowid > 0) {
|
||||
|
||||
if ($adht->subscription) {
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'. price(GETPOSTISSET('subscription') ? GETPOST('subscription') : $adht->amount).'"> '.$langs->trans("Currency".$conf->currency) .'</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td>';
|
||||
|
||||
@ -311,6 +311,7 @@ print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="date_select" value="'.$date_select.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
|
||||
@ -318,6 +318,19 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
/*$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}*/
|
||||
$colspan = 8;
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
|
||||
// Name
|
||||
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
|
||||
@ -104,13 +104,11 @@ print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
// Social networks
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Url").'</td><td>'.$langs->trans("SocialNetworkId").'</td><td></td>';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Url").'</td><td>'.$langs->trans("SocialNetworkId").'</td><td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
|
||||
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
|
||||
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
@ -233,7 +233,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR
|
||||
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]);
|
||||
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
|
||||
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
|
||||
@ -1175,6 +1175,8 @@ if ($id) {
|
||||
$sql .= natural_search("r.code_region", $search_code);
|
||||
} elseif ($search_code != '' && $id == 7) {
|
||||
$sql .= natural_search("a.code", $search_code);
|
||||
} elseif ($search_code != '' && $id == 10) {
|
||||
$sql .= natural_search("t.code", $search_code);
|
||||
} elseif ($search_code != '' && $id != 9) {
|
||||
$sql .= natural_search("code", $search_code);
|
||||
}
|
||||
@ -1452,6 +1454,10 @@ if ($id) {
|
||||
print $tdsoffields;
|
||||
|
||||
|
||||
// Line to enter new values
|
||||
print '<!-- line to add new entry -->';
|
||||
print '<tr class="oddeven nodrag nodrop nohover">';
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd')) {
|
||||
@ -1471,9 +1477,6 @@ if ($id) {
|
||||
unset($fieldlist[2]); // Remove field ??? if dictionary Regions
|
||||
}
|
||||
|
||||
// Line to enter new values
|
||||
print '<!-- line to add new entry -->';
|
||||
print '<tr class="oddeven nodrag nodrop nohover">';
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldList($fieldlist, $obj, $tabname[$id], 'add');
|
||||
|
||||
@ -232,7 +232,7 @@ class PrestaShopWebservice
|
||||
if ($response != '') {
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
if (libxml_get_errors()) {
|
||||
$msg = var_export(libxml_get_errors(), true);
|
||||
libxml_clear_errors();
|
||||
|
||||
@ -366,7 +366,7 @@ if ($action == 'edit') {
|
||||
$product = new Product($db);
|
||||
$resprod = $product->fetch($conf->global->{$constname});
|
||||
if ($resprod > 0) {
|
||||
print $product->ref;
|
||||
print $product->getNomUrl(1);
|
||||
} elseif ($resprod < 0) {
|
||||
setEventMessages(null, $object->errors, "errors");
|
||||
}
|
||||
|
||||
@ -109,8 +109,8 @@ $reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $act
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
// Show into other
|
||||
print '<span class="opacitymedium">'.$langs->trans("SetupDescription5")."</span><br>";
|
||||
print "<br>";
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
|
||||
print '<br class="hideonsmartphone">';
|
||||
|
||||
// Show logo
|
||||
print '<div class="center"><div class="logo_setup"></div></div>';
|
||||
|
||||
@ -237,7 +237,7 @@ if (empty($mysoc->country_code)) {
|
||||
|
||||
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
|
||||
$sql .= " ORDER BY t.taux ASC";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -833,23 +833,23 @@ if ($action == 'edit') {
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) {
|
||||
// List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
||||
} else {
|
||||
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
||||
// List of IP show as record to add in SPF if we use the mail method
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
||||
// List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
|
||||
// TODO Add a key to allow to show the IP/name of server detected dynamically
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
|
||||
// List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -160,6 +160,7 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
||||
|
||||
$tabhelp = array();
|
||||
$tabhelp[25] = array(
|
||||
'label'=>$langs->trans('EnterAnyCode'),
|
||||
'topic'=>'<span class="small">'.$helpsubstit.'</span>',
|
||||
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
|
||||
'content'=>'<span class="small">'.$helpsubstit.'</span>',
|
||||
@ -683,8 +684,8 @@ if ($action == 'view') {
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters = array(
|
||||
'fieldlist' => $fieldlist,
|
||||
'tabname' => $tabname[$id]
|
||||
'fieldlist' => $fieldlist,
|
||||
'tabname' => $tabname[$id]
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error;
|
||||
@ -822,7 +823,7 @@ if ($resql) {
|
||||
print '</td>';
|
||||
} elseif ($value == 'fk_user') {
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth150');
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150');
|
||||
print '</td>';
|
||||
} elseif ($value == 'topic') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
@ -1071,8 +1072,8 @@ if ($resql) {
|
||||
if ($showfield) {
|
||||
print '<!-- '.$fieldlist[$field].' -->';
|
||||
print '<td class="'.$class.'"';
|
||||
if ($value == 'topic') {
|
||||
print ' title="'.$valuetoshow.'"';
|
||||
if (in_array($value, array('code', 'label', 'topic'))) {
|
||||
print ' title="'.dol_escape_htmltag($valuetoshow).'"';
|
||||
}
|
||||
print '>';
|
||||
print $valuetoshow;
|
||||
@ -1187,7 +1188,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if ($value == 'fk_user') {
|
||||
print '<td>';
|
||||
if ($user->admin) {
|
||||
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth300');
|
||||
} else {
|
||||
if ($context == 'add') { // I am not admin and we show the add form
|
||||
print $user->getNomUrl(1); // Me
|
||||
|
||||
@ -133,7 +133,7 @@ if ($action == 'install') {
|
||||
|
||||
// $original_file should match format module_modulename-x.y[.z].zip
|
||||
$original_file = basename($_FILES["fileinstall"]["name"]);
|
||||
$original_file = preg_replace('/\(\d+\)\.zip$/i', '.zip', $original_file);
|
||||
$original_file = preg_replace('/\s*\(\d+\)\.zip$/i', '.zip', $original_file);
|
||||
$newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
|
||||
|
||||
if (!$original_file) {
|
||||
|
||||
@ -92,7 +92,7 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') {
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc"));
|
||||
|
||||
@ -100,7 +100,7 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
@ -108,7 +108,7 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
|
||||
print '<td>';
|
||||
print '<td class="right">';
|
||||
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
@ -117,7 +117,7 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
|
||||
print '<td>';
|
||||
print '<td class="right">';
|
||||
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
@ -126,7 +126,7 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
|
||||
print '<td>';
|
||||
print '<td class="right">';
|
||||
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
|
||||
@ -683,6 +683,8 @@ if ($conf->use_javascript_ajax) {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE);
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>';
|
||||
@ -693,6 +695,9 @@ if ($conf->use_javascript_ajax) {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL);
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>';
|
||||
print '<td class="right">';
|
||||
@ -702,10 +707,23 @@ if ($conf->use_javascript_ajax) {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER);
|
||||
}
|
||||
print "</td>";
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringProject").'</td>';
|
||||
print '<td class="right">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
*/
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
|
||||
|
||||
@ -51,7 +51,7 @@ if ($action == 'getlastversion') {
|
||||
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
||||
//var_dump($result['content']);
|
||||
if (function_exists('simplexml_load_string')) {
|
||||
$sfurl = simplexml_load_string($result['content']);
|
||||
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') {
|
||||
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
||||
$xmlfile = $xmlarray['content'];
|
||||
//print "xmlfilestart".$xmlfile."xmlfileend";
|
||||
$xml = simplexml_load_string($xmlfile);
|
||||
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
} else {
|
||||
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
|
||||
setEventMessages($errormsg, null, 'errors');
|
||||
|
||||
@ -63,7 +63,7 @@ print '<br>';
|
||||
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
|
||||
$test = !function_exists('xdebug_is_enabled');
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' <span class="opacitymedium">'.$langs->trans("NotSlowedDownByThis").'</span>';
|
||||
} else {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug"));
|
||||
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
|
||||
|
||||
@ -207,6 +207,9 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
|
||||
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '</fieldset>';
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ if (!empty($conf->syslog->enabled)) {
|
||||
|
||||
print '<input type="radio" name="choice" id="choicetempfiles" value="tempfiles"';
|
||||
print (!$choice || $choice == 'tempfiles' || $choice == 'allfiles') ? ' checked' : '';
|
||||
print '> <label for="choicetempfiles">'.$langs->trans("PurgeDeleteTemporaryFiles").'</label><br><br>';
|
||||
print '> <label for="choicetempfiles">'.$langs->trans("PurgeDeleteTemporaryFilesShort").'</label><br><br>';
|
||||
|
||||
print '<input type="radio" name="choice" id="choiceallfiles" value="confirm_allfiles"';
|
||||
print ($choice && $choice == 'confirm_allfiles') ? ' checked' : '';
|
||||
|
||||
@ -61,7 +61,7 @@ $version = '0.0';
|
||||
if ($action == 'getlastversion') {
|
||||
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
||||
//var_dump($result['content']);
|
||||
$sfurl = simplexml_load_string($result['content']);
|
||||
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ if (!$user->admin) {
|
||||
$id = GETPOST('rowid', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$optioncss = GETPOST('optionscss', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ09');
|
||||
|
||||
$langcode = GETPOST('langcode', 'alphanohtml');
|
||||
$transkey = GETPOST('transkey', 'alphanohtml');
|
||||
@ -458,18 +459,8 @@ if ($mode == 'searchkey') {
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Line to search new record
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="liste_titre_filter"><td>';
|
||||
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1);
|
||||
print '</td>'."\n";
|
||||
@ -495,6 +486,15 @@ if ($mode == 'searchkey') {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') {
|
||||
ksort($recordtoshow);
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ class Documents extends DolibarrApi
|
||||
* Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
|
||||
*
|
||||
* @param string $filename Name of file to create ('FA1705-0123.txt')
|
||||
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
|
||||
* @param string $modulepart Name of module or area concerned by file upload ('product', 'service', 'invoice', 'proposal', 'project', 'project_task', 'supplier_invoice', 'expensereport', 'member', ...)
|
||||
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
||||
* @param string $subdir Subdirectory (Only if ref not provided)
|
||||
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
|
||||
|
||||
@ -1683,7 +1683,7 @@ class Setup extends DolibarrApi
|
||||
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
||||
$xmlfile = $xmlarray['content'];
|
||||
//print "xmlfilestart".$xmlfile."endxmlfile";
|
||||
$xml = simplexml_load_string($xmlfile);
|
||||
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
} else {
|
||||
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
|
||||
throw new RestException(500, $errormsg);
|
||||
|
||||
@ -389,7 +389,7 @@ if ($action == 'create') {
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
print $object->showOptionals($extrafields, 'create', $parameters);
|
||||
}
|
||||
print '<tbody>';
|
||||
print "</table>\n";
|
||||
|
||||
@ -71,6 +71,10 @@ if (empty($action) && empty($id) && empty($ref)) {
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
if ($object->id > 0) {
|
||||
$object->calculateCosts();
|
||||
}
|
||||
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
@ -112,8 +116,13 @@ if (empty($reshook)) {
|
||||
|
||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
|
||||
// Actions cancel, add, update, delete or clone
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||
// The fetch/fetch_lines was redone into the inc.php so we must recall the calculateCosts()
|
||||
if ($action == 'confirm_validate' && $object->id > 0) {
|
||||
$object->calculateCosts();
|
||||
}
|
||||
|
||||
// Actions when linking object each other
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
|
||||
@ -311,8 +320,6 @@ if (($id || $ref) && $action == 'edit') {
|
||||
|
||||
// Part to show record
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
$head = bomPrepareHead($object);
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ class BOM extends CommonObject
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'),
|
||||
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
|
||||
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
|
||||
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
@ -381,7 +381,7 @@ class BOM extends CommonObject
|
||||
if ($result > 0 && !empty($this->table_element_line)) {
|
||||
$this->fetchLines();
|
||||
}
|
||||
$this->calculateCosts();
|
||||
//$this->calculateCosts(); // This consume a high number of subrequests. Do not call it into fetch but when you need it.
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -431,13 +431,13 @@ class BOM extends CommonObject
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key == 't.rowid') {
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
$sqlwhere[] = $key.' = '.((int) $value);
|
||||
} elseif (strpos($key, 'date') !== false) {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
|
||||
} elseif ($key == 'customsql') {
|
||||
$sqlwhere[] = $value;
|
||||
} else {
|
||||
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -946,7 +946,7 @@ class BOM extends CommonObject
|
||||
$this->lines = array();
|
||||
|
||||
$objectline = new BOMLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.((int) $this->id)));
|
||||
|
||||
if (is_numeric($result)) {
|
||||
$this->error = $this->error;
|
||||
@ -1035,7 +1035,8 @@ class BOM extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM costs calculation based on cost_price or pmp of each BOM line
|
||||
* BOM costs calculation based on cost_price or pmp of each BOM line.
|
||||
* Set the property ->total_cost and ->unit_cost of BOM.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -1045,30 +1046,36 @@ class BOM extends CommonObject
|
||||
$this->unit_cost = 0;
|
||||
$this->total_cost = 0;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
|
||||
foreach ($this->lines as &$line) {
|
||||
if (is_array($this->lines) && count($this->lines)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$tmpproduct = new Product($this->db);
|
||||
$result = $tmpproduct->fetch($line->fk_product);
|
||||
if ($result < 0) {
|
||||
$this->error = $tmpproduct->error;
|
||||
return -1;
|
||||
}
|
||||
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
||||
if (empty($line->unit_cost)) {
|
||||
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
|
||||
$line->unit_cost = $productFournisseur->fourn_unitprice;
|
||||
|
||||
foreach ($this->lines as &$line) {
|
||||
$tmpproduct->cost_price = 0;
|
||||
$tmpproduct->pmp = 0;
|
||||
|
||||
$result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
|
||||
if ($result < 0) {
|
||||
$this->error = $tmpproduct->error;
|
||||
return -1;
|
||||
}
|
||||
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
||||
if (empty($line->unit_cost)) {
|
||||
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
|
||||
$line->unit_cost = $productFournisseur->fourn_unitprice;
|
||||
}
|
||||
}
|
||||
|
||||
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
|
||||
|
||||
$this->total_cost += $line->total_cost;
|
||||
}
|
||||
|
||||
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
|
||||
$this->total_cost += $line->total_cost;
|
||||
}
|
||||
|
||||
$this->total_cost = price2num($this->total_cost, 'MT');
|
||||
if ($this->qty) {
|
||||
$this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
|
||||
$this->total_cost = price2num($this->total_cost, 'MT');
|
||||
if ($this->qty) {
|
||||
$this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,9 @@ function bomAdminPrepareHead()
|
||||
//$this->tabs = array(
|
||||
// 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__'
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'bom');
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'bom@mrp');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@mrp', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ if ($action == 'create') {
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
|
||||
$liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow"));
|
||||
print $form->selectarray('target', $liste, 1);
|
||||
print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1);
|
||||
print '</td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</span></td></tr>';
|
||||
|
||||
// Owner
|
||||
|
||||
@ -266,7 +266,7 @@ if ($user->rights->categorie->creer) {
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
print $object->showOptionals($extrafields, 'create', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1963,6 +1963,12 @@ class Categorie extends CommonObject
|
||||
if ($type == 'bank_account') {
|
||||
$type = 'account';
|
||||
}
|
||||
if ($type == 'customer') {
|
||||
$type = 'societe';
|
||||
}
|
||||
if ($type == 'supplier') {
|
||||
$type = 'fournisseur';
|
||||
}
|
||||
|
||||
if (empty($searchList) && !is_array($searchList)) {
|
||||
return "";
|
||||
|
||||
@ -75,8 +75,13 @@ if ($complete == 'na' || $complete == -2) {
|
||||
$complete = -1;
|
||||
}
|
||||
|
||||
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
|
||||
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
|
||||
if ($fulldayevent) {
|
||||
$datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
|
||||
$datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
|
||||
} else {
|
||||
$datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
|
||||
$datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
@ -1218,7 +1223,11 @@ if ($action == 'create') {
|
||||
if (!empty($projectid)) {
|
||||
$projectsListId = $projectid;
|
||||
}
|
||||
$tid = GETPOST("projecttaskid") ? GETPOST("projecttaskid") : '';
|
||||
if ($origin=='task') {
|
||||
$tid= GETPOST("originid");
|
||||
} else {
|
||||
$tid = GETPOST("projecttaskid") ? GETPOST("projecttaskid") : '';
|
||||
}
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1226,12 +1235,16 @@ if ($action == 'create') {
|
||||
// Object linked
|
||||
if (!empty($origin) && !empty($originid)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
|
||||
print '<td colspan="3">'.dolGetElementUrl($originid, $origin, 1).'</td></tr>';
|
||||
print '<input type="hidden" name="fk_element" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="elementtype" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
|
||||
if (! in_array($origin, array('societe', 'project', 'task', 'user'))) {
|
||||
// We do not use link for object that already contains a hard coded
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
|
||||
print '<td colspan="3">'.dolGetElementUrl($originid, $origin, 1).'</td></tr>';
|
||||
print '<input type="hidden" name="fk_element" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="elementtype" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
}
|
||||
}
|
||||
|
||||
$reg = array();
|
||||
@ -1258,7 +1271,7 @@ if ($action == 'create') {
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
print $object->showOptionals($extrafields, 'create', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -735,13 +735,14 @@ class ActionComm extends CommonObject
|
||||
/**
|
||||
* Load object from database
|
||||
*
|
||||
* @param int $id Id of action to get
|
||||
* @param string $ref Ref of action to get
|
||||
* @param string $ref_ext Ref ext to get
|
||||
* @param string $email_msgid Email msgid
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param int $id Id of action to get
|
||||
* @param string $ref Ref of action to get
|
||||
* @param string $ref_ext Ref ext to get
|
||||
* @param string $email_msgid Email msgid
|
||||
* @param string $loadresources 1=Load also resources
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '')
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadresources = 1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -858,8 +859,13 @@ class ActionComm extends CommonObject
|
||||
$this->event_paid = $obj->event_paid;
|
||||
$this->status = $obj->status;
|
||||
|
||||
$this->fetchResources();
|
||||
$this->fetch_optionals();
|
||||
|
||||
if ($loadresources) {
|
||||
$this->fetchResources();
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
||||
@ -484,7 +484,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$viewmode = '';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
|
||||
@ -608,7 +608,7 @@ if ($resql) {
|
||||
$viewmode = '';
|
||||
$viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
|
||||
@ -416,7 +416,7 @@ $massactionbutton = '';
|
||||
$viewmode = '';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
|
||||
@ -426,7 +426,7 @@ $massactionbutton = '';
|
||||
$viewmode = '';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
|
||||
@ -726,7 +726,7 @@ if ($action == 'create') {
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
print $object->showOptionals($extrafields, 'create');
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -2583,7 +2583,7 @@ if ($action == 'create') {
|
||||
// Create an invoice and classify billed
|
||||
if ($object->statut == Propal::STATUS_SIGNED) {
|
||||
if (!empty($conf->facture->enabled) && $usercancreateinvoice) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddBill").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
|
||||
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
|
||||
|
||||
@ -2563,8 +2563,13 @@ class Propal extends CommonObject
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
// PDF
|
||||
$hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
|
||||
$hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
|
||||
$hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
|
||||
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
$this->generateDocument($modelpdf, $outputlangs);
|
||||
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -2651,8 +2656,13 @@ class Propal extends CommonObject
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
// PDF
|
||||
$hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
|
||||
$hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
|
||||
$hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
|
||||
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
$this->generateDocument($modelpdf, $outputlangs);
|
||||
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
$this->oldcopy = clone $this;
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
* Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2019-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -88,12 +88,30 @@ $search_zip = GETPOST('search_zip', 'alpha');
|
||||
$search_state = GETPOST("search_state");
|
||||
$search_country = GETPOST("search_country", 'int');
|
||||
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||
$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int'));
|
||||
$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int'));
|
||||
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
|
||||
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_date_end_startday = GETPOST('search_date_end_startday', 'int');
|
||||
$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
|
||||
$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
|
||||
$search_date_end_endday = GETPOST('search_date_end_endday', 'int');
|
||||
$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
|
||||
$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int');
|
||||
$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver
|
||||
$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
|
||||
$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int');
|
||||
$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int');
|
||||
$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int');
|
||||
$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int');
|
||||
$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int');
|
||||
$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int');
|
||||
$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
|
||||
$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
|
||||
$search_availability = GETPOST('search_availability', 'int');
|
||||
$search_categ_cus = GETPOST("search_categ_cus", 'int');
|
||||
$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
|
||||
@ -278,12 +296,30 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_type = '';
|
||||
$search_country = '';
|
||||
$search_type_thirdparty = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_dateend_start = '';
|
||||
$search_dateend_end = '';
|
||||
$search_datedelivery_start = '';
|
||||
$search_datedelivery_end = '';
|
||||
$search_date_end_startday = '';
|
||||
$search_date_end_startmonth = '';
|
||||
$search_date_end_startyear = '';
|
||||
$search_date_end_endday = '';
|
||||
$search_date_end_endmonth = '';
|
||||
$search_date_end_endyear = '';
|
||||
$search_date_end_start = '';
|
||||
$search_date_end_end = '';
|
||||
$search_date_delivery_startday = '';
|
||||
$search_date_delivery_startmonth = '';
|
||||
$search_date_delivery_startyear = '';
|
||||
$search_date_delivery_endday = '';
|
||||
$search_date_delivery_endmonth = '';
|
||||
$search_date_delivery_endyear = '';
|
||||
$search_date_delivery_start = '';
|
||||
$search_date_delivery_end = '';
|
||||
$search_availability = '';
|
||||
$search_status = '';
|
||||
$object_statut = '';
|
||||
@ -471,11 +507,11 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date
|
||||
$sql .= ' p.note_public, p.note_private,';
|
||||
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
|
||||
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
if ($search_categ_cus) {
|
||||
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
@ -493,7 +529,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
if (!empty($search_categ_cus)) {
|
||||
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
}
|
||||
$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
|
||||
@ -592,6 +628,7 @@ if ($search_multicurrency_montant_ttc != '') {
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
|
||||
if ($search_categ_cus > 0) {
|
||||
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
|
||||
}
|
||||
@ -627,17 +664,17 @@ if ($search_date_start) {
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if ($search_dateend_start) {
|
||||
$sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
|
||||
if ($search_date_end_start) {
|
||||
$sql .= " AND p.fin_validite >= '".$db->idate($search_date_end_start)."'";
|
||||
}
|
||||
if ($search_dateend_end) {
|
||||
$sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
|
||||
if ($search_date_end_end) {
|
||||
$sql .= " AND p.fin_validite <= '".$db->idate($search_date_end_end)."'";
|
||||
}
|
||||
if ($search_datedelivery_start) {
|
||||
$sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_date_delivery_start) {
|
||||
$sql .= " AND p.date_livraison >= '".$db->idate($search_date_delivery_start)."'";
|
||||
}
|
||||
if ($search_datedelivery_end) {
|
||||
$sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_date_delivery_end) {
|
||||
$sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'";
|
||||
}
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
|
||||
@ -712,12 +749,60 @@ if ($resql) {
|
||||
if ($sall) {
|
||||
$param .= '&sall='.urlencode($sall);
|
||||
}
|
||||
if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y'));
|
||||
if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y'));
|
||||
if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start, '%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start, '%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start, '%Y'));
|
||||
if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end, '%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end, '%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end, '%Y'));
|
||||
if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y'));
|
||||
if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y'));
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_date_end_startday) {
|
||||
$param .= '&search_date_end_startday='.urlencode($search_date_end_startday);
|
||||
}
|
||||
if ($search_date_end_startmonth) {
|
||||
$param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
|
||||
}
|
||||
if ($search_date_end_startyear) {
|
||||
$param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear);
|
||||
}
|
||||
if ($search_date_end_endday) {
|
||||
$param .= '&search_date_end_endday='.urlencode($search_date_end_endday);
|
||||
}
|
||||
if ($search_date_end_endmonth) {
|
||||
$param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
|
||||
}
|
||||
if ($search_date_end_endyear) {
|
||||
$param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear);
|
||||
}
|
||||
if ($search_date_delivery_startday) {
|
||||
$param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
|
||||
}
|
||||
if ($search_date_delivery_startmonth) {
|
||||
$param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
|
||||
}
|
||||
if ($search_date_delivery_startyear) {
|
||||
$param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
|
||||
}
|
||||
if ($search_date_delivery_endday) {
|
||||
$param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
|
||||
}
|
||||
if ($search_date_delivery_endmonth) {
|
||||
$param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
|
||||
}
|
||||
if ($search_date_delivery_endyear) {
|
||||
$param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
|
||||
}
|
||||
if ($search_ref) {
|
||||
$param .= '&search_ref='.urlencode($search_ref);
|
||||
}
|
||||
@ -1017,10 +1102,10 @@ if ($resql) {
|
||||
if (!empty($arrayfields['p.fin_validite']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -1028,10 +1113,10 @@ if ($resql) {
|
||||
if (!empty($arrayfields['p.date_livraison']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -1708,8 +1793,8 @@ if ($resql) {
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->statut = $obj->statut;
|
||||
$userstatic->email = $obj->user_email;
|
||||
$userstatic->statut = $obj->user_statut;
|
||||
$userstatic->entity = $obj->user_entity;
|
||||
$userstatic->photo = $obj->photo;
|
||||
$userstatic->office_phone = $obj->office_phone;
|
||||
|
||||
@ -278,6 +278,7 @@ if (empty($reshook)) {
|
||||
if (!empty($origin) && !empty($originid)) {
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $origin;
|
||||
$regs = array();
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
||||
$element = $regs [1];
|
||||
$subelement = $regs [2];
|
||||
@ -1394,6 +1395,7 @@ if (empty($reshook)) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans('Order')." - ".$langs->trans('Card');
|
||||
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
|
||||
llxHeader('', $title, $help_url);
|
||||
@ -1719,7 +1721,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
};
|
||||
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
print $object->showOptionals($extrafields, 'create', $parameters);
|
||||
}
|
||||
|
||||
// Template to use by default
|
||||
@ -2347,17 +2349,17 @@ if ($action == 'create' && $usercancreate) {
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -2367,23 +2369,23 @@ if ($action == 'create' && $usercancreate) {
|
||||
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
|
||||
}
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).$alert.'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>';
|
||||
|
||||
// Total VAT
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
// Total TTC
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
@ -299,13 +299,9 @@ class Commande extends CommonOrder
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
@ -344,6 +340,10 @@ class Commande extends CommonOrder
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
|
||||
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
|
||||
'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),
|
||||
'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),
|
||||
);
|
||||
|
||||
@ -426,7 +426,7 @@ $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multic
|
||||
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||
$sql .= ' c.fk_input_reason';
|
||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||
@ -545,7 +545,7 @@ if ($search_state) {
|
||||
if ($search_country) {
|
||||
$sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
|
||||
}
|
||||
if ($search_type_thirdparty) {
|
||||
if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
|
||||
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
|
||||
}
|
||||
if ($search_company) {
|
||||
@ -787,7 +787,7 @@ if ($resql) {
|
||||
if ($search_country != '') {
|
||||
$param .= '&search_country='.urlencode($search_country);
|
||||
}
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
|
||||
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
}
|
||||
if ($search_product_category != '') {
|
||||
@ -1682,8 +1682,8 @@ if ($resql) {
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->statut = $obj->statut;
|
||||
$userstatic->email = $obj->user_email;
|
||||
$userstatic->statut = $obj->user_statut;
|
||||
$userstatic->entity = $obj->entity;
|
||||
$userstatic->photo = $obj->photo;
|
||||
$userstatic->office_phone = $obj->office_phone;
|
||||
|
||||
@ -57,12 +57,12 @@ $date_start = GETPOST('date_start', 'alpha');
|
||||
$date_startDay = GETPOST('date_startday', 'int');
|
||||
$date_startMonth = GETPOST('date_startmonth', 'int');
|
||||
$date_startYear = GETPOST('date_startyear', 'int');
|
||||
$date_start = ($date_startDay ? dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel') : dol_stringtotime($date_start));
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel');
|
||||
$date_stop = GETPOST('date_stop', 'alpha');
|
||||
$date_stopDay = GETPOST('date_stopday', 'int');
|
||||
$date_stopMonth = GETPOST('date_stopmonth', 'int');
|
||||
$date_stopYear = GETPOST('date_stopyear', 'int');
|
||||
$date_stop = ($date_stopDay ? dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel') : dol_stringtotime($date_stop));
|
||||
$date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -348,8 +348,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$nofile = array();
|
||||
$nofile['id'] = $objd->id;
|
||||
$nofile['entity'] = $objd->entity;
|
||||
$nofile['date'] = $db->idate($objd->date);
|
||||
$nofile['date_due'] = $db->idate($objd->date_due);
|
||||
$nofile['date'] = $db->jdate($objd->date);
|
||||
$nofile['date_due'] = $db->jdate($objd->date_due);
|
||||
$nofile['paid'] = $objd->paid;
|
||||
$nofile['amount_ht'] = $objd->total_ht;
|
||||
$nofile['amount_ttc'] = $objd->total_ttc;
|
||||
@ -368,8 +368,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
foreach ($files as $key => $file) {
|
||||
$file['id'] = $objd->id;
|
||||
$file['entity'] = $objd->entity;
|
||||
$file['date'] = $db->idate($objd->date);
|
||||
$file['date_due'] = $db->idate($objd->date_due);
|
||||
$file['date'] = $db->jdate($objd->date);
|
||||
$file['date_due'] = $db->jdate($objd->date_due);
|
||||
$file['paid'] = $objd->paid;
|
||||
$file['amount_ht'] = $objd->total_ht;
|
||||
$file['amount_ttc'] = $objd->total_ttc;
|
||||
@ -460,7 +460,7 @@ if ($result && $action == "dl" && !$error) {
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Country");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("VATIntra");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
|
||||
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
|
||||
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
|
||||
|
||||
dol_delete_file($zipname);
|
||||
|
||||
@ -608,10 +608,14 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||
|
||||
echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day');
|
||||
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
||||
|
||||
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />';
|
||||
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
|
||||
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
||||
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
||||
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopday" value="'.GETPOST('date_stopday', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopmonth" value="'.GETPOST('date_stopmonth', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopyear" value="'.GETPOST('date_stopyear', 'int').'" />';
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||
}
|
||||
@ -741,19 +745,19 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<td aling="left">'.$data['paid'].'</td>';
|
||||
|
||||
// Total ET
|
||||
print '<td align="right">'.price($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'])."</td>\n";
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
|
||||
// Total IT
|
||||
print '<td align="right">'.price($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'])."</td>\n";
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
|
||||
// Total VAT
|
||||
print '<td align="right">'.price($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'])."</td>\n";
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
|
||||
|
||||
print '<td class="tdoverflowmax150" title="'.$data['thirdparty_name'].'">'.$data['thirdparty_name']."</td>\n";
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['country_code']."</td>\n";
|
||||
|
||||
print '<td align="right">'.$data['vatnum']."</td>\n";
|
||||
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
||||
|
||||
if ($data['sens']) {
|
||||
$totalET_credit += $data['amount_ht'];
|
||||
|
||||
@ -175,7 +175,6 @@ $object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -266,13 +265,15 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
||||
|
||||
if (!$error) {
|
||||
$param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id;
|
||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||
if ($page) {
|
||||
$param .= '&page='.urlencode($page);
|
||||
}
|
||||
if ($offset) {
|
||||
$param .= '&offset='.urlencode($offset);
|
||||
}
|
||||
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||
}
|
||||
if ($search_thirdparty_user) {
|
||||
$param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
|
||||
}
|
||||
@ -415,7 +416,6 @@ $banklinestatic = new AccountLine($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
// Must be before button action
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
@ -748,7 +748,7 @@ if ($resql) {
|
||||
// Confirmation delete
|
||||
if ($action == 'delete') {
|
||||
$text = $langs->trans('ConfirmDeleteTransaction');
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid", 'int'), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
|
||||
}
|
||||
|
||||
// Lines of title fields
|
||||
@ -1189,7 +1189,7 @@ if ($resql) {
|
||||
$objforbalance = $db->fetch_object($resqlforbalance);
|
||||
if ($objforbalance) {
|
||||
// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
|
||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
|
||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
|
||||
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
|
||||
} else {
|
||||
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
|
||||
@ -1274,8 +1274,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
|
||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
|
||||
$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
|
||||
$balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
|
||||
} else {
|
||||
|
||||
@ -444,7 +444,7 @@ if ($action == 'create') {
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
print $object->showOptionals($extrafields, 'create', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -61,8 +61,8 @@ if ($action == 'add') {
|
||||
|
||||
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT', 2);
|
||||
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT', 2);
|
||||
|
||||
if (!$label) {
|
||||
$error++;
|
||||
|
||||
@ -223,7 +223,7 @@ $sql .= $object->getFieldList('t');
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
|
||||
@ -393,13 +393,21 @@ if (empty($reshook)) {
|
||||
} elseif ($action == 'setinvoicedate' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$old_date_lim_reglement = $object->date_lim_reglement;
|
||||
$date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'));
|
||||
if (empty($date)) {
|
||||
$newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver');
|
||||
if (empty($newdate)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken());
|
||||
exit;
|
||||
}
|
||||
$object->date = $date;
|
||||
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
|
||||
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
$object->date = $newdate;
|
||||
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
|
||||
if ($new_date_lim_reglement > $old_date_lim_reglement) {
|
||||
$object->date_lim_reglement = $new_date_lim_reglement;
|
||||
@ -413,7 +421,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'setdate_pointoftax' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
@ -986,14 +996,16 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
|
||||
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||
|
||||
// Replacement invoice
|
||||
if (GETPOST('type') == Facture::TYPE_REPLACEMENT) {
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
@ -1005,8 +1017,6 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (!$error) {
|
||||
// This is a replacement invoice
|
||||
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
|
||||
@ -1049,19 +1059,16 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (!$error) {
|
||||
if (!empty($originentity)) {
|
||||
$object->entity = $originentity;
|
||||
@ -1265,19 +1272,16 @@ if (empty($reshook)) {
|
||||
|
||||
// Standard invoice or Deposit invoice, created from a Predefined template invoice
|
||||
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) {
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (!$error) {
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->type = GETPOST('type');
|
||||
@ -1312,8 +1316,6 @@ if (empty($reshook)) {
|
||||
$typeamount = GETPOST('typedeposit', 'aZ09');
|
||||
$valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU');
|
||||
$valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU');
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (GETPOST('socid', 'int') < 1) {
|
||||
$error++;
|
||||
@ -1325,7 +1327,7 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
@ -1807,19 +1809,16 @@ if (empty($reshook)) {
|
||||
|
||||
// Situation invoices
|
||||
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) {
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (!(GETPOST('situations', 'int') > 0)) {
|
||||
$error++;
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
||||
@ -2832,6 +2831,7 @@ if (empty($reshook)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
@ -3514,7 +3514,8 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver');
|
||||
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||
@ -3524,7 +3525,6 @@ if ($action == 'create') {
|
||||
// Date point of tax
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -3637,7 +3637,7 @@ if ($action == 'create') {
|
||||
}
|
||||
};
|
||||
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
print $object->showOptionals($extrafields, 'create', $parameters);
|
||||
}
|
||||
|
||||
// Template to use by default
|
||||
@ -3807,8 +3807,16 @@ if ($action == 'create') {
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
print "</form>\n";
|
||||
} elseif ($id > 0 || !empty($ref)) {
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show object in view mode
|
||||
*/
|
||||
@ -3837,15 +3845,25 @@ if ($action == 'create') {
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
$totalcreditnotes = $object->getSumCreditNotesUsed();
|
||||
$totaldeposits = $object->getSumDepositsUsed();
|
||||
// print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
|
||||
//print "totalpaye=".$totalpaye." 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($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$multicurrency_totalpaye = $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');
|
||||
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
|
||||
}
|
||||
|
||||
if ($object->paye) {
|
||||
$resteapayer = 0;
|
||||
}
|
||||
@ -5072,7 +5090,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans('RemainderToPay');
|
||||
if ($resteapayeraffiche < 0) {
|
||||
print ' ('.$langs->trans('ExcessReceived').')';
|
||||
print ' ('.$langs->trans('NegativeIfExcessReceived').')';
|
||||
}
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
@ -5100,23 +5118,24 @@ if ($action == 'create') {
|
||||
print ' :</td><td align="right">'.price($retainedWarranty).'</td><td> </td></tr>';
|
||||
}
|
||||
} else { // Credit note
|
||||
$resteapayeraffiche = $resteapayer;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
|
||||
// Total already paid back
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
print $langs->trans('AlreadyPaidBack');
|
||||
print ' :</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
||||
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>';
|
||||
|
||||
// Remainder to pay back
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
print $langs->trans('RemainderToPayBack');
|
||||
print '<span class="opacitymedium">'.$langs->trans('RemainderToPayBack');
|
||||
if ($resteapayeraffiche > 0) {
|
||||
print ' ('.$langs->trans('ExcessPaid').')';
|
||||
print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
|
||||
}
|
||||
print ' :</td>';
|
||||
print '</span></td>';
|
||||
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopayback' : (' '.$cssforamountpaymentcomplete)).'">'.price($sign * $resteapayeraffiche).'</td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
|
||||
|
||||
@ -2267,7 +2267,6 @@ class Facture extends CommonInvoice
|
||||
$sql .= ' SET fk_facture = NULL, fk_facture_line = NULL';
|
||||
$sql .= ' WHERE fk_facture_line IN ('.$this->db->sanitize(join(',', $list_rowid_det)).')';
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (!$this->db->query($sql)) {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->errors[] = $this->error;
|
||||
@ -2276,6 +2275,30 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
// Remove other links to the deleted invoice
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee';
|
||||
$sql .= ' SET fk_invoice = NULL';
|
||||
$sql .= ' WHERE fk_invoice = '.((int) $rowid);
|
||||
|
||||
if (!$this->db->query($sql)) {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->errors[] = $this->error;
|
||||
$this->db->rollback();
|
||||
return -5;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time';
|
||||
$sql .= ' SET invoice_id = NULL, invoice_line_id = NULL';
|
||||
$sql .= ' WHERE invoice_id = '.((int) $rowid);
|
||||
|
||||
if (!$this->db->query($sql)) {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->errors[] = $this->error;
|
||||
$this->db->rollback();
|
||||
return -5;
|
||||
}
|
||||
|
||||
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided
|
||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
@ -2299,17 +2322,13 @@ class Facture extends CommonInvoice
|
||||
// Invoice line extrafileds
|
||||
$main = MAIN_DB_PREFIX.'facturedet';
|
||||
$ef = $main."_extrafields";
|
||||
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
|
||||
$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
|
||||
// Delete invoice line
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
@ -3277,8 +3296,8 @@ class Facture extends CommonInvoice
|
||||
$this->line->desc = $desc;
|
||||
$this->line->ref_ext = $ref_ext;
|
||||
|
||||
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
|
||||
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
|
||||
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
|
||||
$this->line->vat_src_code = $vat_src_code;
|
||||
$this->line->tva_tx = $txtva;
|
||||
@ -3287,11 +3306,11 @@ class Facture extends CommonInvoice
|
||||
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
|
||||
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
||||
|
||||
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
|
||||
|
||||
$this->line->fk_product = $fk_product;
|
||||
$this->line->product_type = $product_type;
|
||||
@ -3318,10 +3337,11 @@ class Facture extends CommonInvoice
|
||||
// Multicurrency
|
||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
$this->line->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise
|
||||
|
||||
$this->line->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative
|
||||
$this->line->multicurrency_total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ttc) : $multicurrency_total_ttc); // For credit note and if qty is negative, total is negative
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
|
||||
@ -100,6 +100,14 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
@ -92,6 +92,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
|
||||
|
||||
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
|
||||
@ -62,6 +62,14 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
|
||||
|
||||
@ -497,7 +497,7 @@ $sql .= ' typent.code as typent_code,';
|
||||
$sql .= ' state.code_departement as state_code, state.nom as state_name,';
|
||||
$sql .= ' country.code as country_code,';
|
||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (!$sall) {
|
||||
@ -520,7 +520,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
|
||||
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
}
|
||||
|
||||
@ -606,12 +606,6 @@ if ($search_country) {
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') {
|
||||
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
||||
}
|
||||
if ($search_company) {
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
if ($search_company_alias) {
|
||||
$sql .= natural_search('s.name_alias', $search_company_alias);
|
||||
}
|
||||
if ($search_montant_ht != '') {
|
||||
$sql .= natural_search('f.total_ht', $search_montant_ht, 1);
|
||||
}
|
||||
@ -1915,8 +1909,8 @@ if ($resql) {
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->statut = $obj->statut;
|
||||
$userstatic->email = $obj->user_email;
|
||||
$userstatic->statut = $obj->user_statut;
|
||||
$userstatic->entity = $obj->entity;
|
||||
$userstatic->photo = $obj->photo;
|
||||
$userstatic->office_phone = $obj->office_phone;
|
||||
|
||||
@ -69,6 +69,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('bills', 'companies', 'other'));
|
||||
|
||||
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer';
|
||||
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
|
||||
if ($mode == 'customer' && !$user->rights->facture->lire) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -110,6 +110,10 @@ if ($mode == 'supplier') {
|
||||
if ($object_status != '' && $object_status >= 0) {
|
||||
$stats->where .= ' AND f.fk_statut IN ('.$db->sanitize($object_status).')';
|
||||
}
|
||||
if (is_array($custcats) && !empty($custcats)) {
|
||||
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
|
||||
$stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $custcats)).')';
|
||||
}
|
||||
}
|
||||
|
||||
// Build graphic number of object
|
||||
@ -244,7 +248,7 @@ if (!count($arrayyears)) {
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.$mode;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode);
|
||||
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||
$head[$h][2] = 'byyear';
|
||||
$h++;
|
||||
@ -261,12 +265,12 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type);
|
||||
print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
||||
|
||||
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
|
||||
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
|
||||
//Array passed as an argument to Form::selectarray to build a proper select input
|
||||
$companies = array();
|
||||
|
||||
foreach ($tmp_companies as $value) {
|
||||
$companies[$value['key']] = $value['label'];
|
||||
$filter = '';
|
||||
if ($mode == 'customer') {
|
||||
$filter = 's.client in (1,2,3)';
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
$filter = 's.fournisseur = 1';
|
||||
}
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
@ -281,14 +285,8 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') {
|
||||
$filter = 's.client in (1,2,3)';
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
$filter = 's.fournisseur = 1';
|
||||
}
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1);
|
||||
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// ThirdParty Type
|
||||
|
||||
@ -206,6 +206,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
|
||||
print '<td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
|
||||
print '<td class="nobordernopadding nowraponall">';
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
@ -222,15 +223,19 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
print '<td class="left">';
|
||||
|
||||
print '<td class="tdoverflowmax150">';
|
||||
print $thirdpartystatic->getNomUrl(1, 'customer', 44);
|
||||
print '</td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht).'</span></td>';
|
||||
}
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
|
||||
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$total_ttc += $obj->total_ttc;
|
||||
|
||||
@ -64,7 +64,7 @@ if ($cancel && !$id) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'add' && $cancel) {
|
||||
if ($action == 'add' && !$cancel) {
|
||||
$db->begin();
|
||||
|
||||
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
|
||||
|
||||
@ -416,10 +416,13 @@ if ($resql) {
|
||||
print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
if ($objp->paye == 1) { // If at least one invoice is paid, disable delete
|
||||
|
||||
// If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production
|
||||
if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) {
|
||||
$disable_delete = 1;
|
||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
|
||||
}
|
||||
|
||||
$total = $total + $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
*
|
||||
@ -31,13 +31,6 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'facture', $facid, '');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
@ -60,6 +53,10 @@ $day = GETPOST('day', 'int');
|
||||
$month = GETPOST('month', 'int');
|
||||
$year = GETPOST('year', 'int');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'facture', $facid, '');
|
||||
|
||||
$search_ref = GETPOST("search_ref", "alpha");
|
||||
$search_company = GETPOST("search_company", 'alpha');
|
||||
$search_paymenttype = GETPOST("search_paymenttype");
|
||||
@ -277,6 +274,11 @@ $param .= (GETPOST("orphelins") ? "&orphelins=1" : '');
|
||||
$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : '');
|
||||
$param .= ($search_company ? "&search_company=".urlencode($search_company) : '');
|
||||
$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : '');
|
||||
$param .= ($search_paymenttype ? "&search_paymenttype=".urlencode($search_paymenttype) : '');
|
||||
$param .= ($search_account ? "&search_account=".urlencode($search_account) : '');
|
||||
$param .= ($day ? "&day=".urlencode($day) : '');
|
||||
$param .= ($month ? "&month=".urlencode($month) : '');
|
||||
$param .= ($year ? "&year=".urlencode($year) : '');
|
||||
$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : '');
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
|
||||
@ -151,7 +151,9 @@ if ($id) {
|
||||
print $bon->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec, 'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($lipre->amount).'</span></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut, 1).'</td></tr>';
|
||||
|
||||
if ($lipre->statut == 3) {
|
||||
@ -159,6 +161,7 @@ if ($id) {
|
||||
$resf = $rej->fetch($lipre->id);
|
||||
if ($resf == 0) {
|
||||
print '<tr><td>'.$langs->trans("RefusedReason").'</td><td>'.$rej->motif.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("RefusedData").'</td><td>';
|
||||
if ($rej->date_rejet == 0) {
|
||||
/* Historique pour certaines install */
|
||||
@ -167,6 +170,7 @@ if ($id) {
|
||||
print dol_print_date($rej->date_rejet, 'day');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("RefusedInvoicing").'</td><td>'.$rej->invoicing.'</td></tr>';
|
||||
} else {
|
||||
print '<tr><td>'.$resf.'</td></tr>';
|
||||
@ -229,7 +233,7 @@ if ($id) {
|
||||
/*
|
||||
* Action bar
|
||||
*/
|
||||
print "<div class=\"tabsAction\">";
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($action == '') {
|
||||
if ($bon->statut == BonPrelevement::STATUS_CREDITED) {
|
||||
@ -245,7 +249,7 @@ if ($id) {
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* List of invoices
|
||||
@ -267,7 +271,7 @@ if ($id) {
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.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
|
||||
@ -33,6 +34,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
@ -366,7 +368,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Factures clients
|
||||
* Customer invoices
|
||||
*/
|
||||
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("CustomersInvoices").'</td></tr>';
|
||||
|
||||
@ -386,8 +388,8 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
/*
|
||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||
* List of payments (old payments are not seen by this query because, on older versions, they were not linked via payment_invoice.
|
||||
* old versions, they were not linked via payment_invoice. They are added later)
|
||||
*/
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -434,7 +436,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// On ajoute les paiements clients anciennes version, non lie par paiement_facture
|
||||
// We add the old customer payments, not linked by payment_invoice
|
||||
if ($modecompta == 'RECETTES-DEPENSES') {
|
||||
$sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
@ -673,7 +675,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
|
||||
/*
|
||||
* Charges sociales non deductibles
|
||||
* Social / Fiscal contributions who are not deductible
|
||||
*/
|
||||
|
||||
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
|
||||
@ -760,7 +762,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
|
||||
/*
|
||||
* Charges sociales deductibles
|
||||
* Social / Fiscal contributions who are deductible
|
||||
*/
|
||||
|
||||
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
|
||||
@ -860,15 +862,27 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$column = 'p.datep';
|
||||
}
|
||||
|
||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
|
||||
|
||||
// For backward compatibility with old module salary
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
|
||||
|
||||
$newsortfield = $sortfield;
|
||||
if ($newsortfield == 's.nom, s.rowid') {
|
||||
$newsortfield = 'u.firstname, u.lastname';
|
||||
@ -900,7 +914,10 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
|
||||
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($obj->fk_user);
|
||||
|
||||
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?search_user=".urlencode($userstatic->getFullName($langs))."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
@ -931,7 +948,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
|
||||
/*
|
||||
* Expense
|
||||
* Expense report
|
||||
*/
|
||||
|
||||
if (!empty($conf->expensereport->enabled)) {
|
||||
@ -1087,7 +1104,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
|
||||
/*
|
||||
* Payement Loan
|
||||
* Payment Loan
|
||||
*/
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
|
||||
@ -1208,7 +1225,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
// VAT to retreive
|
||||
// VAT to retrieve
|
||||
$amount = 0;
|
||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
|
||||
@ -801,7 +801,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
|
||||
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)).'</td>';
|
||||
print '<td>';
|
||||
print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1087,8 +1089,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
|
||||
print '<td>';
|
||||
$useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2));
|
||||
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty).'</td>';
|
||||
print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1284,7 +1288,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($objsoc->id > 0) {
|
||||
$morehtmlref .= $objsoc->getNomUrl(1, 'contact');
|
||||
} else {
|
||||
$morehtmlref .= $langs->trans("ContactNotLinkedToCompany");
|
||||
$morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
@ -1319,7 +1323,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("No_Email").'</td><td>'.yn($object->no_email).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("No_Email").'</td><td>';
|
||||
if ($object->email) {
|
||||
print yn($object->no_email);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailNotDefined").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("ContactVisibility").'</td><td>';
|
||||
|
||||
@ -165,7 +165,8 @@ class Contact extends CommonObject
|
||||
/**
|
||||
* @var int Thirdparty ID
|
||||
*/
|
||||
public $socid;
|
||||
public $socid; // both socid and fk_soc are used
|
||||
public $fk_soc; // both socid and fk_soc are used
|
||||
|
||||
/**
|
||||
* @var int 0=inactive, 1=active
|
||||
@ -1027,7 +1028,8 @@ class Contact extends CommonObject
|
||||
$this->country_code = $obj->country_id ? $obj->country_code : '';
|
||||
$this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
|
||||
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used
|
||||
$this->socid = $obj->fk_soc; // Both fk_soc and socid are used
|
||||
$this->socname = $obj->socname;
|
||||
$this->poste = $obj->poste;
|
||||
$this->statut = $obj->statut;
|
||||
|
||||
@ -75,7 +75,11 @@ $search_phone_pro = GETPOST("search_phone_pro", 'alpha');
|
||||
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
|
||||
$search_fax = GETPOST("search_fax", 'alpha');
|
||||
$search_email = GETPOST("search_email", 'alpha');
|
||||
$search_no_email = GETPOST("search_no_email", 'int');
|
||||
if (!empty($conf->mailing->enabled)) {
|
||||
$search_no_email = GETPOST("search_no_email", 'int');
|
||||
} else {
|
||||
$search_no_email = -1;
|
||||
}
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
@ -203,6 +207,12 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
|
||||
$arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>25, 'checked'=>1);
|
||||
}
|
||||
|
||||
$arrayfields['unsubscribed'] = array(
|
||||
'label'=>'No_Email',
|
||||
'checked'=>0,
|
||||
'enabled'=>(!empty($conf->mailing->enabled)),
|
||||
'position'=>41);
|
||||
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
@ -353,7 +363,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
|
||||
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email,";
|
||||
$sql .= " p.socialnetworks, p.photo,";
|
||||
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
|
||||
@ -364,6 +374,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
if (!empty($conf->mailing->enabled)) {
|
||||
$sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -494,8 +507,11 @@ if (strlen($search_town)) {
|
||||
if (count($search_roles) > 0) {
|
||||
$sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
|
||||
}
|
||||
if ($search_no_email != '' && $search_no_email >= 0) {
|
||||
$sql .= " AND p.no_email = ".((int) $search_no_email);
|
||||
if ($search_no_email != -1 && $search_no_email > 0) {
|
||||
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0";
|
||||
}
|
||||
if ($search_no_email != -1 && $search_no_email == 0) {
|
||||
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
|
||||
}
|
||||
if ($search_status != '' && $search_status >= 0) {
|
||||
$sql .= " AND p.statut = ".((int) $search_status);
|
||||
@ -570,13 +586,13 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
}
|
||||
$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||
$param .= '&type='.urlencode($type).'&view='.urlencode($view);
|
||||
if (!empty($search_categ)) {
|
||||
if (!empty($search_categ) && $search_categ != '-1') {
|
||||
$param .= '&search_categ='.urlencode($search_categ);
|
||||
}
|
||||
if (!empty($search_categ_thirdparty)) {
|
||||
if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
|
||||
$param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
|
||||
}
|
||||
if (!empty($search_categ_supplier)) {
|
||||
if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
|
||||
$param .= '&search_categ_supplier='.urlencode($search_categ_supplier);
|
||||
}
|
||||
if ($sall != '') {
|
||||
@ -830,7 +846,7 @@ if (!empty($arrayfields['p.email']['checked'])) {
|
||||
print '<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.no_email']['checked'])) {
|
||||
if (!empty($arrayfields['unsubscribed']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
|
||||
print '</td>';
|
||||
@ -949,8 +965,8 @@ if (!empty($arrayfields['p.fax']['checked'])) {
|
||||
if (!empty($arrayfields['p.email']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['p.no_email']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['unsubscribed']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
@ -1131,8 +1147,14 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
}
|
||||
// No EMail
|
||||
if (!empty($arrayfields['p.no_email']['checked'])) {
|
||||
print '<td class="center">'.yn($obj->no_email).'</td>';
|
||||
if (!empty($arrayfields['unsubscribed']['checked'])) {
|
||||
print '<td class="center">';
|
||||
if (empty($obj->email)) {
|
||||
//print '<span class="opacitymedium">'.$langs->trans("NoEmail").'</span>';
|
||||
} else {
|
||||
print yn(($obj->unsubscribed > 0) ? 1 : 0);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -421,16 +421,16 @@ if ($search_dfyear != '') {
|
||||
if ($search_dfmonth != '') {
|
||||
$param .= '&search_dfmonth='.urlencode($search_dfmonth);
|
||||
}
|
||||
if ($search_sale != '') {
|
||||
if ($search_sale > 0) {
|
||||
$param .= '&search_sale='.urlencode($search_sale);
|
||||
}
|
||||
if ($search_user != '') {
|
||||
if ($search_user > 0) {
|
||||
$param .= '&search_user='.urlencode($search_user);
|
||||
}
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
if ($search_type_thirdparty > 0) {
|
||||
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
}
|
||||
if ($search_product_category != '') {
|
||||
if ($search_product_category > 0) {
|
||||
$param .= '&search_product_category='.urlencode($search_product_category);
|
||||
}
|
||||
if ($show_files) {
|
||||
|
||||
@ -261,6 +261,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
|
||||
}
|
||||
|
||||
$result = $object->delete($user);
|
||||
|
||||
if ($result > 0) {
|
||||
// Delete OK
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
|
||||
@ -205,12 +205,14 @@ if ($type == 'directory') {
|
||||
'product',
|
||||
'tax',
|
||||
'project',
|
||||
'project_task',
|
||||
'fichinter',
|
||||
'user',
|
||||
'expensereport',
|
||||
'holiday',
|
||||
'recruitment-recruitmentcandidature',
|
||||
'banque',
|
||||
'chequereceipt',
|
||||
'mrp-mo'
|
||||
);
|
||||
|
||||
@ -243,6 +245,8 @@ if ($type == 'directory') {
|
||||
$upload_dir = $conf->tax->dir_output;
|
||||
} elseif ($module == 'project') {
|
||||
$upload_dir = $conf->projet->dir_output;
|
||||
} elseif ($module == 'project_task') {
|
||||
$upload_dir = $conf->projet->dir_output;
|
||||
} elseif ($module == 'fichinter') {
|
||||
$upload_dir = $conf->ficheinter->dir_output;
|
||||
} elseif ($module == 'user') {
|
||||
@ -255,8 +259,10 @@ if ($type == 'directory') {
|
||||
$upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
|
||||
} elseif ($module == 'banque') {
|
||||
$upload_dir = $conf->bank->dir_output;
|
||||
} elseif ($module == 'chequereceipt') {
|
||||
$upload_dir = $conf->bank->dir_output.'/checkdeposits';
|
||||
} elseif ($module == 'mrp-mo') {
|
||||
$upload_dir = $conf->mrp->dir_output.'/mo';
|
||||
$upload_dir = $conf->mrp->dir_output;
|
||||
} else {
|
||||
$parameters = array('modulepart'=>$module);
|
||||
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||
|
||||
@ -99,6 +99,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
|
||||
$perm = 1;
|
||||
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
|
||||
$perm = 1;
|
||||
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
|
||||
$perm = 1;
|
||||
} else {
|
||||
$tmparray = explode('_', $table_element_line);
|
||||
$tmpmodule = $tmparray[0]; $tmpobject = preg_replace('/line$/', '', $tmparray[1]);
|
||||
@ -111,7 +113,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
|
||||
// We should not be here. If we are not allowed to reorder rows, feature should not be visible on script.
|
||||
// If we are here, it is a hack attempt, so we report a warning.
|
||||
print 'Bad permission to modify position of lines for object in table '.$table_element_line;
|
||||
dol_syslog('Bad permission to modify position of lines for object in table '.$table_element_line.', fk_element '.$fk_element, LOG_WARNING);
|
||||
dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING);
|
||||
accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line);
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y", 'gmt');
|
||||
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y");
|
||||
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
|
||||
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
|
||||
$tot += $objp->subscription;
|
||||
|
||||
@ -97,6 +97,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
|
||||
$sql .= " AND c.date_livraison IS NOT NULL";
|
||||
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
|
||||
@ -398,7 +398,7 @@ abstract class CommonDocGenerator
|
||||
|
||||
$sumpayed = $sumdeposit = $sumcreditnote = '';
|
||||
$already_payed_all = 0;
|
||||
$remain_to_pay = 0;
|
||||
|
||||
if ($object->element == 'facture') {
|
||||
$invoice_source = new Facture($this->db);
|
||||
if ($object->fk_facture_source > 0) {
|
||||
@ -408,7 +408,6 @@ abstract class CommonDocGenerator
|
||||
$sumdeposit = $object->getSumDepositsUsed();
|
||||
$sumcreditnote = $object->getSumCreditNotesUsed();
|
||||
$already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
|
||||
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
||||
|
||||
if ($object->fk_account > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
@ -420,73 +419,76 @@ abstract class CommonDocGenerator
|
||||
$date = ($object->element == 'contrat' ? $object->date_contrat : $object->date);
|
||||
|
||||
$resarray = array(
|
||||
$array_key.'_id'=>$object->id,
|
||||
$array_key.'_ref'=>$object->ref,
|
||||
$array_key.'_ref_ext'=>$object->ref_ext,
|
||||
$array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
|
||||
$array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
|
||||
$array_key.'_source_invoice_ref'=>$invoice_source->ref,
|
||||
// Dates
|
||||
$array_key.'_hour'=>dol_print_date($date, 'hour'),
|
||||
$array_key.'_date'=>dol_print_date($date, 'day'),
|
||||
$array_key.'_date_rfc'=>dol_print_date($date, 'dayrfc'),
|
||||
$array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ?dol_print_date($object->date_lim_reglement, 'day') : ''),
|
||||
$array_key.'_date_end'=>(!empty($object->fin_validite) ?dol_print_date($object->fin_validite, 'day') : ''),
|
||||
$array_key.'_date_creation'=>dol_print_date($object->date_creation, 'day'),
|
||||
$array_key.'_date_modification'=>(!empty($object->date_modification) ?dol_print_date($object->date_modification, 'day') : ''),
|
||||
$array_key.'_date_validation'=>(!empty($object->date_validation) ?dol_print_date($object->date_validation, 'dayhour') : ''),
|
||||
$array_key.'_date_delivery_planed'=>(!empty($object->date_livraison) ?dol_print_date($object->date_livraison, 'day') : ''),
|
||||
$array_key.'_date_close'=>(!empty($object->date_cloture) ?dol_print_date($object->date_cloture, 'dayhour') : ''),
|
||||
$array_key.'_id'=>$object->id,
|
||||
$array_key.'_ref'=>$object->ref,
|
||||
$array_key.'_ref_ext'=>$object->ref_ext,
|
||||
$array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
|
||||
$array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
|
||||
$array_key.'_source_invoice_ref'=>$invoice_source->ref,
|
||||
// Dates
|
||||
$array_key.'_hour'=>dol_print_date($date, 'hour'),
|
||||
$array_key.'_date'=>dol_print_date($date, 'day'),
|
||||
$array_key.'_date_rfc'=>dol_print_date($date, 'dayrfc'),
|
||||
$array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ?dol_print_date($object->date_lim_reglement, 'day') : ''),
|
||||
$array_key.'_date_end'=>(!empty($object->fin_validite) ?dol_print_date($object->fin_validite, 'day') : ''),
|
||||
$array_key.'_date_creation'=>dol_print_date($object->date_creation, 'day'),
|
||||
$array_key.'_date_modification'=>(!empty($object->date_modification) ?dol_print_date($object->date_modification, 'day') : ''),
|
||||
$array_key.'_date_validation'=>(!empty($object->date_validation) ?dol_print_date($object->date_validation, 'dayhour') : ''),
|
||||
$array_key.'_date_delivery_planed'=>(!empty($object->date_livraison) ?dol_print_date($object->date_livraison, 'day') : ''),
|
||||
$array_key.'_date_close'=>(!empty($object->date_cloture) ?dol_print_date($object->date_cloture, 'dayhour') : ''),
|
||||
|
||||
$array_key.'_payment_mode_code'=>$object->mode_reglement_code,
|
||||
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
|
||||
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
|
||||
$array_key.'_payment_mode_code'=>$object->mode_reglement_code,
|
||||
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
|
||||
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
|
||||
|
||||
$array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
|
||||
$array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
|
||||
|
||||
$array_key.'_bank_iban'=>$bank_account->iban,
|
||||
$array_key.'_bank_bic'=>$bank_account->bic,
|
||||
$array_key.'_bank_iban'=>$bank_account->iban,
|
||||
$array_key.'_bank_bic'=>$bank_account->bic,
|
||||
$array_key.'_bank_label'=>$bank_account->label,
|
||||
$array_key.'_bank_number'=>$bank_account->number,
|
||||
$array_key.'_bank_proprio'=>$bank_account->proprio,
|
||||
|
||||
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
|
||||
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
|
||||
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
|
||||
$array_key.'_total_ht'=>price2num($object->total_ht),
|
||||
$array_key.'_total_vat'=>(!empty($object->total_vat) ?price2num($object->total_vat) : price2num($object->total_tva)),
|
||||
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
|
||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||
$array_key.'_total_ht'=>price2num($object->total_ht),
|
||||
$array_key.'_total_vat'=>(!empty($object->total_vat) ?price2num($object->total_vat) : price2num($object->total_tva)),
|
||||
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
|
||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||
|
||||
$array_key.'_multicurrency_code' => $object->multicurrency_code,
|
||||
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
|
||||
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
|
||||
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
|
||||
$array_key.'_multicurrency_total_ttc' => price2num($object->multicurrency_total_ttc),
|
||||
$array_key.'_multicurrency_total_ht_locale' => price($object->multicurrency_total_ht, 0, $outputlangs),
|
||||
$array_key.'_multicurrency_total_tva_locale' => price($object->multicurrency_total_tva, 0, $outputlangs),
|
||||
$array_key.'_multicurrency_total_ttc_locale' => price($object->multicurrency_total_ttc, 0, $outputlangs),
|
||||
$array_key.'_multicurrency_code' => $object->multicurrency_code,
|
||||
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
|
||||
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
|
||||
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
|
||||
$array_key.'_multicurrency_total_ttc' => price2num($object->multicurrency_total_ttc),
|
||||
$array_key.'_multicurrency_total_ht_locale' => price($object->multicurrency_total_ht, 0, $outputlangs),
|
||||
$array_key.'_multicurrency_total_tva_locale' => price($object->multicurrency_total_tva, 0, $outputlangs),
|
||||
$array_key.'_multicurrency_total_ttc_locale' => price($object->multicurrency_total_ttc, 0, $outputlangs),
|
||||
|
||||
$array_key.'_note_private'=>$object->note,
|
||||
$array_key.'_note_public'=>$object->note_public,
|
||||
$array_key.'_note'=>$object->note_public, // For backward compatibility
|
||||
$array_key.'_note_private'=>$object->note,
|
||||
$array_key.'_note_public'=>$object->note_public,
|
||||
$array_key.'_note'=>$object->note_public, // For backward compatibility
|
||||
|
||||
// Payments
|
||||
$array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs),
|
||||
$array_key.'_already_payed'=>price2num($sumpayed),
|
||||
$array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs),
|
||||
$array_key.'_already_deposit'=>price2num($sumdeposit),
|
||||
$array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
|
||||
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
|
||||
// Payments
|
||||
$array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs),
|
||||
$array_key.'_already_payed'=>price2num($sumpayed),
|
||||
$array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs),
|
||||
$array_key.'_already_deposit'=>price2num($sumdeposit),
|
||||
$array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
|
||||
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
|
||||
|
||||
$array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
|
||||
$array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
|
||||
|
||||
// Remain to pay with all know information (except open direct debit requests)
|
||||
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $remain_to_pay, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT')
|
||||
// Remain to pay with all known information (except open direct debit requests)
|
||||
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $already_payed_all, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $already_payed_all, 'MT')
|
||||
);
|
||||
|
||||
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
|
||||
|
||||
@ -1263,7 +1263,7 @@ abstract class CommonObject
|
||||
if ($source == 'external' || $source == 'thirdparty') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople t on ec.fk_socpeople = t.rowid";
|
||||
}
|
||||
$sql .= " WHERE ec.element_id =".$this->id;
|
||||
$sql .= " WHERE ec.element_id =".((int) $this->id);
|
||||
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
|
||||
$sql .= " AND tc.element='".$this->db->escape($this->element)."'";
|
||||
if ($code) {
|
||||
@ -1724,6 +1724,18 @@ abstract class CommonObject
|
||||
return 0;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load the project with id $this->fk_project into this->project
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
public function fetch_project()
|
||||
{
|
||||
// phpcs:enable
|
||||
return $this->fetch_projet();
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load the project with id $this->fk_project into this->project
|
||||
@ -3514,7 +3526,7 @@ abstract class CommonObject
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Now update global field total_ht, total_ttc and tva
|
||||
// Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
|
||||
$fieldht = 'total_ht';
|
||||
$fieldtva = 'tva';
|
||||
$fieldlocaltax1 = 'localtax1';
|
||||
@ -3557,6 +3569,7 @@ abstract class CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
@ -5284,7 +5297,7 @@ abstract class CommonObject
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keywords = ''; // keyword content
|
||||
$ecmfile->src_object_type = $this->table_element;
|
||||
$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
|
||||
$ecmfile->src_object_id = $this->id;
|
||||
|
||||
$result = $ecmfile->create($user);
|
||||
@ -6016,7 +6029,6 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$sql .= ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->lasterror();
|
||||
@ -6270,6 +6282,11 @@ abstract class CommonObject
|
||||
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
|
||||
}
|
||||
break;
|
||||
case 'boolean':
|
||||
if (empty($this->array_options["options_".$key])) {
|
||||
$this->array_options["options_".$key] = null;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case 'link':
|
||||
$param_list = array_keys($attributeParam['options']);
|
||||
@ -7284,7 +7301,11 @@ abstract class CommonObject
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
if ($classname && class_exists($classname)) {
|
||||
$object = new $classname($this->db);
|
||||
$object->fetch($value);
|
||||
if ($object->element === 'product') { // Special cas for product because default valut of fetch are wrong
|
||||
$object->fetch($value, '', '', '', 0, 1, 1);
|
||||
} else {
|
||||
$object->fetch($value);
|
||||
}
|
||||
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2);
|
||||
}
|
||||
} else {
|
||||
@ -9118,6 +9139,11 @@ abstract class CommonObject
|
||||
*/
|
||||
public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true)
|
||||
{
|
||||
// Handle single category
|
||||
if (!is_array($categories)) {
|
||||
$categories = array($categories);
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
@ -9127,11 +9153,6 @@ abstract class CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Handle single category
|
||||
if (!is_array($categories)) {
|
||||
$categories = array($categories);
|
||||
}
|
||||
|
||||
// Get current categories
|
||||
$c = new Categorie($this->db);
|
||||
$existing = $c->containing($this->id, $type_categ, 'id');
|
||||
|
||||
@ -2047,9 +2047,9 @@ class ExtraFields
|
||||
*
|
||||
* @param array $extralabels Deprecated (old $array of extrafields, now set this to null)
|
||||
* @param object $object Object
|
||||
* @param string $onlykey Only some keys are filled:$this
|
||||
* @param string $onlykey Only some keys are filled:
|
||||
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
|
||||
* '@GETPOSTISSET' => When we make update of extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
|
||||
* '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
|
||||
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
|
||||
*/
|
||||
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
|
||||
@ -2220,11 +2220,18 @@ class ExtraFields
|
||||
continue; // Value was not provided, we should not set it.
|
||||
}
|
||||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
|
||||
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
|
||||
$value_key = price2num($value_arr);
|
||||
} else {
|
||||
$value_key = $value_arr;
|
||||
}
|
||||
} elseif (in_array($key_type, array('boolean'))) {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
$value_key = '';
|
||||
} else {
|
||||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
$value_key = $value_arr;
|
||||
}
|
||||
} else {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
|
||||
@ -1675,11 +1675,6 @@ class Form
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
if ($htmlname != 'none' && !$options_only) {
|
||||
$out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
|
||||
}
|
||||
@ -1810,6 +1805,11 @@ class Form
|
||||
$out .= '</select>';
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
$this->num = $num;
|
||||
return $out;
|
||||
} else {
|
||||
@ -6769,13 +6769,15 @@ class Form
|
||||
|
||||
// Search data
|
||||
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
|
||||
if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $objecttmp->ismultientitymanaged);
|
||||
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0];
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (isset($objecttmp->ismultientitymanaged)) {
|
||||
if (!is_numeric($objecttmp->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $objecttmp->ismultientitymanaged);
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6786,17 +6788,24 @@ class Form
|
||||
$sql .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$sql .= " WHERE 1=1";
|
||||
if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) {
|
||||
$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
||||
}
|
||||
if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
|
||||
$sql .= ' AND parenttable.entity = t.'.$tmparray[0];
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
|
||||
if ($objecttmp->element == 'societe') {
|
||||
$sql .= " AND t.rowid = ".((int) $user->socid);
|
||||
} else {
|
||||
$sql .= " AND t.fk_soc = ".((int) $user->socid);
|
||||
if (isset($objecttmp->ismultientitymanaged)) {
|
||||
if ($objecttmp->ismultientitymanaged == 1) {
|
||||
$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
||||
}
|
||||
if (!is_numeric($objecttmp->ismultientitymanaged)) {
|
||||
$sql .= " AND parenttable.entity = t.".$tmparray[0];
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
|
||||
if ($objecttmp->element == 'societe') {
|
||||
$sql .= " AND t.rowid = ".((int) $user->socid);
|
||||
} else {
|
||||
$sql .= " AND t.fk_soc = ".((int) $user->socid);
|
||||
}
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($searchkey != '') {
|
||||
@ -8520,8 +8529,8 @@ class Form
|
||||
public function showFilterButtons()
|
||||
{
|
||||
$out = '<div class="nowraponall">';
|
||||
$out .= '<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
$out .= '<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
|
||||
$out .= '<button type="submit" class="liste_titre button_search reposition" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
$out .= '<button type="submit" class="liste_titre button_removefilter reposition" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
|
||||
$out .= '</div>';
|
||||
|
||||
return $out;
|
||||
|
||||
@ -309,7 +309,7 @@ class FormActions
|
||||
$tmpa = dol_getdate($actioncomm->datep);
|
||||
$tmpb = dol_getdate($actioncomm->datef);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
|
||||
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) {
|
||||
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes']) {
|
||||
print '-'.dol_print_date($actioncomm->datef, 'hour', 'tzuserrel');
|
||||
}
|
||||
} else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user