forked from Wavyzz/dolibarr
Merge branch 'Dolibarr:develop' into develop
This commit is contained in:
200
ChangeLog
200
ChangeLog
@@ -5,18 +5,185 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 15.0.0 compared to 14.0.0 *****
|
||||
|
||||
For users:
|
||||
---------------
|
||||
|
||||
NEW: Online proposal signature
|
||||
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
|
||||
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
|
||||
NEW: #18326 Workflow: Close order on shipment closing.
|
||||
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
|
||||
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
|
||||
NEW: #18689 REST API module: add api key generate / modify right.
|
||||
NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties.
|
||||
NEW: #18046 Add tags on ticket/categories
|
||||
NEW: #18326 Workflow: Close order on shipment closing.
|
||||
NEW: #18770 Can enter the buying price (for Weighted Average Price update) on lines during the reception step
|
||||
NEW: #18814 Add legal form for Sweden
|
||||
NEW: #18820 Accountancy - Add product account in import/export of thirdparty (level 3)
|
||||
NEW: Accountancy - Format FEC/FEC2 - Add column NumFacture
|
||||
NEW: Add $dolibarr_main_db_readonly in conf.php for readonly access.
|
||||
NEW: add auto creation of agenda event on supplier_order cancellation
|
||||
NEW: Add a PDF document template for Manufacturing Orders
|
||||
NEW: Add budget field into task #18986
|
||||
NEW: add cancel button to `classify reception` form on supplier_orders
|
||||
NEW: Added address field into contacts list
|
||||
NEW: Added documents page and send mail possibility in payments
|
||||
NEW: Add edit option in propal
|
||||
NEW: Added linked files page and send mail possibility in payments
|
||||
NEW: Add field date from/to in customer and supplier payment list
|
||||
NEW: Add filter from date to date into action/evt list
|
||||
NEW: Add import / export of MO and BOMLines - Close #18499
|
||||
NEW: Adding accounting export model for iSuite Expert
|
||||
NEW: add link to an element by ref
|
||||
NEW: add missing printFieldListFrom hook call on several lists
|
||||
NEW: add MRP into Object Linked Box
|
||||
NEW: Add option to hide customer code on PDF documents
|
||||
NEW: Add param $nolog to avoid logging into dol_delete_recursive_dir()
|
||||
NEW: Add sale representative in order and invoice list
|
||||
NEW: add a setting to create PDF in PDF/A - 1b format #18990
|
||||
NEW: Add `SOCIETE_SHOW_VAT_IN_LIST` to display VAT number in combo list of thirdparties
|
||||
NEW: Add sortorder on units list
|
||||
NEW: Adds PDF_HIDE_PRODUCT_LABEL_IN_SUPPLIER_LINES to hide product label in supplier order lines
|
||||
NEW: Add STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE to hide unit price on some pages
|
||||
NEW: add support for zstd compression
|
||||
NEW: Allow drag and drop on kits
|
||||
NEW: Allow exporting supplier order validation date + validation user
|
||||
NEW: Allows product ref generation after the form is validated with PRODUCT_GENERATE_REF_AFTER_FORM
|
||||
NEW: autocomplete account group when editing an account card
|
||||
NEW: Auto create invoice for payment done on an order with online payment link of order
|
||||
NEW: Can edit fields of proposal when proposal is not yet signed
|
||||
NEW: Can edit the translation key of an overwrote translation key.
|
||||
NEW: can enable/disable external calendar by default
|
||||
NEW: Can hide sender name on PDF documents
|
||||
NEW: Can select lot from a combo list of existing batch numbers (in MRP consumtion)
|
||||
NEW: Can set the default BOM on a product
|
||||
NEW: Can set/unset the usual working day of the week (friday, saturday, sunday)
|
||||
NEW: Can show progression of task into combo list of tasks
|
||||
NEW: can upload the odt file for the product doc template
|
||||
NEW: Contract - Add From/to input on search date
|
||||
NEW: Customer Display with TakePOS
|
||||
NEW: Split Sale in TakePOS
|
||||
NEW: Customer invoice template list - Add input date from/to
|
||||
NEW: date filter on project list and task list From->To
|
||||
NEW: display shipping method and tracking url on shipment list
|
||||
NEW: expense reports: conf to force amounts to be entered only including taxes
|
||||
NEW: expense reports: conf to pre-fill start/end dates with bounds of current month
|
||||
NEW: expense reports: show link to already existing overlapping expense report
|
||||
NEW: expense reports: can make project field mandatory on lines
|
||||
NEW: Expose bank account holder, label and number
|
||||
NEW: feature #18986
|
||||
NEW: field and behavior in product object
|
||||
NEW: generate intervention from time spent
|
||||
NEW: holiday: handle monthly balance updates with cronjob
|
||||
NEW: HRM integration, source code
|
||||
NEW: HRM admin - Add tabs
|
||||
NEW: HRM - Include more options to manage/custom dashboard
|
||||
NEW: Increase size of params of actions for emailcollector
|
||||
NEW: Invoice list - Use complete country select field with EEC or not
|
||||
NEW: mass action delete, no more break if at least one object has child
|
||||
NEW: mass action paid on customer invoice list
|
||||
NEW: massaction validate on supplier orders list
|
||||
NEW: Mass action send email to all attendees of an event.
|
||||
NEW: expense reports: conf to pre-fill start/end dates with bounds of current month
|
||||
NEW: Option "Add a link on the PDF to make the online payment"
|
||||
NEW: More options to generate PDF (show Frame option, width of picture option)
|
||||
NEW: Preview of pdf files of expense report lines
|
||||
NEW: print without details
|
||||
NEW: project time spent: conf to prevent recording time after X months
|
||||
NEW: rewrite bind accountancy code finding on customer and sales invoice
|
||||
NEW: Societe - Add perentity functionality on customer/supplier accountancy auxiliary account
|
||||
NEW: Survey - Add a clickable link in email send
|
||||
NEW: Social Contributions - Add from/to filter on list
|
||||
NEW: Supplier order and proposal - Add From/to input on search date
|
||||
NEW: Task - Add From/to input on search date
|
||||
NEW: Add theme option THEME_ELDY_USEBORDERONTABLE
|
||||
NEW: The Anti-CSRF protection MAIN_SECURITY_CSRF_WITH_TOKEN is on to value 1 by default
|
||||
NEW: Update SQL : install and migration
|
||||
NEW: Use an ajax call for the clicktodial feature instead of href link.
|
||||
NEW: when multiple order linked to facture, show list into note.
|
||||
NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted
|
||||
NEW: Editing a page in website module keep old page with name .back
|
||||
|
||||
|
||||
For developers:
|
||||
---------------
|
||||
|
||||
WARNING:
|
||||
NEW: Introduce method hasRight
|
||||
NEW: Can use textarea field into a confirm popup.
|
||||
NEW: Can use the result_mode of mysqli driver. Save memory for list count
|
||||
NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
|
||||
NEW: add action trigger for member excluded
|
||||
NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
|
||||
NEW: Add code codebar column on serial/lot structure
|
||||
NEW: Add date_valid and date_approve columns in the list of supplier orders
|
||||
NEW: add hook `beforeBodyClose`
|
||||
NEW: Add hook hookGetEntity.
|
||||
NEW: add hookmanager on note pages
|
||||
NEW: add hook 'menuLeftMenuItems' to filter the leftmenu items
|
||||
NEW: Add the property "copytoclipboard" in modulebuilder
|
||||
NEW: api for knowledgemanagement
|
||||
NEW: API get list of legal form of business
|
||||
NEW: API list of staff units
|
||||
NEW: hook after rank update
|
||||
NEW: printFieldListFrom hook call on several lists
|
||||
NEW: Use lang selector when using a field key 'lang' in modulebuilder
|
||||
NEW: we need to be able to put more filters on deleteByParentField() function
|
||||
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
|
||||
|
||||
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
|
||||
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
|
||||
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
|
||||
* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
|
||||
* Method getDictvalue has been renamed into getDictionaryValue to match camel case rule.
|
||||
|
||||
|
||||
|
||||
***** 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
|
||||
@@ -331,6 +498,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).
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"nnnick/chartjs" : "^2.9",
|
||||
"stripe/stripe-php" : "6.43.1",
|
||||
"maximebf/debugbar" : "1.15.1",
|
||||
"symfony/var-dumper" : "3"
|
||||
"symfony/var-dumper" : "3.2"
|
||||
},
|
||||
"require-dev" : {
|
||||
"php-parallel-lint/php-parallel-lint" : "^0",
|
||||
|
||||
4
composer.lock
generated
4
composer.lock
generated
@@ -591,7 +591,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v3.0.0",
|
||||
"version": "v3.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
@@ -616,7 +616,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
@@ -188,7 +188,10 @@ with:
|
||||
with
|
||||
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
|
||||
|
||||
|
||||
* Fix php fatal error on php 8.0 on tcpdi.php
|
||||
while (list($k, $v) = each($value[1])) {
|
||||
with
|
||||
foreach ($value[1] as $k => $v) {
|
||||
|
||||
JSGANTT:
|
||||
--------
|
||||
|
||||
@@ -51,14 +51,14 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
$permissiontoadd = $user->rights->accounting->chartofaccount;
|
||||
$permissiontodelete = $user->rights->accounting->chartofaccount;
|
||||
$permissiontoadd = !empty($user->rights->accounting->chartofaccount);
|
||||
$permissiontodelete = !empty($user->rights->accounting->chartofaccount);
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ $label = GETPOST('label', 'alpha');
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -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">';
|
||||
|
||||
@@ -41,7 +41,7 @@ $langs->loadLangs(array("companies", "compta", "accountancy", "products"));
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->bind->write) {
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ $search_type = GETPOST('search_type', 'int');
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 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
|
||||
@@ -738,10 +738,11 @@ class AccountingAccount extends CommonObject
|
||||
* @param Facture $facture Facture
|
||||
* @param FactureLigne $factureDet Facture Det
|
||||
* @param array $accountingAccount array of Account account
|
||||
* @param string $type Customer / Supplier
|
||||
*
|
||||
* @return array Accounting accounts suggested
|
||||
*/
|
||||
public function getAccountingCodeToBind(Societe $buyer, $seller, Product $product, Facture $facture, FactureLigne $factureDet, $accountingAccount = array())
|
||||
public function getAccountingCodeToBind(Societe $buyer, $seller, Product $product, Facture $facture, FactureLigne $factureDet, $accountingAccount = array(), $type = '')
|
||||
{
|
||||
global $conf;
|
||||
global $hookmanager;
|
||||
@@ -750,84 +751,116 @@ class AccountingAccount extends CommonObject
|
||||
$hookmanager->initHooks(array('accoutancyBindingCalculation'));
|
||||
|
||||
// Execute hook accoutancyBindingCalculation
|
||||
$parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount);
|
||||
$parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount, $type);
|
||||
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (empty($reshook)) {
|
||||
if ($type=='customer') {
|
||||
$const_name = "SOLD";
|
||||
} elseif ($type=='supplier') {
|
||||
$const_name = "BUY";
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
$isBuyerInEEC = isInEEC($buyer);
|
||||
$isSellerInEEC = isInEEC($seller);
|
||||
$code_sell_l = '';
|
||||
$code_sell_p = '';
|
||||
$code_sell_t = '';
|
||||
$code_l = '';
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = '';
|
||||
|
||||
// Level 1: Search suggested default account for product/service
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($factureDet->product_type == 1) {
|
||||
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($factureDet->product_type == 0) {
|
||||
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($code_sell_l == -1) {
|
||||
$code_sell_l = '';
|
||||
if ($code_l == -1) {
|
||||
$code_l = '';
|
||||
}
|
||||
|
||||
// Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code)) && !empty($product->accountancy_code_sell)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_sell_p = $product->accountancy_code_sell;
|
||||
if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code))) {
|
||||
// If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
}
|
||||
$suggestedid = $accountingAccount['dom'];
|
||||
$suggestedaccountingaccountfor = 'prodserv';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0 && !empty($product->accountancy_code_sell)) { // European intravat sale, but with VAT
|
||||
$code_sell_p = $product->accountancy_code_sell;
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) {
|
||||
// European intravat sale, but with VAT
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
}
|
||||
$suggestedid = $accountingAccount['dom'];
|
||||
$suggestedaccountingaccountfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra) && !empty($product->accountancy_code_sell)) { // European intravat sale, without VAT intra community number
|
||||
$code_sell_p = $product->accountancy_code_sell;
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) {
|
||||
// European intravat sale, without VAT intra community number
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
}
|
||||
$suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
|
||||
$suggestedaccountingaccountfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) { // European intravat sale
|
||||
$code_sell_p = $product->accountancy_code_sell_intra;
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) {
|
||||
// European intravat sale
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell_intra)) {
|
||||
$code_p = $product->accountancy_code_sell_intra;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy_intra)) {
|
||||
$code_p = $product->accountancy_code_buy_intra;
|
||||
}
|
||||
$suggestedid = $accountingAccount['intra'];
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} elseif (!empty($product->accountancy_code_sell_export)) { // Foreign sale
|
||||
$code_sell_p = $product->accountancy_code_sell_export;
|
||||
} else {
|
||||
// Foreign sale
|
||||
// European intravat sale
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell_export)) {
|
||||
$code_p = $product->accountancy_code_sell_export;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_sell_export)) {
|
||||
$code_p = $product->accountancy_code_sell_export;
|
||||
}
|
||||
$suggestedid = $accountingAccount['export'];
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
@@ -836,7 +869,7 @@ class AccountingAccount extends CommonObject
|
||||
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
if (!empty($buyer->code_compta)) {
|
||||
$code_sell_t = $buyer->code_compta;
|
||||
$code_t = $buyer->code_compta;
|
||||
$suggestedid = $accountingAccount['thirdparty'];
|
||||
$suggestedaccountingaccountfor = 'thridparty';
|
||||
}
|
||||
@@ -850,33 +883,33 @@ class AccountingAccount extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
$code_sell_l = $accountdeposittoventilated->ref;
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
|
||||
if (empty($suggestedid) && empty($code_sell_p) && !empty($code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
|
||||
if (empty($this->accountingaccount_codetotid_cache[$code_sell_l])) {
|
||||
if (empty($suggestedid) && empty($code_p) && !empty($code_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
|
||||
if (empty($this->accountingaccount_codetotid_cache[$code_l])) {
|
||||
$tmpaccount = new self($this->db);
|
||||
$result = $tmpaccount->fetch(0, $code_sell_l, 1);
|
||||
$result = $tmpaccount->fetch(0, $code_l, 1);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
if ($tmpaccount->id > 0) {
|
||||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$this->accountingaccount_codetotid_cache[$code_sell_l] = $tmpaccount->id;
|
||||
$this->accountingaccount_codetotid_cache[$code_l] = $tmpaccount->id;
|
||||
} else {
|
||||
$suggestedid = $this->accountingaccount_codetotid_cache[$code_sell_l];
|
||||
$suggestedid = $this->accountingaccount_codetotid_cache[$code_l];
|
||||
}
|
||||
}
|
||||
return array(
|
||||
'suggestedaccountingaccountbydefaultfor' => $suggestedaccountingaccountbydefaultfor,
|
||||
'suggestedaccountingaccountfor' => $suggestedaccountingaccountfor,
|
||||
'suggestedid' => $suggestedid,
|
||||
'code_sell_l' => $code_sell_l,
|
||||
'code_sell_p' => $code_sell_p,
|
||||
'code_sell_t' => $code_sell_t,
|
||||
'code_l' => $code_l,
|
||||
'code_p' => $code_p,
|
||||
'code_t' => $code_t,
|
||||
);
|
||||
} else {
|
||||
if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
|
||||
|
||||
@@ -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;
|
||||
@@ -1752,7 +1750,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;
|
||||
@@ -1817,7 +1814,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;
|
||||
|
||||
@@ -43,7 +43,7 @@ if (empty($conf->accounting->enabled)) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->bind->write) {
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -73,12 +73,23 @@ $action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'clean' || $action == 'validatehistory') {
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
@@ -165,6 +176,7 @@ if ($action == 'validatehistory') {
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
@@ -209,12 +221,11 @@ if ($action == 'validatehistory') {
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
$facture_static->date = $objp->datef;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@@ -223,7 +234,7 @@ if ($action == 'validatehistory') {
|
||||
$facture_static_det->product_type = $objp->type_l;
|
||||
$facture_static_det->desc = $objp->description;
|
||||
|
||||
$accoutinAccountArray = array(
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
@@ -232,7 +243,7 @@ if ($action == 'validatehistory') {
|
||||
$code_sell_p_notset = '';
|
||||
$code_sell_t_notset = '';
|
||||
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
|
||||
if (!is_array($return) && $return<0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
@@ -192,10 +192,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
|
||||
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
@@ -554,12 +554,11 @@ if ($result) {
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
$facture_static->date = $objp->datef;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@@ -568,7 +567,7 @@ if ($result) {
|
||||
$facture_static_det->product_type = $objp->type_l;
|
||||
$facture_static_det->desc = $objp->description;
|
||||
|
||||
$accoutinAccountArray = array(
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
@@ -577,7 +576,7 @@ if ($result) {
|
||||
$code_sell_p_notset = '';
|
||||
$code_sell_t_notset = '';
|
||||
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
|
||||
if (!is_array($return) && $return<0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
|
||||
@@ -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-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
@@ -40,10 +41,11 @@ if (empty($conf->accounting->enabled)) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->bind->write) {
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
@@ -97,6 +99,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (!$resql1) {
|
||||
@@ -163,7 +166,7 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
@@ -181,27 +184,74 @@ if ($action == 'validatehistory') {
|
||||
|
||||
$isBuyerInEEC = isInEEC($mysoc);
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$facture_static = new FactureFournisseur($db);
|
||||
$facture_static_det = new SupplierInvoiceLine($db);
|
||||
$product_static = new Product($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$isSellerInEEC = isInEEC($objp);
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta = $objp->company_code_sell;
|
||||
|
||||
// Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->status = $objp->status;
|
||||
$product_static->status_buy = $objp->status_buy;
|
||||
$product_static->accountancy_code_sell = $objp->code_sell;
|
||||
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
|
||||
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
$facture_static_det->tva_tx = $objp->tva_tx_line;
|
||||
$facture_static_det->vat_src_code = $objp->vat_src_code;
|
||||
$facture_static_det->product_type = $objp->type_l;
|
||||
$facture_static_det->desc = $objp->description;
|
||||
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
'thirdparty' =>$objp->aarowid_thirdparty);
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$code_buy_t_notset = '';
|
||||
|
||||
$return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'supplier');
|
||||
if (!is_array($return) && $return<0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
$suggestedid=$return['suggestedid'];
|
||||
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
|
||||
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
|
||||
$suggestedid=$return['suggestedid'];
|
||||
} else {
|
||||
$suggestedid=0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,8 +266,8 @@ if ($action == 'validatehistory') {
|
||||
|
||||
if ($objp->aarowid_suggest > 0) {
|
||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $objp->rowid);
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
|
||||
|
||||
$resqlupdate = $db->query($sqlupdate);
|
||||
if (!$resqlupdate) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
@@ -46,6 +46,7 @@ $massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
@@ -97,10 +98,7 @@ if (!$sortorder) {
|
||||
$hookmanager->initHooks(array('accountancysupplierlist'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
@@ -522,9 +520,9 @@ if ($result) {
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$facturefourn_static = new FactureFournisseur($db);
|
||||
$facturefourn_static_det = new SupplierInvoiceLine($db);
|
||||
$product_static = new Product($db);
|
||||
|
||||
$isBuyerInEEC = isInEEC($mysoc);
|
||||
|
||||
$accountingaccount_codetotid_cache = array();
|
||||
|
||||
@@ -547,6 +545,8 @@ if ($result) {
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->company_code_buy;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
@@ -560,95 +560,63 @@ if ($result) {
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facturefourn_static->ref = $objp->ref;
|
||||
$facturefourn_static->id = $objp->facid;
|
||||
$facturefourn_static->type = $objp->ftype;
|
||||
$facturefourn_static->label = $objp->invoice_label;
|
||||
|
||||
$facturefourn_static_det->id = $objp->rowid;
|
||||
$facturefourn_static_det->total_ht = $objp->total_ht;
|
||||
$facturefourn_static_det->tva_tx_line = $objp->tva_tx_line;
|
||||
$facturefourn_static_det->vat_src_code = $objp->vat_src_code;
|
||||
$facturefourn_static_det->product_type = $objp->type_l;
|
||||
$facturefourn_static_det->desc = $objp->description;
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$code_buy_t_notset = '';
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
|
||||
$isSellerInEEC = isInEEC($objp);
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
'thirdparty' =>$objp->aarowid_thirdparty);
|
||||
|
||||
// Level 1: Search suggested default account for product/service
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($objp->type_l == 1) {
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($objp->type_l == 0) {
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objp->code_sell_l == -1) {
|
||||
$objp->code_sell_l = '';
|
||||
}
|
||||
$code_buy_p_notset = '';
|
||||
$code_buy_t_notset = '';
|
||||
|
||||
// Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
$return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier');
|
||||
if (!is_array($return) && $return<0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
$suggestedid=$return['suggestedid'];
|
||||
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
|
||||
$suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
|
||||
$code_buy_l=$return['code_buy_l'];
|
||||
$code_buy_p=$return['code_buy_p'];
|
||||
$code_buy_t=$return['code_buy_t'];
|
||||
}
|
||||
//var_dump($return);
|
||||
|
||||
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
if (!empty($objp->company_code_buy)) {
|
||||
$objp->code_buy_t = $objp->company_code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($objp->code_buy_p)) {
|
||||
if (!empty($code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) {
|
||||
if (empty($code_buy_l) && empty($code_buy_p)) {
|
||||
$code_buy_p_notset = 'color:red';
|
||||
}
|
||||
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_t is now code of thirdparty
|
||||
// $code_buy_l is now default code of product/service
|
||||
// $code_buy_p is now code of product/service
|
||||
// $code_buy_t is now code of thirdparty
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Line id
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
print '<td>'.$facturefourn_static_det->id.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
||||
@@ -658,23 +626,23 @@ if ($result) {
|
||||
print '</td>';
|
||||
*/
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($facturefourn_static_det->datef), 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td class="tdoverflowmax150">';
|
||||
if ($product_static->id > 0) {
|
||||
print $product_static->getNomUrl(1);
|
||||
}
|
||||
if ($objp->product_label) {
|
||||
print '<br><span class="opacitymedium small">'.$objp->product_label.'</span>';
|
||||
if ($product_static->product_label) {
|
||||
print '<br><span class="opacitymedium small">'.$product_static->product_label.'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
@@ -686,7 +654,7 @@ if ($result) {
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
}
|
||||
print '<td style="'.$code_vat_differ.'" class="right">';
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : ''));
|
||||
print vatrate($facturefourn_static_det->tva_tx_line.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
|
||||
print '</td>';
|
||||
|
||||
// Thirdparty
|
||||
@@ -703,26 +671,26 @@ if ($result) {
|
||||
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$s = '1. '.(($facturefourn_static_det->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
|
||||
$shelp .= $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
$s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
if ($objp->product_id > 0) {
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = '';
|
||||
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountfor == 'export') {
|
||||
$shelp = $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= (empty($objp->code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_buy_p));
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
$s .= (empty($code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($code_buy_p));
|
||||
print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
|
||||
} else {
|
||||
print '<br>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
@@ -732,35 +700,26 @@ if ($result) {
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
print '<br>';
|
||||
$s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
|
||||
$s = '3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
|
||||
$shelp = '';
|
||||
$s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
$s .= ($code_buy_t > 0 ? length_accountg($code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
$suggestedid = $objp->aarowid_suggest;
|
||||
if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
|
||||
if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l])) {
|
||||
$tmpaccount = new AccountingAccount($db);
|
||||
$tmpaccount->fetch(0, $objp->code_buy_l, 1);
|
||||
if ($tmpaccount->id > 0) {
|
||||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
|
||||
} else {
|
||||
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
|
||||
}
|
||||
}
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
print '<td class="center">';
|
||||
$ischecked = $objp->aarowid_suggest;
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="'.$objp->rowid."_".$i.'"'.($ischecked ? "checked" : "").'/>';
|
||||
if (!empty($suggestedid)) {
|
||||
$ischecked = 1;
|
||||
} else {
|
||||
$ischecked = 0;
|
||||
}
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? "checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@@ -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";
|
||||
*/
|
||||
|
||||
|
||||
@@ -928,20 +928,20 @@ 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'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
$soc = new Societe($db);
|
||||
if (!empty($socid)) {
|
||||
$object = 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;
|
||||
@@ -1024,7 +1024,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>';
|
||||
@@ -1048,7 +1048,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? '<span class="fieldrequired">' : '').$langs->trans("EMail").(!empty($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>';
|
||||
@@ -1056,21 +1056,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);
|
||||
}
|
||||
@@ -1079,9 +1083,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;
|
||||
}
|
||||
@@ -1090,7 +1094,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>';
|
||||
@@ -2012,7 +2016,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Generated documents
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
//$filename = 'tmp_cards.php';
|
||||
$filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed = $user->rights->adherent->lire;
|
||||
@@ -2046,14 +2049,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
$MAX = 10;
|
||||
|
||||
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id.'">';
|
||||
$morehtmlright .= $langs->trans("SeeAll");
|
||||
$morehtmlright .= '</a>';
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlright);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlcenter);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ $day = dol_print_date($now, '%d');
|
||||
$foruserid = GETPOST('foruserid', 'alphanohtml');
|
||||
$foruserlogin = GETPOST('foruserlogin', 'alphanohtml');
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
$modelcard = GETPOST("modelcard", 'aZ09'); // Doc template to use for business cards
|
||||
$model = GETPOST("model", 'aZ09'); // Doc template to use for business cards
|
||||
$modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet
|
||||
$mesg = '';
|
||||
@@ -84,10 +85,10 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if (is_numeric($foruserid)) {
|
||||
$sql .= " AND d.rowid=".(int) $foruserid;
|
||||
$sql .= " AND d.rowid = ".(int) $foruserid;
|
||||
}
|
||||
if ($foruserlogin) {
|
||||
$sql .= " AND d.login='".$db->escape($foruserlogin)."'";
|
||||
$sql .= " AND d.login = '".$db->escape($foruserlogin)."'";
|
||||
}
|
||||
$sql .= " ORDER BY d.rowid ASC";
|
||||
|
||||
@@ -143,7 +144,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
'__MONTH__'=>$month,
|
||||
'__DAY__'=>$day,
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
'__SERVER__'=>"https://".$_SERVER["SERVER_NAME"]."/"
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||
|
||||
@@ -155,7 +156,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
|
||||
|
||||
if (is_numeric($foruserid) || $foruserlogin) {
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; // $_Avery_Labels is defined into an include
|
||||
if ($nb <= 0) {
|
||||
$nb = 1; // Protection to avoid empty page
|
||||
}
|
||||
@@ -209,7 +210,19 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
}
|
||||
|
||||
// Build and output PDF
|
||||
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
|
||||
$outputlangs = $langs;
|
||||
|
||||
if (empty($mode) || $mode == 'card') {
|
||||
if (!count($arrayofmembers)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
if (empty($modelcard) || $modelcard == '-1') {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
|
||||
}
|
||||
if (!$mesg) {
|
||||
$result = members_card_pdf_create($db, $arrayofmembers, $modelcard, $outputlangs, '', 'standard', 'tmp_cards');
|
||||
}
|
||||
} elseif ($mode == 'cardlogin') {
|
||||
if (!count($arrayofmembers)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
@@ -217,7 +230,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
|
||||
}
|
||||
if (!$mesg) {
|
||||
$result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
|
||||
$result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs, '', 'standard', 'tmp_cards_login');
|
||||
}
|
||||
} elseif ($mode == 'label') {
|
||||
if (!count($arrayofmembers)) {
|
||||
@@ -275,7 +288,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ? GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">';
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -2338,12 +2338,12 @@ class Adherent extends CommonObject
|
||||
}
|
||||
} elseif ($status == self::STATUS_RESILIATED) {
|
||||
$statusType = 'status6';
|
||||
$labelStatus = $langs->trans("MemberStatusResiliated");
|
||||
$labelStatusShort = $langs->trans("MemberStatusResiliatedShort");
|
||||
$labelStatus = $langs->transnoentitiesnoconv("MemberStatusResiliated");
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv("MemberStatusResiliatedShort");
|
||||
} elseif ($status == self::STATUS_EXCLUDED) {
|
||||
$statusType = 'status10';
|
||||
$labelStatus = $langs->trans("MemberStatusExcluded");
|
||||
$labelStatusShort = $langs->trans("MemberStatusExcludedShort");
|
||||
$labelStatus = $langs->transnoentitiesnoconv("MemberStatusExcluded");
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv("MemberStatusExcludedShort");
|
||||
}
|
||||
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
|
||||
@@ -737,10 +737,10 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
|
||||
$this->labelStatus[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatus[1] = $langs->trans("InActivity");
|
||||
$this->labelStatusShort[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatusShort[1] = $langs->trans("InActivity");
|
||||
$this->labelStatus[0] = $langs->transnoentitiesnoconv("ActivityCeased");
|
||||
$this->labelStatus[1] = $langs->transnoentitiesnoconv("InActivity");
|
||||
$this->labelStatusShort[0] = $langs->transnoentitiesnoconv("ActivityCeased");
|
||||
$this->labelStatusShort[1] = $langs->transnoentitiesnoconv("InActivity");
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
|
||||
@@ -70,7 +70,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$this->where .= " m.statut != -1";
|
||||
$this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
if ($this->memberid) {
|
||||
$this->where .= " AND m.rowid = ".((int) $this->memberid);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -111,7 +111,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
@@ -132,7 +132,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -153,7 +153,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -174,7 +174,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
@@ -36,7 +36,7 @@ $sortorder = GETPOST('sortorder', 'aZ09');
|
||||
if (empty($conf->adherent->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->adherent->export) {
|
||||
if (empty($user->rights->adherent->export)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -962,7 +962,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) {
|
||||
|
||||
@@ -161,40 +161,40 @@ if ($mode) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($mode == 'memberbycountry') {
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'code'=>$obj->code,
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'code'=>$obj->code,
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbyregion') { //+
|
||||
$data[] = array(
|
||||
'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
|
||||
'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label :'<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbystate') {
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbytown') {
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -963,7 +963,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>';
|
||||
|
||||
@@ -48,7 +48,7 @@ $note = GETPOST('note', 'alpha');
|
||||
$typeid = (int) GETPOST('typeid', 'int');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (!$user->rights->adherent->cotisation->lire) {
|
||||
if (empty($user->rights->adherent->cotisation->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "members", "bills", "users"));
|
||||
|
||||
if (!$user->rights->adherent->lire) {
|
||||
if (empty($user->rights->adherent->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
|
||||
@@ -35,7 +35,7 @@ $total = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
echo '<tr class="oddeven">';
|
||||
echo '<td>'.$langs->trans("Subscription").'</td>';
|
||||
echo '<td>'.$objectlink->getNomUrl(1).'</td>';
|
||||
echo '<td class="nowraponall">'.$objectlink->getNomUrl(1).'</td>';
|
||||
echo '<td class="center"></td>';
|
||||
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
|
||||
echo '<td class="right">';
|
||||
|
||||
@@ -94,7 +94,7 @@ $formcompany = new FormCompany($db);
|
||||
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</span>';
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountantDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
/**
|
||||
* Edit parameters
|
||||
@@ -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>';
|
||||
|
||||
@@ -378,7 +378,7 @@ $head = company_admin_prepare_head();
|
||||
print dol_get_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
/**
|
||||
@@ -457,7 +457,7 @@ print '</td></tr>'."\n";
|
||||
// Email
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input class="maxwidth150" name="mail" id="email" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
|
||||
print '<input class="width300" name="mail" id="email" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -133,7 +131,6 @@ foreach ($listofnetworks as $key => $value) {
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ if ($result) {
|
||||
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>'.$obj->name.'</td>'."\n";
|
||||
print '<tr class="oddeven" data-checkbox-id="check_'.$i.'"><td>'.$obj->name.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
@@ -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";
|
||||
@@ -232,8 +232,8 @@ $tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_h
|
||||
$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
$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[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$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";
|
||||
@@ -278,7 +278,7 @@ $tabsqlsort[33] = "code ASC";
|
||||
$tabsqlsort[34] = "code ASC";
|
||||
$tabsqlsort[35] = "c.label ASC";
|
||||
$tabsqlsort[36] = "r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
$tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||
$tabsqlsort[37] = "sortorder ASC";
|
||||
$tabsqlsort[38] = "rowid, code ASC";
|
||||
$tabsqlsort[39] = "sortorder ASC";
|
||||
$tabsqlsort[40] = "code ASC";
|
||||
@@ -324,7 +324,7 @@ $tabfield[33] = "code,label";
|
||||
$tabfield[34] = "code,label";
|
||||
$tabfield[35] = "label";
|
||||
$tabfield[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfield[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfield[37] = "code,label,short_label,unit_type,scale,sortorder";
|
||||
$tabfield[38] = "code,label,url,icon,entity";
|
||||
$tabfield[39] = "code,libelle,sortorder";
|
||||
$tabfield[40] = "code,libelle,picto";
|
||||
@@ -370,7 +370,7 @@ $tabfieldvalue[33] = "code,label";
|
||||
$tabfieldvalue[34] = "code,label";
|
||||
$tabfieldvalue[35] = "label";
|
||||
$tabfieldvalue[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale,sortorder";
|
||||
$tabfieldvalue[38] = "code,label,url,icon";
|
||||
$tabfieldvalue[39] = "code,libelle,sortorder";
|
||||
$tabfieldvalue[40] = "code,libelle,picto";
|
||||
@@ -417,7 +417,7 @@ $tabfieldinsert[33] = "code,label";
|
||||
$tabfieldinsert[34] = "code,label";
|
||||
$tabfieldinsert[35] = "label";
|
||||
$tabfieldinsert[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale,sortorder";
|
||||
$tabfieldinsert[38] = "code,label,url,icon,entity";
|
||||
$tabfieldinsert[39] = "code,label,sortorder";
|
||||
$tabfieldinsert[40] = "code,libelle,picto";
|
||||
@@ -1457,6 +1457,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')) {
|
||||
@@ -1476,9 +1480,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');
|
||||
@@ -1973,7 +1974,7 @@ if ($id) {
|
||||
}
|
||||
}
|
||||
} elseif ($value == 'fk_c_exp_tax_cat') {
|
||||
$valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
|
||||
$valuetoshow = getDictionaryValue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
} elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat') {
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
|
||||
@@ -530,7 +530,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,8 @@ $head = security_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'audit', '', -1);
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print getTitleFieldOfList("LogEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n";
|
||||
|
||||
@@ -257,11 +257,12 @@ foreach ($rules as $rule) {
|
||||
if ($rule->fk_c_type_fees == -1) {
|
||||
echo $langs->trans('AllExpenseReport');
|
||||
} else {
|
||||
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||
if ($key != $langs->trans($key)) {
|
||||
$key = getDictionaryValue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||
if ($key && $key != $langs->trans($key)) {
|
||||
echo $langs->trans($key);
|
||||
} else {
|
||||
echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
|
||||
$value = getDictionaryValue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
|
||||
echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file hrm/admin/setup.php
|
||||
* \file htdocs/admin/hrm.php
|
||||
* \ingroup hrm
|
||||
* \brief HrmTest setup page.
|
||||
*/
|
||||
|
||||
@@ -299,6 +299,8 @@ $head = ihm_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, $mode, '', -1, '');
|
||||
|
||||
print '<br>';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if ($mode == 'template') {
|
||||
@@ -451,11 +453,11 @@ if ($mode == 'other') {
|
||||
print '</table>' . "\n";
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Other
|
||||
@@ -577,9 +579,9 @@ if ($mode == 'login') {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
|
||||
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmax45">';
|
||||
print $langs->trans("Parameter");
|
||||
print '</td><td class="titlefieldmiddle">';
|
||||
print '</td><td>';
|
||||
print $langs->trans("Value");
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -630,7 +632,6 @@ if ($mode == 'login') {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
|
||||
print '</div>';
|
||||
|
||||
@@ -83,7 +83,8 @@ if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INF
|
||||
$setupcompanynotcomplete = 1;
|
||||
}
|
||||
print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
|
||||
print '<br><br>'.$langs->trans("SetupDescription3b");
|
||||
print '<br><br>';
|
||||
print $langs->trans("SetupDescription3b");
|
||||
if (!empty($setupcompanynotcomplete)) {
|
||||
$langs->load("errors");
|
||||
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
|
||||
@@ -92,6 +93,7 @@ if (!empty($setupcompanynotcomplete)) {
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Show info setup module
|
||||
print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
|
||||
|
||||
@@ -292,7 +292,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
clearstatcache();
|
||||
@@ -543,7 +543,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@@ -243,7 +243,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_emailing', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
clearstatcache();
|
||||
@@ -412,7 +412,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_emailing', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@@ -597,7 +597,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
|
||||
@@ -894,7 +894,7 @@ if ($resql) {
|
||||
$valuetoshow = $langs->trans("Content"); $showfield = 0;
|
||||
}
|
||||
if ($fieldlist[$field] == 'content_lines') {
|
||||
$valuetoshow = $langs->trans("ContentLines"); $showfield = 0;
|
||||
$valuetoshow = $langs->trans("ContentForLines"); $showfield = 0;
|
||||
}
|
||||
|
||||
// Show fields
|
||||
@@ -973,6 +973,14 @@ if ($resql) {
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
if ($tmpfieldlist == 'content_lines') {
|
||||
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
@@ -1114,35 +1122,6 @@ if ($resql) {
|
||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
/*
|
||||
$fieldsforcontent = array('content');
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||
{
|
||||
$fieldsforcontent = array('content', 'content_lines');
|
||||
}
|
||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
{
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$valuetoshow = $obj->{$tmpfieldlist};
|
||||
|
||||
$class = 'tddict';
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
|
||||
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$i.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$i, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%', 1);
|
||||
print $doleditor->Create(1);
|
||||
print '</td>';
|
||||
print '<td></td><td></td><td></td>';
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_ticket', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
clearstatcache();
|
||||
@@ -387,7 +387,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_ticket', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@@ -81,7 +81,7 @@ $head = company_admin_prepare_head();
|
||||
print dol_get_fiche_head($head, 'openinghours', $langs->trans("Company"), -1, 'company');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("OpeningHoursDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
if (empty($action) || $action == 'edit' || $action == 'updateedit') {
|
||||
/**
|
||||
@@ -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"));
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021 Anthony Berton <bertonanthony@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -165,6 +166,10 @@ if ($action == 'update') {
|
||||
dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('PDF_USE_A')) {
|
||||
dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
@@ -534,6 +539,14 @@ if ($conf->use_javascript_ajax) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_A").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('PDF_USE_A');
|
||||
} else {
|
||||
print $form->selectyesno('PDF_USE_A', (empty($conf->global->PDF_USE_A) ? 0 : $conf->global->PDF_USE_A), 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@@ -41,17 +41,12 @@ if (!$user->admin) {
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'update') {
|
||||
if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) {
|
||||
dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
|
||||
@@ -62,6 +57,9 @@ if ($action == 'update') {
|
||||
if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
|
||||
dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
@@ -92,45 +90,47 @@ $tooltiptext = '';
|
||||
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("Proposal"), '', '');
|
||||
if (!empty($conf->propal->enabled)) {
|
||||
print load_fiche_titre($langs->trans("Proposal"), '', '');
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE");
|
||||
print ' <span class="opacitymedium">('.$langs->trans("RandomlySelectedIfSeveral").')</span>';
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE");
|
||||
print ' <span class="opacitymedium">('.$langs->trans("RandomlySelectedIfSeveral").')</span>';
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
/*
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
/*
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
print $form->buttonsSaveCancel();
|
||||
*/
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ $head = security_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'proxy', '', -1);
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
|
||||
@@ -188,8 +188,9 @@ $head = security_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'passwords', '', -1);
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Choix du gestionnaire du generateur de mot de passe
|
||||
// Select manager to generate passwords
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
@@ -101,9 +101,9 @@ $head = security_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'file', '', -1);
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Upload options
|
||||
$var = false;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
@@ -153,8 +153,8 @@ if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
|
||||
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
print '<input type="text" '.(defined('MAIN_ANTIVIRUS_COMMAND') ? 'disabled ' : '').'name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">';
|
||||
if (defined('MAIN_ANTIVIRUS_COMMAND')) {
|
||||
print '<input type="text" '.((defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) ? 'disabled ' : '').'name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">';
|
||||
if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
@@ -94,6 +94,7 @@ $head = security_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'misc', '', -1);
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Other Options
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@@ -644,7 +644,7 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MainDefaultWarehouse").'</td>';
|
||||
print '<td class="right">';
|
||||
print $formproduct->selectWarehouses($conf->global->MAIN_DEFAULT_WAREHOUSE, 'default_warehouse', '', 1, 0, 0, '', 0, 0, array(), 'left reposition');
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-edit small" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').
|
||||
print yn(empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? 0 : 1);
|
||||
if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
|
||||
print ' - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;
|
||||
if (defined('MAIN_ANTIVIRUS_COMMAND')) {
|
||||
if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
|
||||
print ' - <span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006-2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -441,6 +441,11 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
'id' => 'radio_compression_bzip',
|
||||
'label' => $langs->trans("Bzip2")
|
||||
);
|
||||
$compression['zstd'] = array(
|
||||
'function' => 'zstd_compress',
|
||||
'id' => 'radio_compression_zstd',
|
||||
'label' => $langs->trans("Zstd")
|
||||
);
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
|
||||
@@ -2,20 +2,21 @@
|
||||
/* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/tools/export.php
|
||||
|
||||
@@ -2,20 +2,21 @@
|
||||
/* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/tools/export_files.php
|
||||
@@ -41,7 +42,7 @@ $file = trim(GETPOST('zipfilename_template', 'alpha'));
|
||||
$compression = GETPOST('compression', 'aZ09');
|
||||
|
||||
$file = dol_sanitizeFileName($file);
|
||||
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);
|
||||
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2|\.zst)$/i', '', $file);
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
@@ -137,7 +138,7 @@ if ($compression == 'zip') {
|
||||
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
|
||||
}
|
||||
}
|
||||
} elseif (in_array($compression, array('gz', 'bz'))) {
|
||||
} elseif (in_array($compression, array('gz', 'bz', 'zstd'))) {
|
||||
$userlogin = ($user->login ? $user->login : 'unknown');
|
||||
|
||||
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
|
||||
@@ -156,9 +157,10 @@ if ($compression == 'zip') {
|
||||
} else {
|
||||
if ($compression == 'gz') {
|
||||
$cmd = "gzip -f ".$outputdir."/".$file;
|
||||
}
|
||||
if ($compression == 'bz') {
|
||||
} elseif ($compression == 'bz') {
|
||||
$cmd = "bzip2 -f ".$outputdir."/".$file;
|
||||
} elseif ($compression == 'zstd') {
|
||||
$cmd = "zstd -z -9 -q --rm ".$outputdir."/".$file;
|
||||
}
|
||||
|
||||
$result = $utils->executeCLI($cmd, $outputfile);
|
||||
|
||||
@@ -458,7 +458,7 @@ if ($mode == 'searchkey') {
|
||||
}
|
||||
|
||||
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
||||
$title = $langs->trans("TranslationKeySearch");
|
||||
$title = $langs->trans("Translation");
|
||||
if ($nbtotalofrecords > 0) {
|
||||
$title .= ' <span class="opacitymedium colorblack paddingleft">('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')</span>';
|
||||
}
|
||||
|
||||
@@ -390,11 +390,11 @@ class Asset extends CommonObject
|
||||
|
||||
$langs->load("contracts");
|
||||
$labelStatus = array();
|
||||
$labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Disabled');
|
||||
$labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
|
||||
$labelStatusShort = array();
|
||||
$labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Disabled');
|
||||
$labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
|
||||
|
||||
$statusType = 'status0';
|
||||
if ($status == self::STATUS_VALIDATED) {
|
||||
|
||||
@@ -523,7 +523,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,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";
|
||||
|
||||
@@ -655,7 +655,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
|
||||
global $user, $db;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
@@ -154,9 +154,9 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewBookmark"));
|
||||
print load_fiche_titre($langs->trans("NewBookmark"), '', 'bookmark');
|
||||
|
||||
print dol_get_fiche_head($head, $hselected, $langs->trans("Bookmark"), -1, 'bookmark');
|
||||
print dol_get_fiche_head(null, 'bookmark', '', 0, '');
|
||||
|
||||
print '<table class="border centpercent tableforfieldcreate">';
|
||||
|
||||
@@ -164,23 +164,23 @@ if ($action == 'create') {
|
||||
dol_set_focus('#titlebookmark');
|
||||
|
||||
// Url
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.dol_escape_htmltag($url).'"></td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</span></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent minwidth500" name="url" value="'.dol_escape_htmltag($url).'"></td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</span></td></tr>';
|
||||
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
|
||||
$liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow"));
|
||||
print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1);
|
||||
print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||
print '</td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</span></td></tr>';
|
||||
|
||||
// Owner
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 0, '', 0, ($user->admin ? '' : array($user->id)), '', 0, 0, 0, '', ($user->admin) ? 1 : 0, '', 'maxwidth300');
|
||||
print '</td><td class="hideonsmartphone"> </td></tr>';
|
||||
print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 0, '', 0, ($user->admin ? '' : array($user->id)), '', 0, 0, 0, '', ($user->admin) ? 1 : 0, '', 'maxwidth300 widthcentpercentminusx');
|
||||
print '</td><td class="hideonsmartphone"></td></tr>';
|
||||
|
||||
// Position
|
||||
print '<tr><td>'.$langs->trans("Position").'</td><td>';
|
||||
print '<input class="flat" name="position" size="5" value="'.(GETPOSTISSET("position") ? GETPOST("position", 'int') : $object->position).'">';
|
||||
print '</td><td class="hideonsmartphone"> </td></tr>';
|
||||
print '<input class="flat width50" name="position" value="'.(GETPOSTISSET("position") ? GETPOST("position", 'int') : $object->position).'">';
|
||||
print '</td><td class="hideonsmartphone"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -626,12 +626,18 @@ class Categorie extends CommonObject
|
||||
}
|
||||
|
||||
$arraydelete = array(
|
||||
'categorie_societe' => 'fk_categorie',
|
||||
'categorie_fournisseur' => 'fk_categorie',
|
||||
'categorie_product' => 'fk_categorie',
|
||||
'categorie_fournisseur' => 'fk_categorie',
|
||||
'categorie_societe' => 'fk_categorie',
|
||||
'categorie_member' => 'fk_categorie',
|
||||
'categorie_contact' => 'fk_categorie',
|
||||
'categorie_user' => 'fk_categorie',
|
||||
'categorie_project' => 'fk_categorie',
|
||||
'categorie_account' => 'fk_categorie',
|
||||
'categorie_website_page' => 'fk_categorie',
|
||||
'categorie_warehouse' => 'fk_categorie',
|
||||
'categorie_actioncomm' => 'fk_categorie',
|
||||
'categorie_ticket' => 'fk_categorie',
|
||||
'bank_class' => 'fk_categ',
|
||||
'categorie_lang' => 'fk_category',
|
||||
'categorie' => 'rowid',
|
||||
@@ -728,8 +734,6 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Call trigger
|
||||
$this->context = array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger
|
||||
$result = $this->call_trigger('CATEGORY_LINK', $user);
|
||||
@@ -755,6 +759,8 @@ class Categorie extends CommonObject
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@@ -810,6 +816,8 @@ class Categorie extends CommonObject
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -199,7 +199,7 @@ if ($elemid && $action == 'addintocategory' &&
|
||||
if ($result >= 0) {
|
||||
setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
|
||||
} else {
|
||||
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@@ -770,7 +770,7 @@ if ($type == Categorie::TYPE_CONTACT) {
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Ref").'</td></tr>'."\n";
|
||||
|
||||
if (count($contacts) > 0) {
|
||||
if (is_array($contacts) && count($contacts) > 0) {
|
||||
$i = 0;
|
||||
foreach ($contacts as $key => $contact) {
|
||||
$i++;
|
||||
|
||||
@@ -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');
|
||||
@@ -1298,7 +1303,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>';
|
||||
|
||||
@@ -1327,7 +1327,7 @@ class ActionComm extends CommonObject
|
||||
$sql = "SELECT count(a.id) as nb";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read) {
|
||||
@@ -1339,7 +1339,7 @@ class ActionComm extends CommonObject
|
||||
$sql .= " AND a.percent >= 0 AND a.percent < 100";
|
||||
}
|
||||
$sql .= " AND a.entity IN (".getEntity('agenda').")";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
|
||||
}
|
||||
if ($user->socid) {
|
||||
@@ -1465,18 +1465,18 @@ class ActionComm extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$labelStatus = $langs->trans('StatusNotApplicable');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusNotApplicable');
|
||||
if ($percent == -1 && !$hidenastatus) {
|
||||
$labelStatus = $langs->trans('StatusNotApplicable');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusNotApplicable');
|
||||
} elseif ($percent == 0) {
|
||||
$labelStatus = $langs->trans('StatusActionToDo').' (0%)';
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusActionToDo').' (0%)';
|
||||
} elseif ($percent > 0 && $percent < 100) {
|
||||
$labelStatus = $langs->trans('StatusActionInProcess').' ('.$percent.'%)';
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusActionInProcess').' ('.$percent.'%)';
|
||||
} elseif ($percent >= 100) {
|
||||
$labelStatus = $langs->trans('StatusActionDone').' (100%)';
|
||||
$labelStatus = $langs->transnoentitiesnoconv('StatusActionDone').' (100%)';
|
||||
}
|
||||
|
||||
$labelStatusShort = $langs->trans('StatusNotApplicable');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('StatusNotApplicable');
|
||||
if ($percent == -1 && !$hidenastatus) {
|
||||
$labelStatusShort = $langs->trans('NA');
|
||||
} elseif ($percent == 0) {
|
||||
|
||||
@@ -228,18 +228,18 @@ class ActionCommReminder extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$labelStatus = $langs->trans('ToDo');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('ToDo');
|
||||
if ($status == 1) {
|
||||
$labelStatus = $langs->trans('Done');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('Done');
|
||||
} elseif ($status == -1) {
|
||||
$labelStatus = $langs->trans('Error');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('Error');
|
||||
}
|
||||
|
||||
$labelStatusShort = $langs->trans('ToDo');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('ToDo');
|
||||
if ($status == 1) {
|
||||
$labelStatus = $langs->trans('Done');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('Done');
|
||||
} elseif ($status == -1) {
|
||||
$labelStatus = $langs->trans('Error');
|
||||
$labelStatus = $langs->transnoentitiesnoconv('Error');
|
||||
}
|
||||
|
||||
$statusType = 'status5';
|
||||
|
||||
@@ -490,7 +490,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>';
|
||||
|
||||
@@ -660,7 +660,7 @@ $sql .= ' a.fk_soc, a.fk_contact, a.fk_project,';
|
||||
$sql .= ' a.fk_element, a.elementtype,';
|
||||
$sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
}
|
||||
// We must filter on resource table
|
||||
@@ -711,7 +711,7 @@ if ($resourceid > 0) {
|
||||
if ($pid) {
|
||||
$sql .= " AND a.fk_project=".((int) $pid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
|
||||
@@ -414,7 +414,7 @@ $sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object)";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
@@ -468,7 +468,7 @@ if ($resourceid > 0) {
|
||||
if ($pid) {
|
||||
$sql .= " AND a.fk_project=".((int) $pid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
@@ -625,22 +625,6 @@ print $nav;
|
||||
//print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
|
||||
//print dol_get_fiche_end();
|
||||
|
||||
// Add link to show birthdays
|
||||
/*
|
||||
$link = '';
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$newparam=$param; // newparam is for birthday links
|
||||
$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
|
||||
if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
|
||||
$link='<a href="'.$_SERVER['PHP_SELF'];
|
||||
$link.='?'.$newparam;
|
||||
$link.='">';
|
||||
if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
|
||||
else $link.=$langs->trans("AgendaHideBirthdayEvents");
|
||||
$link.='</a>';
|
||||
}
|
||||
*/
|
||||
|
||||
$s = $newtitle;
|
||||
|
||||
@@ -656,7 +640,7 @@ if (empty($reshook)) {
|
||||
$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>';
|
||||
|
||||
@@ -506,7 +506,7 @@ $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||
$sql .= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
|
||||
$sql .= ' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
}
|
||||
// We must filter on resource table
|
||||
@@ -557,7 +557,7 @@ if ($resourceid > 0) {
|
||||
if ($pid) {
|
||||
$sql .= " AND a.fk_project=".((int) $pid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -533,7 +533,7 @@ $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||
$sql .= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
|
||||
$sql .= ' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
}
|
||||
// We must filter on resource table
|
||||
@@ -584,7 +584,7 @@ if ($resourceid > 0) {
|
||||
if ($pid) {
|
||||
$sql .= " AND a.fk_project = ".((int) $pid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
|
||||
@@ -82,14 +82,14 @@ if ($type == "f") {
|
||||
$sql = "SELECT s.rowid, s.nom as name, st.libelle as stcomm";
|
||||
$sql .= ", p.rowid as cidp, p.name, p.firstname, p.email, p.phone";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
$sql .= " WHERE s.fk_stcomm = st.id";
|
||||
$sql .= " AND p.entity IN (".getEntity('socpeople').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($type == "c") {
|
||||
|
||||
@@ -129,13 +129,13 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
$sql .= " AND p.fk_statut = ".Propal::STATUS_DRAFT;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -226,13 +226,13 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity($supplierproposalstatic->element).")";
|
||||
$sql .= " AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT;
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -322,13 +322,13 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
|
||||
$sql .= " AND c.fk_statut = ".Commande::STATUS_DRAFT;
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -419,13 +419,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE cf.entity IN (".getEntity($supplierorderstatic->element).")";
|
||||
$sql .= " AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT;
|
||||
$sql .= " AND cf.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -511,7 +511,7 @@ if (!empty($conf->ficheinter->enabled)) {
|
||||
$sql = "SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
@@ -520,7 +520,7 @@ if (!empty($conf->ficheinter->enabled)) {
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
@@ -561,12 +561,12 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= ", s.datec, s.tms";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
|
||||
$sql .= " AND s.client IN (".Societe::CUSTOMER.", ".Societe::PROSPECT.", ".Societe::CUSTOMER_AND_PROSPECT.")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -657,12 +657,12 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= ", s.datec as dc, s.tms as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
|
||||
$sql .= " AND s.fournisseur = ".Societe::SUPPLIER;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -762,13 +762,13 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.entity IN (".getEntity($staticcontrat->element).")";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.fk_product = p.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -837,13 +837,13 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
$sql .= " AND p.fk_statut = ".Propal::STATUS_VALIDATED;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -953,13 +953,13 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.fk_statut IN (".Commande::STATUS_VALIDATED.", ".Commande::STATUS_SHIPMENTONPROCESS.")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -776,8 +776,8 @@ class Mailing extends CommonObject
|
||||
global $langs;
|
||||
$langs->load("mailing");
|
||||
|
||||
$labelStatus = $langs->trans($this->statuts[$status]);
|
||||
$labelStatusShort = $langs->trans($this->statuts[$status]);
|
||||
$labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]);
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv($this->statuts[$status]);
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == 2) {
|
||||
@@ -808,16 +808,16 @@ class Mailing extends CommonObject
|
||||
$labelStatus = array();
|
||||
$labelStatusShort = array();
|
||||
|
||||
$labelStatus[-1] = $langs->trans('MailingStatusError');
|
||||
$labelStatus[0] = $langs->trans('MailingStatusNotSent');
|
||||
$labelStatus[1] = $langs->trans('MailingStatusSent');
|
||||
$labelStatus[2] = $langs->trans('MailingStatusRead');
|
||||
$labelStatus[3] = $langs->trans('MailingStatusNotContact');
|
||||
$labelStatusShort[-1] = $langs->trans('MailingStatusError');
|
||||
$labelStatusShort[0] = $langs->trans('MailingStatusNotSent');
|
||||
$labelStatusShort[1] = $langs->trans('MailingStatusSent');
|
||||
$labelStatusShort[2] = $langs->trans('MailingStatusRead');
|
||||
$labelStatusShort[3] = $langs->trans('MailingStatusNotContact');
|
||||
$labelStatus[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
|
||||
$labelStatus[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
|
||||
$labelStatus[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
|
||||
$labelStatus[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
|
||||
$labelStatus[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
|
||||
$labelStatusShort[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
|
||||
$labelStatusShort[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
|
||||
$labelStatusShort[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
|
||||
$labelStatusShort[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
|
||||
$labelStatusShort[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == -1) {
|
||||
|
||||
@@ -2079,6 +2079,8 @@ if ($action == 'create') {
|
||||
$absolute_discount = price2num($absolute_discount, 'MT');
|
||||
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
|
||||
|
||||
$caneditfield = ($object->statut != Propal::STATUS_SIGNED && $object->statut != Propal::STATUS_BILLED);
|
||||
|
||||
$thirdparty = $soc;
|
||||
$discount_type = 0;
|
||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
@@ -2092,12 +2094,12 @@ if ($action == 'create') {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DatePropal');
|
||||
print '</td>';
|
||||
if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
|
||||
if ($action != 'editdate' && $usercancreate && $caneditfield) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefield">';
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdate' && $usercancreate) {
|
||||
if ($action == 'editdate' && $usercancreate && $caneditfield) {
|
||||
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setdate">';
|
||||
@@ -2119,12 +2121,12 @@ if ($action == 'create') {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateEndPropal');
|
||||
print '</td>';
|
||||
if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
|
||||
if ($action != 'editecheance' && $usercancreate && $caneditfield) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editecheance&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefield">';
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editecheance' && $usercancreate) {
|
||||
if ($action == 'editecheance' && $usercancreate && $caneditfield) {
|
||||
print '<form name="editecheance" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setecheance">';
|
||||
@@ -2149,12 +2151,12 @@ if ($action == 'create') {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
|
||||
if ($action != 'editconditions' && $usercancreate && $caneditfield) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefield">';
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editconditions' && $usercancreate) {
|
||||
if ($action == 'editconditions' && $usercancreate && $caneditfield) {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
|
||||
@@ -2168,12 +2170,12 @@ if ($action == 'create') {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
|
||||
if ($action != 'editmode' && $usercancreate && $caneditfield) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefieldcreate">';
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
|
||||
if ($action == 'editmode' && $usercancreate && $caneditfield) {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
|
||||
} else {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
|
||||
@@ -2183,26 +2185,27 @@ if ($action == 'create') {
|
||||
// Delivery date
|
||||
$langs->load('deliveries');
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker');
|
||||
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate && $caneditfield, 'datepicker');
|
||||
print '</td><td class="valuefield">';
|
||||
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker');
|
||||
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate && $caneditfield, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('AvailabilityPeriod');
|
||||
if (!empty($conf->commande->enabled)) {
|
||||
print ' ('.$langs->trans('AfterOrder').')';
|
||||
print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod').' ('.$langs->trans('AfterOrder').')');
|
||||
} else {
|
||||
print $langs->trans('AvailabilityPeriod');
|
||||
}
|
||||
print '</td>';
|
||||
if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
|
||||
if ($action != 'editavailability' && $usercancreate && $caneditfield) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editavailability&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefield">';
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editavailability' && $usercancreate) {
|
||||
if ($action == 'editavailability' && $usercancreate && $caneditfield) {
|
||||
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1);
|
||||
} else {
|
||||
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1);
|
||||
@@ -2217,12 +2220,12 @@ if ($action == 'create') {
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $usercancreate) {
|
||||
if ($action != 'editshippingmethod' && $usercancreate && $caneditfield) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editshippingmethod' && $usercancreate) {
|
||||
if ($action == 'editshippingmethod' && $usercancreate && $caneditfield) {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||
@@ -2254,12 +2257,12 @@ if ($action == 'create') {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Source');
|
||||
print '</td>';
|
||||
if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
|
||||
if ($action != 'editdemandreason' && $usercancreate) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefield">';
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdemandreason' && $usercancreate) {
|
||||
if ($action == 'editdemandreason' && $usercancreate) {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
|
||||
} else {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none');
|
||||
@@ -2356,13 +2359,13 @@ if ($action == 'create') {
|
||||
if ($totalWeight) {
|
||||
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
|
||||
print '<td class="valuefield">';
|
||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
|
||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
if ($totalVolume) {
|
||||
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
|
||||
print '<td class="valuefield">';
|
||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
|
||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -2372,7 +2375,7 @@ if ($action == 'create') {
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td class="right">';
|
||||
if ($usercancreate) {
|
||||
if ($action != 'editincoterm' && $usercancreate && $caneditfield) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit().'</a>';
|
||||
} else {
|
||||
print ' ';
|
||||
@@ -2380,10 +2383,10 @@ if ($action == 'create') {
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td class="valuefield">';
|
||||
if ($action != 'editincoterm') {
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
|
||||
} else {
|
||||
if ($action == 'editincoterm' && $usercancreate && $caneditfield) {
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
} else {
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -2769,17 +2779,17 @@ class Propal extends CommonObject
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql .= " p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
|
||||
$sql .= " p.datep as dp, p.fin_validite as datelimite";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('propal').")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
$sql .= " AND p.fk_statut = c.id";
|
||||
if (!$user->rights->societe->client->voir && !$socid) { //restriction
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -3283,7 +3293,7 @@ class Propal extends CommonObject
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin, p.total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
@@ -3460,7 +3470,7 @@ class Propal extends CommonObject
|
||||
$sql = "SELECT count(p.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = "AND";
|
||||
|
||||
@@ -93,7 +93,7 @@ class PropaleStats extends Stats
|
||||
}
|
||||
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
|
||||
$this->where .= ($this->where ? ' AND ' : '')."p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($this->socid) {
|
||||
@@ -129,7 +129,7 @@ class PropaleStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -154,7 +154,7 @@ class PropaleStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -178,7 +178,7 @@ class PropaleStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -203,7 +203,7 @@ class PropaleStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -226,7 +226,7 @@ class PropaleStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -252,7 +252,7 @@ class PropaleStats extends Stats
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
||||
@@ -81,13 +81,13 @@ if (!empty($conf->propal->enabled)) {
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
$sql .= " AND p.fk_statut =".Propal::STATUS_DRAFT;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -156,7 +156,7 @@ $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, date_cloture as datec";
|
||||
$sql .= ", s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.entity IN (".getEntity($propalstatic->element).")";
|
||||
@@ -165,7 +165,7 @@ $sql .= " AND c.fk_soc = s.rowid";
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY c.tms DESC";
|
||||
@@ -232,13 +232,13 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
|
||||
$sql .= ", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.fk_soc = s.rowid";
|
||||
$sql .= " AND p.entity IN (".getEntity($propalstatic->element).")";
|
||||
$sql .= " AND p.fk_statut = ".Propal::STATUS_VALIDATED;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -317,12 +317,12 @@ if (! empty($conf->propal->enabled))
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."propal as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 1";
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
$sql.= " ORDER BY c.rowid DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
@@ -392,12 +392,12 @@ if (! empty($conf->propal->enabled))
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 2 ";
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
$sql.= " ORDER BY c.rowid DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@@ -509,7 +509,7 @@ $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 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) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
|
||||
@@ -547,7 +547,7 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) {
|
||||
if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
@@ -562,7 +562,7 @@ $sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' WHERE p.fk_soc = s.rowid';
|
||||
$sql .= ' AND p.entity IN ('.getEntity('propal').')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) { //restriction
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
$filenamenb = $dir.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
} else {
|
||||
@@ -147,7 +147,7 @@ if (!$mesg) {
|
||||
$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, 0);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
$filenameamount = $dir.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
} else {
|
||||
@@ -182,7 +182,7 @@ if (!$mesg) {
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
$fileurl_avg = '';
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
|
||||
@@ -30,7 +30,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
}
|
||||
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
|
||||
|
||||
@@ -80,13 +80,13 @@ if (!empty($conf->propal->enabled)) {
|
||||
$sql = "SELECT count(*) as cc, st.libelle, st.picto, st.id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.fk_stcomm = st.id";
|
||||
$sql .= " AND s.client IN (2, 3)";
|
||||
$sql .= " AND s.entity IN (".getEntity($companystatic->element).")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " GROUP BY st.id";
|
||||
@@ -122,13 +122,13 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, s.nom as sname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.fk_statut = 0";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
$sql .= " AND p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
@@ -183,14 +183,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE p.fk_soc = s.rowid";
|
||||
$sql .= " AND p.fk_statut = c.id";
|
||||
$sql .= " AND p.fk_statut = 1";
|
||||
$sql .= " AND p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -244,12 +244,12 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
|
||||
*/
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.fk_stcomm = 1";
|
||||
$sql .= " AND s.entity IN (".getEntity($companystatic->element).")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY s.tms ASC";
|
||||
|
||||
@@ -1494,13 +1494,13 @@ if ($action == 'create' && $usercancreate) {
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); // TODO maybe add default value option
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
|
||||
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0));
|
||||
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0);
|
||||
$shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0));
|
||||
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
|
||||
$demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
|
||||
$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : '';
|
||||
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ? -1 : '';
|
||||
|
||||
$date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
|
||||
if (empty($date_delivery)) {
|
||||
@@ -1526,7 +1526,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$fk_account = $soc->fk_account;
|
||||
$availability_id = $soc->availability_id;
|
||||
$availability_id = 0;
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
$warehouse_id = $soc->warehouse_id;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
@@ -1646,13 +1646,19 @@ if ($action == 'create' && $usercancreate) {
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>';
|
||||
print img_picto('', 'clock', 'class="pictofixedwidth"');
|
||||
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Terms of the settlement
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment');
|
||||
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode de reglement
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
|
||||
@@ -1665,12 +1671,6 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>';
|
||||
print img_picto('', 'clock', 'class="pictofixedwidth"');
|
||||
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Shipping Method
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
|
||||
@@ -1737,7 +1737,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
};
|
||||
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
print $object->showOptionals($extrafields, 'create', $parameters);
|
||||
}
|
||||
|
||||
// Template to use by default
|
||||
@@ -2148,7 +2148,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</form>';
|
||||
} else {
|
||||
print $object->date ? dol_print_date($object->date, 'day') : ' ';
|
||||
if ($object->hasDelay()) {
|
||||
if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date
|
||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||
}
|
||||
}
|
||||
@@ -2176,6 +2176,18 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>';
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editavailability') {
|
||||
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1);
|
||||
} else {
|
||||
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Shipping Method
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>';
|
||||
@@ -2209,6 +2221,18 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Source reason (why we have an order)
|
||||
print '<tr><td>';
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("Source", 'demandreason', '', $object, $editenable);
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editdemandreason') {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
|
||||
} else {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td>';
|
||||
$editenable = $usercancreate;
|
||||
@@ -2274,30 +2298,6 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
}
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>';
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editavailability') {
|
||||
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1);
|
||||
} else {
|
||||
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Source reason (why we have an ordrer)
|
||||
print '<tr><td>';
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable);
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editdemandreason') {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
|
||||
} else {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO Order mode (how we receive order). Not yet implemented
|
||||
/*
|
||||
print '<tr><td>';
|
||||
|
||||
@@ -2678,16 +2678,16 @@ class Commande extends CommonOrder
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql .= " c.rowid as cid, c.ref";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) { //restriction
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@@ -3505,7 +3505,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
@@ -3915,7 +3915,7 @@ class Commande extends CommonOrder
|
||||
$sql = "SELECT count(co.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as co";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = "AND";
|
||||
|
||||
@@ -93,7 +93,7 @@ class CommandeStats extends Stats
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
$this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('commande').')';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($this->socid) {
|
||||
@@ -128,7 +128,7 @@ class CommandeStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -153,7 +153,7 @@ class CommandeStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -177,7 +177,7 @@ class CommandeStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -202,7 +202,7 @@ class CommandeStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -225,7 +225,7 @@ class CommandeStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@@ -249,7 +249,7 @@ class CommandeStats extends Stats
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
||||
@@ -77,16 +77,16 @@ $thirdpartystatic = new Societe($db);
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
|
||||
$sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.fk_stcomm = st.id AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if (GETPOST("search_nom")) {
|
||||
|
||||
@@ -94,7 +94,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
@@ -103,7 +103,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ $sql .= ", s.code_client";
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
@@ -171,7 +171,7 @@ $sql .= " AND c.entity IN (".getEntity('commande').")";
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY c.tms DESC";
|
||||
@@ -246,7 +246,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
@@ -255,7 +255,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY c.rowid DESC";
|
||||
@@ -335,7 +335,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
@@ -344,7 +344,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY c.rowid DESC";
|
||||
|
||||
@@ -465,7 +465,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
|
||||
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) {
|
||||
if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
@@ -486,7 +486,7 @@ if ($search_product_category > 0) {
|
||||
if ($socid > 0) {
|
||||
$sql .= ' AND s.rowid = '.((int) $socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($search_ref) {
|
||||
|
||||
@@ -112,7 +112,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
$filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
@@ -158,7 +158,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
$filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
@@ -202,7 +202,7 @@ if (!$mesg) {
|
||||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
|
||||
@@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
@@ -463,7 +463,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>';
|
||||
|
||||
@@ -1125,12 +1125,12 @@ class Account extends CommonObject
|
||||
$langs->load('banks');
|
||||
|
||||
if ($status == self::STATUS_OPEN) {
|
||||
$label = $langs->trans("StatusAccountOpened");
|
||||
$labelshort = $langs->trans("StatusAccountOpened");
|
||||
$label = $langs->transnoentitiesnoconv("StatusAccountOpened");
|
||||
$labelshort = $langs->transnoentitiesnoconv("StatusAccountOpened");
|
||||
$statusType = 'status4';
|
||||
} else {
|
||||
$label = $langs->trans("StatusAccountClosed");
|
||||
$labelshort = $langs->trans("StatusAccountClosed");
|
||||
$label = $langs->transnoentitiesnoconv("StatusAccountClosed");
|
||||
$labelshort = $langs->transnoentitiesnoconv("StatusAccountClosed");
|
||||
$statusType = 'status5';
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -578,7 +578,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
|
||||
@@ -378,10 +378,10 @@ class CashControl extends CommonObject
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[0] = $langs->trans('Draft');
|
||||
$this->labelStatus[1] = $langs->trans('Closed');
|
||||
$this->labelStatusShort[0] = $langs->trans('Draft');
|
||||
$this->labelStatusShort[1] = $langs->trans('Closed');
|
||||
$this->labelStatus[0] = $langs->transnoentitiesnoconv('Draft');
|
||||
$this->labelStatus[1] = $langs->transnoentitiesnoconv('Closed');
|
||||
$this->labelStatusShort[0] = $langs->transnoentitiesnoconv('Draft');
|
||||
$this->labelStatusShort[1] = $langs->transnoentitiesnoconv('Closed');
|
||||
}
|
||||
|
||||
$statusType = 'status0';
|
||||
|
||||
@@ -94,16 +94,16 @@ if ($mode == 'search') {
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
|
||||
$sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.fk_stcomm = st.id AND s.client in (1, 3)";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if (dol_strlen($stcomm)) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user