Merge branch 'develop' of github.com:Dolibarr/dolibarr into fix_introduced_scrutinizer
This commit is contained in:
commit
fddcaf6945
@ -11,6 +11,7 @@ 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: Add option to disable globaly some notifications emails.
|
||||
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
|
||||
|
||||
@ -38,6 +38,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
||||
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
@ -51,14 +52,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();
|
||||
}
|
||||
|
||||
@ -438,43 +439,37 @@ if ($resql) {
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$totalarray = array();
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['aa.account_number']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['aa.active']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -744,7 +744,7 @@ if ($resql) {
|
||||
print '<td></td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
@ -109,7 +109,7 @@ foreach ($list_account_main as $key) {
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ foreach ($list_account as $key) {
|
||||
print '<td width="50%">'.$label.'</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
|
||||
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ $langs->loadLangs(array("admin", "compta"));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->fiscalyear->write) { // If we can read accounting records, we should be able to see fiscal year.
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) { // If we can read accounting records, we should be able to see fiscal year.
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ $langs->loadLangs(array("admin", "compta"));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->fiscalyear->write) {
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -612,7 +612,7 @@ if ($id) {
|
||||
print '</td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ $search_onpurchase = GETPOST('search_onpurchase', 'alpha');
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
|
||||
$btn_changetype = GETPOST('changetype', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
if (empty($accounting_product_mode)) {
|
||||
$accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||
@ -253,35 +254,35 @@ $form = new FormAccounting($db);
|
||||
// so we need to get those the rowid of those default value first
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is already exists accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_servbuy = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT'), 1);
|
||||
$aarowid_servbuy_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_servbuy_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT'), 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT'), 1);
|
||||
$aarowid_prodbuy_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_prodbuy_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT'), 1);
|
||||
$aarowid_servsell = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT'), 1);
|
||||
$aarowid_servsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_servsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT'), 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT'), 1);
|
||||
$aarowid_prodsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_prodsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT'), 1);
|
||||
|
||||
$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy = getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
|
||||
llxHeader('', $langs->trans("ProductsBinding"));
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgverid = getDolGlobalString('CHARTOFACCOUNTS');
|
||||
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) {
|
||||
$pcgvercode = $pcgverid;
|
||||
|
||||
@ -36,6 +36,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||
|
||||
$search_subaccount = GETPOST('search_subaccount', 'alpha');
|
||||
@ -46,7 +47,7 @@ $search_type = GETPOST('search_type', 'int');
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -367,6 +368,7 @@ if ($resql) {
|
||||
print "</tr>\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
@ -512,10 +512,10 @@ if ($action == 'create') {
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Doc type
|
||||
if (!empty($object->doc_type)) {
|
||||
@ -591,7 +591,7 @@ if ($action == 'create') {
|
||||
*/
|
||||
print "</table>\n";
|
||||
|
||||
print '</div></div><!-ee-->';
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -63,7 +63,7 @@ if (empty($conf->accounting->enabled)) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->fiscalyear->write) {
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -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,7 +221,6 @@ 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;
|
||||
@ -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,7 +554,6 @@ 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;
|
||||
@ -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 {
|
||||
@ -614,7 +613,7 @@ if ($result) {
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>';
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($facture_static->datef), 'day').'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($facture_static->date), 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td class="tdoverflowmax150">';
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -935,8 +935,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
$soc = new Societe($db);
|
||||
if (!empty($socid)) {
|
||||
$soc = new Societe($db);
|
||||
if ($socid > 0) {
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
@ -1783,10 +1783,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield tableforfield centpercent">';
|
||||
|
||||
// Birth Date
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
@ -1872,7 +1872,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div></div>\n";
|
||||
print "</div></div>\n";
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
@ -2045,7 +2045,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$MAX = 10;
|
||||
|
||||
@ -2056,7 +2056,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlcenter);
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
@ -225,7 +225,7 @@ if ($mesg) {
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
|
||||
@ -557,10 +557,10 @@ if ($rowid > 0) {
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Birthday
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
@ -652,7 +652,7 @@ if ($rowid > 0) {
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div></div>\n";
|
||||
print "</div></div>\n";
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -388,7 +388,7 @@ if ($rowid && $action != 'edit') {
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
*/
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
@ -397,7 +397,7 @@ if ($rowid && $action != 'edit') {
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -76,11 +76,11 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
|
||||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = GETPOST("libelle", 'alphanohtml');
|
||||
$object->description = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
|
||||
$object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
//$object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = GETPOST("libelle", 'alphanohtml');
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
|
||||
$object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
//$object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
}
|
||||
|
||||
// backup into database
|
||||
|
||||
@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
|
||||
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
|
||||
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
@ -233,7 +233,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR
|
||||
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]);
|
||||
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
|
||||
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
|
||||
|
||||
@ -105,7 +105,7 @@ foreach ($list as $key) {
|
||||
// Value
|
||||
print '<td>';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
|
||||
} else {
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$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";
|
||||
}
|
||||
|
||||
|
||||
@ -97,6 +97,10 @@ if ($action == 'setvalue' && $user->admin) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE", GETPOST("notif_disable", "alphawithlgt"), 'chaine', 0, '', $conf->entity);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
@ -199,6 +203,29 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("NotificationDisableConfirmMessageUser").'</td>';
|
||||
print '<td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("NotificationDisableConfirmMessageFix").'</td>';
|
||||
print '<td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
@ -163,7 +163,7 @@ print '<br>';
|
||||
|
||||
// XDebug
|
||||
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
|
||||
$test = !function_exists('xdebug_is_enabled');
|
||||
$test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug');
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
|
||||
} else {
|
||||
|
||||
@ -539,13 +539,11 @@ print "</div> <!-- end div fichehalfleft -->\n";
|
||||
|
||||
|
||||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
print '</fieldset>';
|
||||
@ -620,13 +618,11 @@ print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '</fieldset>';
|
||||
|
||||
@ -325,7 +325,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('asset'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
@ -336,7 +336,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT, '', $morehtmlright);
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "other", "blockedlog", "bills"));
|
||||
|
||||
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) {
|
||||
if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
$id = GETPOST('id', 'int');
|
||||
$block = new BlockedLog($db);
|
||||
|
||||
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) {
|
||||
if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
28
htdocs/bom/ajax/interface.php
Normal file
28
htdocs/bom/ajax/interface.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require '../../main.inc.php';
|
||||
|
||||
$action = GETPOST('action', 'alphanohtml');
|
||||
$select_product_val = GETPOST('select_product_val', 'int');
|
||||
$current_bom_id = GETPOST('current_bom_id', 'int');
|
||||
|
||||
global $db;
|
||||
|
||||
switch ($action) {
|
||||
case 'select_BOM':
|
||||
//Selection of nomenclatures corresponding to the selected product
|
||||
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
|
||||
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product AS p ON b.fk_product=p.rowid';
|
||||
$sql.= ' WHERE fk_product='.(int) $select_product_val.' AND b.rowid<>'. (int) $current_bom_id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql && $db->num_rows($resql) > 0) {
|
||||
$options = array();
|
||||
$cpt=0;
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
|
||||
$cpt++;
|
||||
}
|
||||
print json_encode($options);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -149,6 +149,7 @@ if (empty($reshook)) {
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$idprod = (int) GETPOST('idprod', 'int');
|
||||
$bom_child = (int) GETPOST('bom_select', 'int');
|
||||
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
|
||||
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
|
||||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||
@ -172,6 +173,7 @@ if (empty($reshook)) {
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fk_bom = $id;
|
||||
$bomline->fk_product = $idprod;
|
||||
$bomline->fk_bom_child = $bom_child;
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = (int) $qty_frozen;
|
||||
$bomline->disable_stock_change = (int) $disable_stock_change;
|
||||
@ -571,9 +573,78 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||
print '</table>';
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
let select_product_val;
|
||||
let current_bom_id = <?php echo $object->id?>;
|
||||
//On change on the bom select
|
||||
$('#idprod').on('change', function () {
|
||||
select_product_val = $('#idprod').select2().val();
|
||||
|
||||
//Ajax to set all options without reloading the page
|
||||
$.ajax({
|
||||
url: 'script/interface.php'
|
||||
, method: 'POST'
|
||||
, dataType: 'text'
|
||||
, data: {
|
||||
action: 'select_BOM'
|
||||
, select_product_val: select_product_val
|
||||
, current_bom_id: current_bom_id
|
||||
}
|
||||
}).done(function (data) {
|
||||
//To remove all options of the bom select on change
|
||||
$('#bom_select').get(0).length = 0;
|
||||
|
||||
//To set options for the bom select on change
|
||||
let options = JSON.parse(data)
|
||||
for (let key in options) {
|
||||
let opt = new Option(options[key], key);
|
||||
$('#bom_select').append(opt)
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<?php
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
$(".collapse_bom").click(function() {
|
||||
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
if($(this).text().indexOf('+') > 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('(-) ');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('(+) ');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//To Show all the sub bom lines
|
||||
$("#show_all").click(function() {
|
||||
$("[class^=sub_bom_lines]").show();
|
||||
$("[class^=collapse_bom]").html('(-) ');
|
||||
return false;
|
||||
});
|
||||
//To Hide all the sub bom lines
|
||||
$("#hide_all").click(function() {
|
||||
$("[class^=sub_bom_lines]").hide();
|
||||
$("[class^=collapse_bom]").html('(+) ');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@ -690,7 +761,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
@ -703,7 +774,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT, '', $morehtmlright);
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
//Select mail models is same action as presend
|
||||
|
||||
@ -1139,6 +1139,7 @@ class BOMLine extends CommonObjectLine
|
||||
'rowid' => array('type'=>'integer', 'label'=>'LineID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
|
||||
'fk_bom_child' => array('type'=>'integer:BOM:bom/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'notnull'=>-1,),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'),
|
||||
@ -1163,6 +1164,11 @@ class BOMLine extends CommonObjectLine
|
||||
*/
|
||||
public $fk_product;
|
||||
|
||||
/**
|
||||
* @var int Id of parent bom
|
||||
*/
|
||||
public $fk_bom_child;
|
||||
|
||||
/**
|
||||
* @var string description
|
||||
*/
|
||||
|
||||
@ -61,6 +61,8 @@ if ($nolinesbefore) {
|
||||
print '<td class="linecoldescription minwidth500imp">';
|
||||
print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
|
||||
print '</td>';
|
||||
// Linked BOM
|
||||
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit left">';
|
||||
@ -107,6 +109,10 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
|
||||
echo '</span>';
|
||||
}
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom linecolbom">';
|
||||
print '<select id="bom_select" name="bom_select"><options value="-1"></options></select>';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';
|
||||
|
||||
@ -97,6 +97,8 @@ print '</td>';
|
||||
*/
|
||||
|
||||
$coldisplay++;
|
||||
// For BOM
|
||||
print '<td></td>';
|
||||
|
||||
print '<td class="nobottom linecolqty right">';
|
||||
if (($line->info_bits & 2) != 2) {
|
||||
|
||||
@ -43,6 +43,8 @@ print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
|
||||
print "<thead>\n";
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a> ';
|
||||
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
||||
|
||||
// Adds a line numbering column
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
@ -52,6 +54,9 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
// Description
|
||||
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
|
||||
|
||||
// Linked BOM
|
||||
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
|
||||
|
||||
// Qty
|
||||
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).'</td>';
|
||||
|
||||
|
||||
@ -80,9 +80,22 @@ print '<div id="line_'.$line->id.'"></div>';
|
||||
$coldisplay++;
|
||||
$tmpproduct = new Product($object->db);
|
||||
$tmpproduct->fetch($line->fk_product);
|
||||
$tmpbom = new BOM($object->db);
|
||||
$res = $tmpbom->fetch($line->fk_bom_child);
|
||||
if (!empty($tmpbom->id)) {
|
||||
print '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' </a>';
|
||||
}
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print ' - '.$tmpproduct->label;
|
||||
print '</td>';
|
||||
|
||||
// To show BOM links in the list
|
||||
if ($res > 0) {
|
||||
print '<td id="bom_id">'.$tmpbom->getNomUrl(1).'</td>';
|
||||
} else {
|
||||
print '<td id="bom_id"> </td>';
|
||||
}
|
||||
|
||||
print '<td class="linecolqty nowrap right">';
|
||||
$coldisplay++;
|
||||
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
@ -111,7 +124,8 @@ $coldisplay++;
|
||||
echo $line->efficiency;
|
||||
print '</td>';
|
||||
|
||||
print '<td class="linecolcost nowrap right">';
|
||||
$total_cost = 0;
|
||||
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
|
||||
$coldisplay++;
|
||||
echo price($line->total_cost);
|
||||
print '</td>';
|
||||
@ -166,6 +180,93 @@ if ($action == 'selectlines') {
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Select of all the sub-BOM lines
|
||||
$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
|
||||
$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
|
||||
$resql = $object->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
// Loop on all the sub-BOM lines if they exist
|
||||
while ($obj = $object->db->fetch_object($resql)) {
|
||||
$sub_bom_product = new Product($object->db);
|
||||
$sub_bom_product->fetch($obj->fk_product);
|
||||
|
||||
$sub_bom = new BOM($object->db);
|
||||
$sub_bom->fetch($obj->fk_bom_child);
|
||||
|
||||
$sub_bom_line = new BOMLine($object->db);
|
||||
$sub_bom_line->fetch($obj->rowid);
|
||||
|
||||
//If hidden conf is set, we show directly all the sub-BOM lines
|
||||
if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
|
||||
print '<tr style="display:none" class="sub_bom_lines" parentid="'.$line->id.'">';
|
||||
} else {
|
||||
print '<tr class="sub_bom_lines" parentid="'.$line->id.'">';
|
||||
}
|
||||
|
||||
// Product
|
||||
print '<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.'">'.$sub_bom_product->getNomUrl(1).'</td>';
|
||||
|
||||
// Sub-BOM
|
||||
if ($sub_bom_line->fk_bom_child > 0) {
|
||||
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'">'.$sub_bom->getNomUrl(1).'</td>';
|
||||
} else {
|
||||
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'"> </td>';
|
||||
}
|
||||
|
||||
// Qty
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
|
||||
if ($sub_bom_line->qty_frozen > 0) {
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$sub_bom_line->qty_frozen.'</td>';
|
||||
} else {
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'"> </td>';
|
||||
}
|
||||
|
||||
// Disable stock change
|
||||
if ($sub_bom_line->disable_stock_change > 0) {
|
||||
print '<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.'">'.$sub_bom_line->disable_stock_change.'</td>';
|
||||
} else {
|
||||
print '<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.'"> </td>';
|
||||
}
|
||||
|
||||
// Efficiency
|
||||
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
|
||||
|
||||
// Cost price if it's defined
|
||||
if ($sub_bom_product->cost_price > 0) {
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $line->qty).'</td>';
|
||||
$total_cost.= $sub_bom_product->cost_price * $line->qty;
|
||||
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
|
||||
$total_cost.= $sub_bom_product->pmp * $line->qty;
|
||||
} else { // Minimum purchase price if cost price and PMP aren't defined
|
||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||
$sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id;
|
||||
$resql_supplier_price = $object->db->query($sql_supplier_price);
|
||||
if ($resql_supplier_price) {
|
||||
$obj = $object->db->fetch_object($resql_supplier_price);
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($obj->min_price * $line->qty).'</td>';
|
||||
$total_cost+= $obj->min_price * $line->qty;
|
||||
}
|
||||
}
|
||||
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
|
||||
if ($total_cost > 0) {
|
||||
$line->total_cost = price($total_cost);
|
||||
?>
|
||||
<script>
|
||||
$('#costline_<?php echo $line->id?>').html("<?php echo "".price($total_cost)?>");
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
//Line extrafield
|
||||
if (!empty($extrafields)) {
|
||||
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1, 'line');
|
||||
|
||||
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
$langs->loadLangs(array('bookmarks', 'other'));
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->bookmark->lire) {
|
||||
if (empty($user->rights->bookmark->lire)) {
|
||||
restrictedArea($user, 'bookmarks');
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ $toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->bookmark->lire) {
|
||||
if (empty($user->rights->bookmark->lire)) {
|
||||
restrictedArea($user, 'bookmarks');
|
||||
}
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
@ -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',
|
||||
@ -753,8 +759,6 @@ class Categorie extends CommonObject
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@ -810,8 +814,6 @@ class Categorie extends CommonObject
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -173,7 +173,12 @@ if ($elemid && $action == 'addintocategory' &&
|
||||
(($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
|
||||
($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write)
|
||||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
|
||||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_USER && $user->rights->user->user->creer) ||
|
||||
($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
|
||||
)) {
|
||||
if ($type == Categorie::TYPE_PRODUCT) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
@ -191,6 +196,26 @@ if ($elemid && $action == 'addintocategory' &&
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
||||
$newobject = new Ticket($db);
|
||||
$elementtype = 'ticket';
|
||||
} elseif ($type == Categorie::TYPE_PROJECT) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
$newobject = new Project($db);
|
||||
$elementtype = 'project';
|
||||
} elseif ($type == Categorie::TYPE_MEMBER) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$newobject = new Adherent($db);
|
||||
$elementtype = 'member';
|
||||
} elseif ($type == Categorie::TYPE_CONTACT) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$newobject = new Contact($db);
|
||||
$elementtype = 'contact';
|
||||
} elseif ($type == Categorie::TYPE_USER) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$newobject = new User($db);
|
||||
$elementtype = 'user';
|
||||
} elseif ($type == Categorie::TYPE_ACCOUNT) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$newobject = new User($db);
|
||||
$elementtype = 'bank_account';
|
||||
}
|
||||
$result = $newobject->fetch($elemid);
|
||||
|
||||
@ -199,7 +224,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');
|
||||
@ -538,6 +563,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
|
||||
}
|
||||
}
|
||||
|
||||
// List of customers
|
||||
if ($type == Categorie::TYPE_CUSTOMER) {
|
||||
$permission = $user->rights->societe->creer;
|
||||
|
||||
@ -611,7 +637,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// List of suppliers
|
||||
if ($type == Categorie::TYPE_SUPPLIER) {
|
||||
$permission = $user->rights->societe->creer;
|
||||
|
||||
@ -696,6 +722,26 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
if ($prods < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
// Form to add record into a category
|
||||
$showclassifyform = 1;
|
||||
if ($showclassifyform) {
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddMemberIntoCategory").' ';
|
||||
print $form->selectMembers('', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
@ -752,6 +798,25 @@ if ($type == Categorie::TYPE_CONTACT) {
|
||||
if (!is_array($contacts) && $contacts < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
// Form to add record into a category
|
||||
$showclassifyform = 1;
|
||||
if ($showclassifyform) {
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddContactIntoCategory").' ';
|
||||
print $form->selectContacts('', '', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
@ -817,6 +882,26 @@ if ($type == Categorie::TYPE_ACCOUNT) {
|
||||
if ($accounts < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
// Form to add record into a category
|
||||
$showclassifyform = 1;
|
||||
if ($showclassifyform) {
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddAccountIntoCategory").' ';
|
||||
$form->select_comptes('', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
@ -874,6 +959,26 @@ if ($type == Categorie::TYPE_PROJECT) {
|
||||
if ($objects < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
// Form to add record into a category
|
||||
$showclassifyform = 1;
|
||||
if ($showclassifyform) {
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddProjectIntoCategory").' ';
|
||||
$form->selectProjects('', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
@ -930,6 +1035,25 @@ if ($type == Categorie::TYPE_USER) {
|
||||
if ($users < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
// Form to add record into a category
|
||||
$showclassifyform = 1;
|
||||
if ($showclassifyform) {
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddProjectIntoCategory").' ';
|
||||
print $form->select_dolusers('', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
|
||||
@ -2214,10 +2214,10 @@ if ($id > 0) {
|
||||
|
||||
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $object->default_lang);
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1327,10 +1327,10 @@ 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) {
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
@ -1339,13 +1339,13 @@ 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) {
|
||||
$sql .= " AND a.fk_soc = ".((int) $user->socid);
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read) {
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id);
|
||||
$sql .= " OR ar.fk_element = ".((int) $user->id);
|
||||
$sql .= ")";
|
||||
|
||||
@ -201,9 +201,9 @@ if ($object->id > 0) {
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td colspan="3">';
|
||||
if (!$object->fulldayevent) {
|
||||
print dol_print_date($object->datep, 'dayhour');
|
||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datep, 'day');
|
||||
print dol_print_date($object->datep, 'day', 'tzuser');
|
||||
}
|
||||
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
@ -214,9 +214,9 @@ if ($object->id > 0) {
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
|
||||
if (!$object->fulldayevent) {
|
||||
print dol_print_date($object->datef, 'dayhour');
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datef, 'day');
|
||||
print dol_print_date($object->datef, 'day', 'tzuser');
|
||||
}
|
||||
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
|
||||
@ -86,13 +86,13 @@ if ($socid < 0) {
|
||||
}
|
||||
|
||||
$canedit = 1;
|
||||
if (!$user->rights->agenda->myactions->read) {
|
||||
if (empty($user->rights->agenda->myactions->read)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read) {
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$canedit = 0;
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
$filtert = $user->id;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -136,13 +136,13 @@ if ($socid < 0) {
|
||||
}
|
||||
|
||||
$canedit = 1;
|
||||
if (!$user->rights->agenda->myactions->read) {
|
||||
if (empty($user->rights->agenda->myactions->read)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read) {
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$canedit = 0;
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
$filtert = $user->id;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -80,13 +80,13 @@ if ($socid < 0) {
|
||||
}
|
||||
|
||||
$canedit = 1;
|
||||
if (!$user->rights->agenda->myactions->read) {
|
||||
if (empty($user->rights->agenda->myactions->read)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read) {
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$canedit = 0;
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
$filtert = $user->id;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -80,13 +80,13 @@ if ($socid < 0) {
|
||||
}
|
||||
|
||||
$canedit = 1;
|
||||
if (!$user->rights->agenda->myactions->read) {
|
||||
if (empty($user->rights->agenda->myactions->read)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read) {
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$canedit = 0;
|
||||
}
|
||||
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
$filtert = $user->id;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -682,7 +682,7 @@ if ($object->id > 0) {
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
$boxstat = '';
|
||||
@ -1341,7 +1341,7 @@ if ($object->id > 0) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -548,7 +548,6 @@ if (!empty($conf->ficheinter->enabled)) {
|
||||
}
|
||||
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
/*
|
||||
* Last modified customers or prospects
|
||||
@ -561,12 +560,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 +656,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 +761,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 +836,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 +952,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) {
|
||||
@ -1057,7 +1056,6 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -141,8 +141,7 @@ if (is_resource($handle)) {
|
||||
print "</table><br>";
|
||||
|
||||
|
||||
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
/*
|
||||
@ -193,7 +192,7 @@ if ($result) {
|
||||
}
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
|
||||
|
||||
$parameters = array('user' => $user);
|
||||
|
||||
@ -1559,8 +1559,6 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
$object = new Propal($db);
|
||||
|
||||
print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -2398,7 +2396,6 @@ if ($action == 'create') {
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
@ -2457,7 +2454,6 @@ if ($action == 'create') {
|
||||
$formmargin->displayMarginInfos($object);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
@ -2690,14 +2686,14 @@ if ($action == 'create') {
|
||||
print showOnlineSignatureUrl('proposal', $object->ref).'<br>';
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'propal', $socid, 1);
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
|
||||
@ -2779,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) {
|
||||
@ -3293,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";
|
||||
@ -3470,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) {
|
||||
@ -146,7 +146,6 @@ if (!empty($conf->propal->enabled)) {
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichetwothirdright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
/*
|
||||
* Last modified proposals
|
||||
@ -156,7 +155,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 +164,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 +231,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 +316,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 +391,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);
|
||||
@ -456,7 +455,6 @@ if (! empty($conf->propal->enabled))
|
||||
}
|
||||
*/
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -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';
|
||||
@ -347,7 +347,7 @@ foreach ($data as $val) {
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
@ -364,7 +364,7 @@ if ($mesg) {
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -163,8 +163,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
|
||||
}
|
||||
|
||||
|
||||
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
/*
|
||||
@ -183,14 +182,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 +243,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";
|
||||
@ -280,8 +279,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
|
||||
//print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -250,7 +250,6 @@ if ($socid > 0) {
|
||||
if ($isCustomer) {
|
||||
print '</div>'; // class="fichehalfleft"
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
||||
}
|
||||
|
||||
@ -298,7 +297,6 @@ if ($socid > 0) {
|
||||
}
|
||||
|
||||
if ($isCustomer) {
|
||||
print '</div>'; // class="ficheaddleft"
|
||||
print '</div>'; // class="fichehalfright"
|
||||
print '</div>'; // class="fichecenter"
|
||||
}
|
||||
|
||||
@ -532,7 +532,6 @@ if ($socid > 0) {
|
||||
if ($isCustomer) {
|
||||
print '</div>'; // class="fichehalfleft"
|
||||
print '<div class="fichehalfright fichehalfright-lg">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
||||
}
|
||||
|
||||
@ -667,7 +666,6 @@ if ($socid > 0) {
|
||||
}
|
||||
|
||||
if ($isCustomer) {
|
||||
print '</div>'; // class="ficheaddleft"
|
||||
print '</div>'; // class="fichehalfright"
|
||||
print '</div>'; // class="fichecenter"
|
||||
}
|
||||
@ -843,7 +841,6 @@ if ($socid > 0) {
|
||||
if ($isCustomer) {
|
||||
print '</div>'; // class="fichehalfleft"
|
||||
print '<div class="fichehalfright fichehalfright-lg">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
||||
}
|
||||
|
||||
@ -1000,7 +997,6 @@ if ($socid > 0) {
|
||||
}
|
||||
|
||||
if ($isCustomer) {
|
||||
print '</div>'; // class="ficheaddleft"
|
||||
print '</div>'; // class="fichehalfright"
|
||||
print '</div>'; // class="fichecenter"
|
||||
}
|
||||
|
||||
@ -2367,7 +2367,6 @@ if ($action == 'create' && $usercancreate) {
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
@ -2424,7 +2423,6 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>'; // Close fichecenter
|
||||
|
||||
@ -2663,14 +2661,14 @@ if ($action == 'create' && $usercancreate) {
|
||||
print showOnlinePaymentUrl('order', $object->ref).'<br>';
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'order', $socid, 1);
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
|
||||
@ -981,6 +981,7 @@ class Orders extends DolibarrApi
|
||||
if (!DolibarrApiAccess::$user->rights->expedition->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$obj_ret = array();
|
||||
$sql = "SELECT e.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."expeditiondet as edet";
|
||||
@ -1054,7 +1055,6 @@ class Orders extends DolibarrApi
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error on creating expedition lines:'.$this->db->lasterror());
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $shipment->id;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
}
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
$max = 5;
|
||||
@ -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";
|
||||
@ -414,7 +414,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
}
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
|
||||
$parameters = array('user' => $user);
|
||||
$reshook = $hookmanager->executeHooks('dashboardOrders', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -42,7 +42,7 @@ $mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
|
||||
if ($mode == 'customer' && !$user->rights->commande->lire) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) {
|
||||
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -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';
|
||||
@ -401,7 +401,7 @@ print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
@ -418,7 +418,7 @@ if ($mesg) {
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -120,6 +120,8 @@ if (GETPOST("rel") == 'prev') {
|
||||
$found = true;
|
||||
}
|
||||
|
||||
$permissiontoadd = $user->rights->banque->modifier; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -448,9 +448,9 @@ if ($result < 0) {
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
|
||||
print $show1;
|
||||
print '</div></div><div class="fichehalfright"><div class="ficheaddleft"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
|
||||
print '</div></div><div class="fichehalfright"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
|
||||
print $show2;
|
||||
print '</div></div></div></div>';
|
||||
print '</div></div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories'));
|
||||
|
||||
if (!$user->rights->banque->lire) {
|
||||
if (empty($user->rights->banque->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -698,7 +698,6 @@ if ($action == 'create') {
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
@ -795,7 +794,6 @@ if ($action == 'create') {
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -74,6 +74,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
$result = restrictedArea($user, 'banque', $object->id, 'bank_account', '', '');
|
||||
|
||||
$permissiontoadd = $user->rights->banque->modifier; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -39,7 +39,7 @@ if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
|
||||
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
||||
if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
|
||||
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
||||
if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -506,6 +506,8 @@ print "</tr>\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$totalarray['val'] = array('balance'=>0);
|
||||
$total = array();
|
||||
$found = 0;
|
||||
$i = 0;
|
||||
$lastcurrencycode = '';
|
||||
@ -714,7 +716,11 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$total[$objecttmp->currency_code] += $solde;
|
||||
if (empty($total[$objecttmp->currency_code])) {
|
||||
$total[$objecttmp->currency_code] = $solde;
|
||||
} else {
|
||||
$total[$objecttmp->currency_code] += $solde;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -69,6 +69,9 @@ $object->fetch($id, $ref);
|
||||
$upload_dir = $conf->bank->dir_output.'/'.dol_sanitizeFileName($object->id);
|
||||
$modulepart = 'banque';
|
||||
|
||||
$permissiontoadd = $user->rights->banque->modifier; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -647,9 +647,10 @@ if (empty($action) || $action == "view" || $action == "close") {
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '<div class="fichehalfright">>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
print '<tr><td class="titlefield nowrap">';
|
||||
print $langs->trans("DateCreationShort");
|
||||
@ -667,7 +668,7 @@ if (empty($action) || $action == "view" || $action == "close") {
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
@ -22,27 +22,6 @@
|
||||
* \brief List page for cashcontrol
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
|
||||
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
|
||||
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
|
||||
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
|
||||
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
|
||||
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
|
||||
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
|
||||
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
@ -81,7 +60,7 @@ $pagenext = $page + 1;
|
||||
// Initialize technical objects
|
||||
$object = new CashControl($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->monmodule->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
//$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('cashcontrol')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
@ -141,16 +120,16 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
$permissiontoread = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
|
||||
$permissiontoadd = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
|
||||
$permissiontodelete = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) { // Protection if external user
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
|
||||
if (empty($user->rights->cashdesk->run) && empty($user->rights->takepos->run)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -223,7 +202,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
|
||||
@ -341,7 +320,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
|
||||
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs');
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -42,12 +42,6 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'deplacement', $id, '');
|
||||
|
||||
|
||||
// Get parameters
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -74,6 +68,14 @@ $object->fetch($id, $ref);
|
||||
$upload_dir = $conf->deplacement->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart = 'trip';
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'deplacement', $id, '');
|
||||
|
||||
$permissiontoadd = $user->rights->deplacement->creer; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -141,7 +141,7 @@ print '</table>';
|
||||
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
$max = 10;
|
||||
@ -150,7 +150,7 @@ $langs->load("boxes");
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE u.rowid = d.fk_user";
|
||||
@ -158,7 +158,7 @@ $sql .= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
|
||||
$sql .= ' AND d.fk_user IN ('.$db->sanitize(join(',', $childids)).')';
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
@ -212,7 +212,7 @@ if ($result) {
|
||||
}
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -96,7 +96,7 @@ $sql .= " u.lastname, u.firstname"; // Qui
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."deplacement as d";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
|
||||
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 s.rowid = sc.fk_soc";
|
||||
}
|
||||
$sql .= " WHERE d.fk_user = u.rowid";
|
||||
@ -104,7 +104,7 @@ $sql .= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
|
||||
$sql .= ' AND d.fk_user IN ('.$db->sanitize(join(',', $childids)).')';
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR d.fk_soc IS NULL) ";
|
||||
}
|
||||
if ($socid) {
|
||||
|
||||
@ -163,7 +163,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';
|
||||
@ -302,7 +302,7 @@ foreach ($data as $val) {
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
@ -319,7 +319,7 @@ if ($mesg) {
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
|
||||
@ -1443,7 +1443,6 @@ if ($action == 'create') {
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
@ -1591,7 +1590,6 @@ if ($action == 'create') {
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -4093,6 +4093,8 @@ if ($action == 'create') {
|
||||
$i++;
|
||||
$close[$i]['code'] = 'badcustomer';
|
||||
$i++;
|
||||
$close[$i]['code'] = 'bankcharge';
|
||||
$i++;
|
||||
$close[$i]['code'] = 'other';
|
||||
$i++;
|
||||
// Help
|
||||
@ -4101,6 +4103,8 @@ if ($action == 'create') {
|
||||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");
|
||||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBankChargeDesc");
|
||||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("Other");
|
||||
$i++;
|
||||
// Texte
|
||||
@ -4109,6 +4113,8 @@ if ($action == 'create') {
|
||||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBankCharge", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("Other"), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
// arrayreasons[code]=reason
|
||||
@ -4634,7 +4640,6 @@ if ($action == 'create') {
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
print '<!-- amounts -->'."\n";
|
||||
print '<table class="border bordertop tableforfield centpercent">';
|
||||
@ -5196,7 +5201,6 @@ if ($action == 'create') {
|
||||
$formmargin->displayMarginInfos($object);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
@ -5607,14 +5611,14 @@ if ($action == 'create') {
|
||||
print showOnlinePaymentUrl('invoice', $object->ref).'<br>';
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4055,16 +4055,16 @@ class Facture extends CommonInvoice
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql .= " f.rowid as fid, f.ref as ref, f.datef as df";
|
||||
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."facture as f";
|
||||
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('invoice').")";
|
||||
$sql .= " AND f.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) {
|
||||
@ -4254,7 +4254,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
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 f.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
@ -4501,7 +4501,7 @@ class Facture extends CommonInvoice
|
||||
$sql = "SELECT count(f.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.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";
|
||||
|
||||
@ -85,7 +85,7 @@ class FactureStats extends Stats
|
||||
|
||||
$this->where = " f.fk_statut >= 0";
|
||||
$this->where .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$this->where .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($mode == 'customer') {
|
||||
@ -129,7 +129,7 @@ class FactureStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(f.datef,'%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;
|
||||
@ -155,7 +155,7 @@ class FactureStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(f.datef,'%Y') as dm, COUNT(*), 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;
|
||||
@ -180,7 +180,7 @@ class FactureStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$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;
|
||||
@ -206,7 +206,7 @@ class FactureStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$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;
|
||||
@ -229,7 +229,7 @@ class FactureStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$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;
|
||||
@ -253,7 +253,7 @@ class FactureStats 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 && !$this->socid) {
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
@ -281,7 +281,7 @@ class FactureStats extends Stats
|
||||
$startYear = $endYear - $numberYears;
|
||||
$sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$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;
|
||||
|
||||
@ -73,7 +73,6 @@ if ($tmp) {
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichetwothirdright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
|
||||
if ($tmp) {
|
||||
@ -87,7 +86,6 @@ if ($tmp) {
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -291,12 +291,12 @@ $sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
|
||||
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.fk_soc = s.rowid";
|
||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
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) {
|
||||
|
||||
@ -116,7 +116,7 @@ $search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int');
|
||||
$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int');
|
||||
@ -124,7 +124,7 @@ $search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int');
|
||||
$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int');
|
||||
$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int');
|
||||
$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int');
|
||||
$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver
|
||||
$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver
|
||||
$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
|
||||
$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int');
|
||||
$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int');
|
||||
@ -242,10 +242,10 @@ $arrayfields = array(
|
||||
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
|
||||
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
|
||||
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
|
||||
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
|
||||
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
|
||||
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
|
||||
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
|
||||
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
|
||||
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502),
|
||||
'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))),
|
||||
@ -380,11 +380,11 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
if (!empty($arrayofselected)) {
|
||||
$bankid=GETPOST('bankid', 'int');
|
||||
$paiementid=GETPOST('paiementid', 'int');
|
||||
$paiementdate=dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
|
||||
$bankid = GETPOST('bankid', 'int');
|
||||
$paiementid = GETPOST('paiementid', 'int');
|
||||
$paiementdate = dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
|
||||
foreach ($arrayofselected as $toselectid) {
|
||||
$errorpayment=0;
|
||||
$errorpayment = 0;
|
||||
$facture = new Facture($db);
|
||||
$result = $facture->fetch($toselectid);
|
||||
if ($result < 0) {
|
||||
@ -397,7 +397,7 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
|
||||
$totaldeposits = $facture->getSumDepositsUsed();
|
||||
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = price2num($facture->total_ttc - $totalpay);
|
||||
if ($remaintopay!=0) {
|
||||
if ($remaintopay != 0) {
|
||||
$resultBank = $facture->setBankAccount($bankid);
|
||||
if ($resultBank < 0) {
|
||||
setEventMessage($facture->error, 'errors');
|
||||
@ -410,12 +410,12 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
|
||||
$paiement->paiementid = $paiementid;
|
||||
$paiement_id = $paiement->create($user, 1, $facture->thirdparty);
|
||||
if ($paiement_id < 0) {
|
||||
setEventMessage($facture->ref . ' ' . $paiement->error, 'errors');
|
||||
setEventMessage($facture->ref.' '.$paiement->error, 'errors');
|
||||
$errorpayment++;
|
||||
} else {
|
||||
$result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', '');
|
||||
if ($result < 0) {
|
||||
setEventMessages($facture->ref . ' ' . $paiement->error, $paiement->errors, 'errors');
|
||||
setEventMessages($facture->ref.' '.$paiement->error, $paiement->errors, 'errors');
|
||||
$errorpayment++;
|
||||
}
|
||||
}
|
||||
@ -555,7 +555,7 @@ $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as u
|
||||
if (!$sall) {
|
||||
$sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
|
||||
}
|
||||
if ($search_categ_cus && $search_categ_cus!=-1) {
|
||||
if ($search_categ_cus && $search_categ_cus != -1) {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
@ -592,7 +592,7 @@ if ($search_product_category > 0) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.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) {
|
||||
@ -606,7 +606,7 @@ $sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' WHERE f.fk_soc = s.rowid';
|
||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
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_product_category > 0) {
|
||||
@ -801,7 +801,7 @@ if (!$sall) {
|
||||
$sql .= ' country.code,';
|
||||
$sql .= " p.rowid, p.ref, p.title,";
|
||||
$sql .= " u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender";
|
||||
if ($search_categ_cus && $search_categ_cus!=-1) {
|
||||
if ($search_categ_cus && $search_categ_cus != -1) {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
@ -821,7 +821,7 @@ if (!$sall) {
|
||||
// Add HAVING from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrint) : "";
|
||||
$sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 ".$hookmanager->resPrint) : "";
|
||||
|
||||
$sql .= ' ORDER BY ';
|
||||
$listfield = explode(',', $sortfield);
|
||||
@ -914,7 +914,7 @@ if ($resql) {
|
||||
if ($search_date_valid_endyear) {
|
||||
$param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
|
||||
}
|
||||
if ($search_datelimit_startday) {
|
||||
if ($search_datelimit_startday) {
|
||||
$param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday);
|
||||
}
|
||||
if ($search_datelimit_startmonth) {
|
||||
@ -1059,7 +1059,7 @@ if ($resql) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete' ,'makepayment'))) {
|
||||
if (in_array($massaction, array('presend', 'predelete', 'makepayment'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
@ -1097,7 +1097,7 @@ if ($resql) {
|
||||
$trackid = 'inv'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($massaction=='makepayment') {
|
||||
if ($massaction == 'makepayment') {
|
||||
$formconfirm = '';
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
@ -1719,7 +1719,13 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven"';
|
||||
if ($contextpage == 'poslist') {
|
||||
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();});"';
|
||||
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();';
|
||||
if (strpos($obj->ref, 'PROV') !== false) {
|
||||
//If is a draft invoice, load var to be able to add products
|
||||
$place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
|
||||
print 'parent.place=\''.$place.'\'';
|
||||
}
|
||||
print '});"';
|
||||
}
|
||||
print '>';
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ $hookmanager->initHooks(array('directdebitcard', 'globalcard'));
|
||||
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', $fieldid, $isdraft);
|
||||
if (!$user->rights->fournisseur->facture->lire) {
|
||||
if (empty($user->rights->fournisseur->facture->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
} else {
|
||||
@ -607,7 +607,6 @@ if ($object->id > 0) {
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
@ -672,7 +671,6 @@ if ($object->id > 0) {
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ $mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
|
||||
if ($mode == 'customer' && !$user->rights->facture->lire) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($mode == 'supplier' && !$user->rights->fournisseur->facture->lire) {
|
||||
if ($mode == 'supplier' && empty($user->rights->fournisseur->facture->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -192,7 +192,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';
|
||||
@ -392,7 +392,7 @@ foreach ($data as $val) {
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
@ -409,7 +409,7 @@ if ($mesg) {
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user