diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 03cd41a43a9..430c7b6abae 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -47,7 +47,8 @@ $main_option = array( 'ACCOUNTING_EXPORT_PREFIX_SPEC', ); -$configuration = AccountancyExport::getTypeConfig(); +$accountancyexport = new AccountancyExport($db); +$configuration = $accountancyexport->getTypeConfig(); $listparam = $configuration['param']; @@ -117,7 +118,7 @@ if ($action == 'update') { if (!$error) { // reload - $configuration = AccountancyExport::getTypeConfig(); + $configuration = $accountancyexport->getTypeConfig(); $listparam = $configuration['param']; setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -237,7 +238,7 @@ if (!$conf->use_javascript_ajax) { print ""; } else { print ''; - $listmodelcsv = AccountancyExport::getType(); + $listmodelcsv = $accountancyexport->getType(); print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0, 0, 0, '', 0, 0, 0, '', '', 1); print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ce0714d5651..2ee947bf720 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -204,7 +204,8 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { unset($arrayfields['t.lettering_code']); } -$listofformat = AccountancyExport::getType(); +$accountancyexport = new AccountancyExport($db); +$listofformat = $accountancyexport->getType(); $formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV; if (empty($listofformat[$formatexportset])) { $formatexportset = 1; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 128b14fa800..2cb4c5fba1c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017-2019 Frédéric France * Copyright (C) 2017 André Schild * Copyright (C) 2020 Guillaume Alexandre + * Copyright (C) 2022 Joachim Kueter * * 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 @@ -34,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; /** @@ -93,11 +95,13 @@ class AccountancyExport */ public function __construct(DoliDB $db) { - global $conf; + global $conf, $hookmanager; $this->db = $db; $this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n"); + + $hookmanager->initHooks(array('accountancyexport')); } /** @@ -105,7 +109,7 @@ class AccountancyExport * * @return array of type */ - public static function getType() + public function getType() { global $langs; @@ -132,6 +136,10 @@ class AccountancyExport self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert', ); + // allow modules to define export formats + global $hookmanager; + $reshook = $hookmanager->executeHooks('getType', $parameters, $listofexporttypes); + ksort($listofexporttypes, SORT_NUMERIC); return $listofexporttypes; @@ -168,7 +176,12 @@ class AccountancyExport self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert', ); - return $formatcode[$type]; + global $hookmanager; + $code = $formatcode[$type]; + $parameters = array('type' => $type); + $reshook = $hookmanager->executeHooks('getFormatCode', $parameters, $code); + + return $code; } /** @@ -176,11 +189,11 @@ class AccountancyExport * * @return array of type */ - public static function getTypeConfig() + public function getTypeConfig() { global $conf, $langs; - return array( + $exporttypes = array( 'param' => array( self::$EXPORT_TYPE_CONFIGURABLE => array( 'label' => $langs->trans('Modelcsv_configurable'), @@ -265,6 +278,11 @@ class AccountancyExport 'txt' => $langs->trans("txt") ), ); + + global $hookmanager; + $parameters = array(); + $reshook = $hookmanager->executeHooks('getTypeConfig', $parameters, $exporttypes); + return $exporttypes; } @@ -350,7 +368,13 @@ class AccountancyExport $this->exportiSuiteExpert($TData); break; default: - $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); + global $hookmanager; + $parameters = array('format' => $formatexportset); + // file contents will be created in the hooked function via print + $reshook = $hookmanager->executeHooks('export', $parameters, $TData); + if ($reshook != 1) { + $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); + } break; } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index f73ff9bf451..3f857ce827b 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -122,12 +122,10 @@ class AdherentType extends CommonObject public $members = array(); /** @var string string other */ - public $other; + public $other = array(); public $multilangs = array(); - public $other = array(); - /** * Constructor diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2ac4fa76682..00eebf78f10 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -585,6 +585,10 @@ complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqls $i = 0; foreach ($tabcomplete as $key => $value) { $i++; + // When a dictionnary is commented + if (!isset($tabcond[$i])) { + continue; + } $tabcomplete[$key]['id'] = $i; $tabcomplete[$key]['cond'] = $tabcond[$i]; $tabcomplete[$key]['rowid'] = $tabrowid[$i]; @@ -607,7 +611,7 @@ if (empty($sortfield)) { $tmp1 = explode(',', empty($tabcomplete[$keytable]['sqlsort']) ? '' : $tabcomplete[$keytable]['sqlsort']); $tmp2 = explode(' ', $tmp1[0]); $sortfield = preg_replace('/^.*\./', '', $tmp2[0]); - $sortorder = $tmp2[1]; + $sortorder = (!empty($tmp2[1]) ? $tmp2[1] : ''); //var_dump($sortfield);var_dump($sortorder); } diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 36136aeef24..83d750e1209 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -257,7 +257,7 @@ if (in_array($type, array('mysql', 'mysqli'))) { } if ($execmethod == 1) { // If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode. - print ''; + print ''; print ''; diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index eae7b5d0fde..6390ad74c18 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -129,6 +129,7 @@ class AssetModel extends CommonObject public $import_key; public $model_pdf; public $status; + public $asset_depreciation_options; // /** // * @var string Field with ID of parent key if this object has a parent diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index c1d5d241340..bf9442b82af 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -113,7 +113,7 @@ class Categorie extends CommonObject * * @todo Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_CAT_FK = array( + public $MAP_CAT_FK = array( 'customer' => 'soc', 'supplier' => 'soc', 'contact' => 'socpeople', @@ -125,7 +125,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_CAT_TABLE = array( + public $MAP_CAT_TABLE = array( 'customer' => 'societe', 'supplier' => 'fournisseur', 'bank_account'=> 'account', @@ -136,7 +136,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_OBJ_CLASS = array( + public $MAP_OBJ_CLASS = array( 'product' => 'Product', 'customer' => 'Societe', 'supplier' => 'Fournisseur', @@ -178,7 +178,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_OBJ_TABLE = array( + public static $MAP_OBJ_TABLE = array( 'customer' => 'societe', 'supplier' => 'societe', 'member' => 'adherent', diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 22a816acc1d..00723597521 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1644,7 +1644,7 @@ if ($action == 'create') { // Ref customer print ''.$langs->trans('RefCustomer').''; - print ''; + print ''; print ''; // Third party diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 9c8b3c653e6..258e264c5a7 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -135,8 +135,13 @@ class Proposals extends DolibarrApi } // Add external contacts ids. - $this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->propal->liste_contact(-1, 'external', $contact_list); + if (is_array($tmparray)) { + $this->propal->contacts_ids = $tmparray; + } + $this->propal->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->propal); } @@ -228,7 +233,10 @@ class Proposals extends DolibarrApi $proposal_static = new Propal($this->db); if ($proposal_static->fetch($obj->rowid)) { // Add external contacts ids - $proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1); + $tmparray = $proposal_static->liste_contact(-1, 'external', 1); + if (is_array($tmparray)) { + $proposal_static->contacts_ids = $tmparray; + } $obj_ret[] = $this->_cleanObjectDatas($proposal_static); } $i++; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index d59505e5fb7..103ef815e48 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -236,7 +236,7 @@ $arrayfields = array( 'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1), - 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), + 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 2795c325fba..ac9ce98777d 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -133,7 +133,10 @@ class Orders extends DolibarrApi } // Add external contacts ids - $this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->commande->liste_contact(-1, 'external', $contact_list); + if (is_array($tmparray)) { + $this->commande->contacts_ids = $tmparray; + } $this->commande->fetchObjectLinked(); // Add online_payment_url, cf #20477 @@ -234,7 +237,10 @@ class Orders extends DolibarrApi $commande_static = new Commande($this->db); if ($commande_static->fetch($obj->rowid)) { // Add external contacts ids - $commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1); + $tmparray = $commande_static->liste_contact(-1, 'external', 1); + if (is_array($tmparray)) { + $commande_static->contacts_ids = $tmparray; + } // Add online_payment_url, cf #20477 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5d4dce6872d..cdabf9f2a5a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -190,7 +190,7 @@ $arrayfields = array( 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), - 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), + 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 05b30d69668..655dfbb8af6 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -32,14 +32,15 @@ */ require '../../main.inc.php'; + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php'; @@ -54,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; // Load translation files required by the page $langs->loadLangs(array("banks", "bills", "categories", "companies", "margins", "salaries", "loan", "donations", "trips", "members", "compta", "accountancy")); @@ -99,6 +101,7 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search $search_req_nb = GETPOST("req_nb", 'alpha'); $search_num_releve = GETPOST("search_num_releve", 'alpha'); $search_conciliated = GETPOST("search_conciliated", 'int'); +$search_fk_bordereau = GETPOST("search_fk_bordereau", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); $toselect = GETPOST('toselect', 'array'); $num_releve = GETPOST("num_releve", "alpha"); @@ -157,20 +160,21 @@ $extrafields->fetch_name_optionals_label('banktransaction'); $search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_'); $arrayfields = array( - 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1), - 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1), - 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1), - 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), - 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1), - 'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500), - 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000), - 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600), - 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), - 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000), - 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001), - 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), - 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020), + 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1,'position'=>10), + 'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1,'position'=>20), + 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1,'position'=>30), + 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1,'position'=>40), + 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1,'position'=>50), + 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1,'position'=>60), + 'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>70), + 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>80), + 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>90), + 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>100), + 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>110), + 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>120), + 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>130), + 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>140), + 'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeReceipt"), 'checked'=>0, 'position'=>150), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -178,7 +182,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); - /* * Actions */ @@ -214,6 +217,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_thirdparty_user = ''; $search_num_releve = ''; $search_conciliated = ''; + $search_fk_bordereau = ''; $toselect = array(); $search_account = ""; @@ -390,8 +394,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->ba } } - - /* * View */ @@ -421,6 +423,7 @@ $paymentvariousstatic = new PaymentVarious($db); $paymentexpensereportstatic = new PaymentExpenseReport($db); $bankstatic = new Account($db); $banklinestatic = new AccountLine($db); +$bordereaustatic = new RemiseCheque($db); $now = dol_now(); @@ -465,6 +468,9 @@ if (!empty($search_num_releve)) { if ($search_conciliated != '' && $search_conciliated != '-1') { $param .= '&search_conciliated='.urlencode($search_conciliated); } +if ($search_fk_bordereau > 0) { + $param .= '$&search_fk_bordereau='.urlencode($search_fk_bordereau); +} if ($search_bid > 0) { $param .= '&search_bid='.urlencode($search_bid); } @@ -568,8 +574,9 @@ if ($id > 0 || !empty($ref)) { llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); } + $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; -$sql .= " b.fk_account, b.fk_type,"; +$sql .= " b.fk_account, b.fk_type, b.fk_bordereau,"; $sql .= " ba.rowid as bankid, ba.ref as bankref"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -621,6 +628,9 @@ if ($search_num_releve) { if ($search_conciliated != '' && $search_conciliated != '-1') { $sql .= " AND b.rappro = ".((int) $search_conciliated); } +if ($search_fk_bordereau > 0) { + $sql .= " AND b.fk_bordereau = " . ((int) $search_fk_bordereau); +} if ($search_thirdparty_user) { $sql.= " AND (b.rowid IN "; $sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu"; @@ -737,6 +747,9 @@ if ($search_conciliated != '' && $search_conciliated != '-1') { if (!empty($search_num_releve)) { $mode_balance_ok = false; } +if (!empty($search_fk_bordereau)) { + $mode_balance_ok = false; +} $sql .= $db->plimit($limit + 1, $offset); //print $sql; @@ -1067,34 +1080,40 @@ if ($resql) { $form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100'); print ''; } + // Numero if (!empty($arrayfields['b.num_chq']['checked'])) { - // Numero print ''; } + // Checked if (!empty($arrayfields['bu.label']['checked'])) { print ''; } + // Ref if (!empty($arrayfields['ba.ref']['checked'])) { print ''; $form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : ''), 0, 'maxwidth100'); print ''; } + // Debit if (!empty($arrayfields['b.debit']['checked'])) { print ''; print ''; print ''; } + // Credit if (!empty($arrayfields['b.credit']['checked'])) { print ''; print ''; print ''; } + // Balance before if (!empty($arrayfields['balancebefore']['checked'])) { print ''; $htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); print $form->textwithpicto('', $htmltext, 1); print ''; } + // Balance if (!empty($arrayfields['balance']['checked'])) { print ''; $htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); @@ -1111,6 +1130,11 @@ if ($resql) { print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1); print ''; } + // Bordereau + if (!empty($arrayfields['b.fk_bordereau']['checked'])) { + print ''; + } + // Actions and select print ''; $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); @@ -1162,6 +1186,10 @@ if ($resql) { if (!empty($arrayfields['b.conciliated']['checked'])) { print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center "); } + if (!empty($arrayfields['b.fk_bordereau']['checked'])) { + print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center "); + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -1673,6 +1701,16 @@ if ($resql) { } } + if (!empty($arrayfields['b.fk_bordereau']['checked'])) { + $bordereaustatic->fetch($objp->fk_bordereau); + print ''; + print $bordereaustatic->getNomUrl(); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action edit/delete and select print ''; // Transaction reconciliated or edit link diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f2e57c8b536..0f8d0b37d53 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) { $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate))); $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); -$usercancreatemargin = $user->rights->margins->creer; -$usercanreadallmargin = $user->rights->margins->liretous; -$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; +$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0); +$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0); +$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php @@ -4317,7 +4317,7 @@ if ($action == 'create') { } $morehtmlref .= ''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', ''); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 51fd8c1dd7a..8a8a9667a28 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -148,7 +148,10 @@ class Invoices extends DolibarrApi // Add external contacts ids if ($contact_list > -1) { - $this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list); + if (is_array($tmparray)) { + $this->invoice->contacts_ids = $tmparray; + } } $this->invoice->fetchObjectLinked(); @@ -267,8 +270,10 @@ class Invoices extends DolibarrApi $invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT'); // Add external contacts ids - $invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1); - + $tmparray = $invoice_static->liste_contact(-1, 'external', 1); + if (is_array($tmparray)) { + $invoice_static->contacts_ids = $tmparray; + } $obj_ret[] = $this->_cleanObjectDatas($invoice_static); } $i++; @@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi // Add external contacts ids if ($contact_list > -1) { - $this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list); + if (is_array($tmparray)) { + $this->template_invoice->contacts_ids = $tmparray; + } } $this->template_invoice->fetchObjectLinked(); diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 43897172779..301f16fb4a5 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -52,7 +52,7 @@ if ($user->socid) { $object = new Facture($db); // Load object if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } $result = restrictedArea($user, 'facture', $object->id); @@ -171,7 +171,7 @@ if ($id > 0 || !empty($ref)) { } $morehtmlref .= ''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 6eb05a16922..03e4a0b4577 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) { } $morehtmlref .= ''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 60efaf36e3d..f524d49eb97 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } // Security check @@ -131,7 +131,7 @@ if (!empty($conf->projet->enabled)) { } $morehtmlref .= ''; -$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status +$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); @@ -140,7 +140,7 @@ print '
'; print '
'; -print '\n"; $total += $objp->total; $total_ttc += $objp->total_ttc; - $totalrecu += $objp->am; + $totalrecu += $objp->amount; $i++; } if ($i > 1) { diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index 84d2765b278..645fd36bc2a 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -290,7 +290,7 @@ if ($action == 'create') { print "\n"; $total += $objp->total; $total_ttc += $objp->total_ttc; - $totalrecu += $objp->am; + $totalrecu += $objp->amount; $i++; } if ($i > 1) { diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 70d8da4c27b..41e036ae937 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -113,6 +113,11 @@ class ChargeSociales extends CommonObject */ public $fk_user; + /** + * @var double total + */ + public $total; + const STATUS_UNPAID = 0; const STATUS_PAID = 1; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index b6a611a47ee..1b83915714d 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -100,6 +100,22 @@ class PaymentSocialContribution extends CommonObject */ public $fk_user_modif; + /** + * @var int ID + */ + public $chid; + + /** + * @var integer|string datepaye + */ + public $datepaye; + + /** + * @var integer|string paiementtype + */ + public $paiementtype; + + /** * Constructor * diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index 8eaf141b06c..cbdb4887869 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -96,6 +96,21 @@ class PaymentVAT extends CommonObject */ public $fk_user_modif; + /** + * @var int ID + */ + public $chid; + + /** + * @var integer|string datepaye + */ + public $datepaye; + + /** + * @var integer|string paiementtype + */ + public $paiementtype; + /** * Constructor * diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 30682fa15b4..b30cc185a98 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -49,6 +49,12 @@ class Tva extends CommonObject */ public $picto = 'payment'; + /** + * @deprecated + * @see $amount + */ + public $total; + public $tms; public $datep; public $datev; @@ -81,6 +87,11 @@ class Tva extends CommonObject */ public $fk_user_modif; + /** + * @var integer|string paiementtype + */ + public $paiementtype; + const STATUS_UNPAID = 0; const STATUS_PAID = 1; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bf33cbe224e..13bf93e2de4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -116,7 +116,7 @@ abstract class CommonObject public $array_languages = null; // Value is array() when load already tried /** - * @var array To sotre result of ->liste_contact() + * @var array To store result of ->liste_contact() */ public $contacts_ids; @@ -8819,7 +8819,7 @@ abstract class CommonObject } } } else { - $this->{$field} = $obj->{$field}; + $this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null; } } diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 36c3cb2c0fe..d67b0c25f66 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -51,6 +51,12 @@ class Cstate // extends CommonObject public $code_departement; public $code; + + /** + * @var string name + */ + public $name = ''; + /** * @var string * @deprecated @@ -58,10 +64,7 @@ class Cstate // extends CommonObject */ public $nom = ''; - /** - * @var string name - */ - public $name = ''; + public $label; public $active; @@ -88,7 +91,6 @@ class Cstate // extends CommonObject */ public function create($user, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -155,7 +157,6 @@ class Cstate // extends CommonObject */ public function fetch($id, $code = '') { - global $langs; $sql = "SELECT"; $sql .= " t.rowid,"; $sql .= " t.code_departement,"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2df4f491105..31f69878dda 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8629,10 +8629,26 @@ class Form } $possiblelinks = array( - 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), - 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), - 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), - 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), + 'propal'=>array( + 'enabled'=>$conf->propal->enabled, + 'perms'=>1, + 'label'=>'LinkToProposal', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), + 'order'=>array( + 'enabled'=>$conf->commande->enabled, + 'perms'=>1, + 'label'=>'LinkToOrder', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), + 'invoice'=>array( + 'enabled'=>$conf->facture->enabled, + 'perms'=>1, + 'label'=>'LinkToInvoice', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), + 'invoice_template'=>array( + 'enabled'=>$conf->facture->enabled, + 'perms'=>1, + 'label'=>'LinkToTemplateInvoice', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), 'contrat'=>array( 'enabled'=>$conf->contrat->enabled, 'perms'=>1, @@ -8640,12 +8656,35 @@ class Form 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' ), - 'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), - 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), - 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), - 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), - 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), - 'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') + 'fichinter'=>array( + 'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToIntervention', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), + 'supplier_proposal'=>array( + 'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToSupplierProposal', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), + 'order_supplier'=>array( + 'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToSupplierOrder', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), + 'invoice_supplier'=>array( + 'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0), + 'perms'=>1, 'label'=>'LinkToSupplierInvoice', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), + 'ticket'=>array( + 'enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToTicket', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), + 'mo'=>array( + 'enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToMo', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') ); } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cbaf59bd311..07bd8ac5a5f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1330,7 +1330,7 @@ class FormFile if ($file['name'] != '.' && $file['name'] != '..' && !preg_match('/\.meta$/i', $file['name'])) { - if ($filearray[$key]['rowid'] > 0) { + if (array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) { $lastrowid = $filearray[$key]['rowid']; } $filepath = $relativepath.$file['name']; @@ -1339,8 +1339,8 @@ class FormFile $nboflines++; print ''."\n"; // Do we have entry into database ? - print ''."\n"; - print ''; + print ''."\n"; + print ''; // File name print ''; + // Ref customer + print ''; + print ''; + // Description (must be a textarea and not html must be allowed (used in list view) print ''; print ''; } + if (!empty($arrayfields['f.ref_client']['checked'])) { + print ''; + } if (!empty($arrayfields['s.nom']['checked'])) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } if (!empty($arrayfields['s.nom']['checked'])) { print ''; print ''; - } - } - print '
'; +print '
'; dol_print_object_info($object); print '
'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5937eda916c..6fd1e2a7322 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -245,7 +245,7 @@ $arrayfields = array( 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292), 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295), 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow - 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), + 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), @@ -1112,7 +1112,7 @@ if ($resql) { if (!empty($user->rights->facture->paiement)) { $arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed"); } - if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) { + if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) { $langs->load("withdrawals"); $arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest"); } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 6f699774d32..fe3bb736ea4 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09'); $object = new Facture($db); // Load object if ($id > 0 || !empty($ref)) { - $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php @@ -148,7 +148,7 @@ if ($id > 0 || !empty($ref)) { } $morehtmlref .= ''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 989fa28b2f0..33d6af875ff 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -384,7 +384,7 @@ if ($object->id > 0) { } $morehtmlref .= ''; - $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam, 0, '', ''); diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index ae4064462e2..655ee13471b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -109,6 +109,16 @@ class Paiement extends CommonObject */ public $ext_payment_id; + /** + * @var string Id of prelevement + */ + public $id_prelevement; + + /** + * @var string num_prelevement + */ + public $num_prelevement; + /** * @var string Name of external payment mode */ diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 640ffc78d99..db48b2767f2 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -291,7 +291,7 @@ if ($action == 'create') { print "
'; diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 1ee9812f4fd..1cfddb588fd 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -422,7 +422,7 @@ class FormSetup if (!array($this->items)) { return false; } foreach ($this->items as $item) { - $item->reloadValueFromConf(); + $item->loadValueFromConf(); } return true; @@ -587,8 +587,11 @@ class FormSetupItem /** @var string $fieldValue */ public $fieldValue; + /** @var string $defaultFieldValue */ + public $defaultFieldValue = null; + /** @var array $fieldAttr fields attribute only for compatible fields like input text */ - public $fieldAttr; + public $fieldAttr = array(); /** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */ public $fieldOverride = false; @@ -648,17 +651,33 @@ class FormSetupItem $this->entity = $conf->entity; $this->confKey = $confKey; - $this->fieldValue = $conf->global->{$this->confKey}; + $this->loadValueFromConf(); } /** - * reload conf value from databases - * @return null + * load conf value from databases + * @return bool + */ + public function loadValueFromConf() + { + global $conf; + if (isset($conf->global->{$this->confKey})) { + $this->fieldValue = $conf->global->{$this->confKey}; + return true; + } else { + $this->fieldValue = null; + return false; + } + } + + /** + * reload conf value from databases is an aliase of loadValueFromConf + * @deprecated + * @return bool */ public function reloadValueFromConf() { - global $conf; - $this->fieldValue = $conf->global->{$this->confKey}; + return $this->loadValueFromConf(); } @@ -791,6 +810,12 @@ class FormSetupItem return $this->fieldInputOverride; } + // Set default value + if (is_null($this->fieldValue)) { + $this->fieldValue = $this->defaultFieldValue; + } + + $this->fieldAttr['name'] = $this->confKey; $this->fieldAttr['id'] = 'setup-'.$this->confKey; $this->fieldAttr['value'] = $this->fieldValue; @@ -807,6 +832,8 @@ class FormSetupItem $out.= $this->generateInputFieldTextarea(); } elseif ($this->type== 'html') { $out.= $this->generateInputFieldHtml(); + } elseif ($this->type== 'color') { + $out.= $this->generateInputFieldColor(); } elseif ($this->type == 'yesno') { $out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1); } elseif (preg_match('/emailtemplate:/', $this->type)) { @@ -825,14 +852,22 @@ class FormSetupItem $out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1); } } else { - if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); } - - $out.= 'fieldAttr).' />'; + $out.= $this->generateInputFieldText(); } return $out; } + /** + * generatec default input field + * @return string + */ + public function generateInputFieldText() + { + if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); } + return 'fieldAttr).' />'; + } + /** * generate input field for textarea * @return string @@ -1029,6 +1064,8 @@ class FormSetupItem $out.= $this->generateOutputFieldSelect(); } elseif ($this->type== 'html') { $out.= $this->fieldValue; + } elseif ($this->type== 'color') { + $out.= $this->generateOutputFieldColor(); } elseif ($this->type == 'yesno') { $out.= ajax_constantonoff($this->confKey); } elseif (preg_match('/emailtemplate:/', $this->type)) { @@ -1102,6 +1139,22 @@ class FormSetupItem return $outPut; } + /** + * @return string + */ + public function generateOutputFieldColor() + { + $this->fieldAttr['disabled']=null; + return $this->generateInputField(); + } + /** + * @return string + */ + public function generateInputFieldColor() + { + $this->fieldAttr['type']= 'color'; + return $this->generateInputFieldText(); + } /** * @return string @@ -1130,6 +1183,16 @@ class FormSetupItem return $this; } + /** + * Set type of input as color + * @return self + */ + public function setAsColor() + { + $this->type = 'color'; + return $this; + } + /** * Set type of input as textarea * @return self diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5fc0d20777c..4e972b0be4e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -272,7 +272,8 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s "cover" => $obj->cover, "position" => (int) $obj->position, "acl" => $obj->acl, - "share" => $obj->share + "share" => $obj->share, + "description" => $obj->description ); } $i++; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e09ab803353..b400a4e7c1b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2959,7 +2959,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor } else { if (!empty($dictsocialnetworks[$type]['url'])) { $link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']); - $htmllink .= ' '.dol_escape_htmltag($value).''; + $htmllink .= ' '.dol_escape_htmltag($value).''; } else { $htmllink .= dol_escape_htmltag($value); } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index e93e5a3e688..29d0cc8cac4 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -612,6 +612,14 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->datec, "day", false, $outputlangs, true), '', 'R'); + if (!empty($object->ref_client)) { + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer") . " : " . dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); + } + + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 95c02af8e73..0000189c998 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -709,15 +709,37 @@ class ImportCsv extends ModeleImports } // Define $listfields and $listvalues to build SQL request - $listfields[] = $fieldname; - - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { - $listvalues[] = "''"; + if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (!in_array("socialnetworks", $listfields)) { + $listfields[] = "socialnetworks"; + } + if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { + $socialkey = array_search("socialnetworks", $listfields); + if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { + $socialnetwork = explode("_", $fieldname)[1]; + $json = new stdClass(); + $json->$socialnetwork = $newval; + $newvalue = json_encode($json); + $listvalues[$socialkey] = "'".$this->db->escape($newvalue)."'"; + } else { + $socialnetwork = explode("_", $fieldname)[1]; + $jsondata = $listvalues[$socialkey]; + $jsondata = str_replace("'", "", $jsondata); + $json = json_decode($jsondata); + $json->$socialnetwork = $newval; + $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; + } + } } else { - $listvalues[] = "'".$this->db->escape($newval)."'"; + $listfields[] = $fieldname; + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'".$this->db->escape($newval)."'"; + } } } $i++; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 7877275b034..257a9a13c6a 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -363,6 +363,8 @@ class ImportXlsx extends ModeleImports $warning = 0; $this->errors = array(); $this->warnings = array(); + $this->nbinsert = 0; + $this->nbupdate = 0; //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); @@ -750,15 +752,38 @@ class ImportXlsx extends ModeleImports } // Define $listfields and $listvalues to build SQL request - $listfields[] = $fieldname; - - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { - $listvalues[] = "''"; + if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (!in_array("socialnetworks", $listfields)) { + $listfields[] = "socialnetworks"; + } + if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { + $socialkey = array_search("socialnetworks", $listfields); + if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { + $socialnetwork = explode("_", $fieldname)[1]; + $json = new stdClass(); + $json->$socialnetwork = $newval; + $newvalue = json_encode($json); + $listvalues[$socialkey] = $newvalue; + } else { + $socialnetwork = explode("_", $fieldname)[1]; + $jsondata = $listvalues[$socialkey]; + $jsondata = str_replace("'", "", $jsondata); + $json = json_decode($jsondata); + $json->$socialnetwork = $this->db->escape($newval); + $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; + } + } } else { - $listvalues[] = "'" . $this->db->escape($newval) . "'"; + $listfields[] = $fieldname; + + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'" . $this->db->escape($newval) . "'"; + } } } $i++; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index ec3f978d011..a9eb5899fc8 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -519,6 +519,16 @@ class modSociete extends DolibarrModules if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); } + // Add social networks fields + if (!empty($conf->socialnetworks->enabled)) { + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; + $resql = $this->db->query($sql); + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 's.socialnetworks_'.$obj->code; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel; + } + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); @@ -718,6 +728,16 @@ class modSociete extends DolibarrModules 's.note_private' => "NotePrivate", 's.note_public' => "NotePublic" ); + // Add social networks fields + if (!empty($conf->socialnetworks->enabled)) { + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; + $resql = $this->db->query($sql); + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 's.socialnetworks_'.$obj->code; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel; + } + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index ff724ab209d..b2164e80175 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -145,6 +145,8 @@ class mod_codeproduct_elephant extends ModeleProductCode */ public function getExample($langs, $objproduct = 0, $type = -1) { + $exampleproduct = $exampleservice = ''; + if ($type == 0 || $type == -1) { $exampleproduct = $this->getNextValue($objproduct, 0); if (!$exampleproduct) { diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 0d7e5278a14..eeb5261ef19 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -55,6 +55,7 @@ $langs->loadLangs(array('bills', 'companies', 'interventions', 'stocks')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); +$ref_client = GETPOST('ref_client', 'alpha'); $socid = (int) GETPOST('socid', 'int'); $contratid = (int) GETPOST('contratid', 'int'); $action = GETPOST('action', 'alpha'); @@ -222,6 +223,7 @@ if (empty($reshook)) { $object->author = $user->id; $object->description = GETPOST('description', 'restricthtml'); $object->ref = $ref; + $object->ref_client = $ref_client; $object->model_pdf = GETPOST('model', 'alpha'); $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); @@ -432,6 +434,7 @@ if (empty($reshook)) { $object->author = $user->id; $object->description = GETPOST('description', 'restricthtml'); $object->ref = $ref; + $object->ref_client = $ref_client; $result = $object->update($user); if ($result < 0) { @@ -449,6 +452,12 @@ if (empty($reshook)) { if ($result < 0) { dol_print_error($db, $object->error); } + } elseif ($action == 'setref_client' && $user->rights->ficheinter->creer) { + // Positionne ref client + $result = $object->setRefClient($user, GETPOST('ref_client', 'alpha')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->ficheinter->supprimer) { $result = $object->delete($user); if ($result < 0) { @@ -879,6 +888,11 @@ if ($action == 'create') { // Ref print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; + print '
'.$langs->trans("Description").''; @@ -1134,10 +1148,10 @@ if ($action == 'create') { $morehtmlref = '
'; // Ref customer - //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', 0, 1); - //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (!empty($conf->projet->enabled)) { $langs->load("projects"); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 3b175a78c0b..ac0f47ee4b3 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -44,6 +44,7 @@ class Fichinter extends CommonObject 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), + 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), @@ -146,6 +147,12 @@ class Fichinter extends CommonObject */ public $fk_project = 0; + /** + * Customer Ref + * @var string + */ + public $ref_client; + /** * @var array extraparams */ @@ -253,6 +260,9 @@ class Fichinter extends CommonObject if (!is_numeric($this->duration)) { $this->duration = 0; } + if (isset($this->ref_client)) { + $this->ref_client = trim($this->ref_client); + } if ($this->socid <= 0) { $this->error = 'ErrorFicheinterCompanyDoesNotExist'; @@ -271,6 +281,7 @@ class Fichinter extends CommonObject $sql .= "fk_soc"; $sql .= ", datec"; $sql .= ", ref"; + $sql .= ", ref_client"; $sql .= ", entity"; $sql .= ", fk_user_author"; $sql .= ", fk_user_modif"; @@ -286,6 +297,7 @@ class Fichinter extends CommonObject $sql .= $this->socid; $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->escape($this->ref)."'"; + $sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null"); $sql .= ", ".((int) $conf->entity); $sql .= ", ".((int) $user->id); $sql .= ", ".((int) $user->id); @@ -372,6 +384,9 @@ class Fichinter extends CommonObject if (!dol_strlen($this->fk_project)) { $this->fk_project = 0; } + if (isset($this->ref_client)) { + $this->ref_client = trim($this->ref_client); + } $error = 0; @@ -380,6 +395,7 @@ class Fichinter extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; $sql .= "description = '".$this->db->escape($this->description)."'"; $sql .= ", duree = ".((int) $this->duration); + $sql .= ", ref_client = ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null"); $sql .= ", fk_projet = ".((int) $this->fk_project); $sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); $sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); @@ -422,7 +438,7 @@ class Fichinter extends CommonObject */ public function fetch($rowid, $ref = '') { - $sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,"; + $sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut,"; $sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql .= " f.date_valid as datev,"; $sql .= " f.tms as datem,"; @@ -443,6 +459,7 @@ class Fichinter extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; + $this->ref_client = $obj->ref_client; $this->description = $obj->description; $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; @@ -1289,6 +1306,7 @@ class Fichinter extends CommonObject // Initialise parametres $this->id = 0; $this->ref = 'SPECIMEN'; + $this->ref_client = 'SPECIMEN CLIENT'; $this->specimen = 1; $this->socid = 1; $this->datec = $now; @@ -1376,6 +1394,62 @@ class Fichinter extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Set customer reference number + * + * @param User $user Object user that modify + * @param string $ref_client Customer reference + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok + */ + public function setRefClient($user, $ref_client, $notrigger = 0) + { + // phpcs:enable + if (!empty($user->rights->ficheinter->creer)) { + $error = 0; + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref_client = ".(empty($ref_client) ? 'NULL' : "'".$this->db->escape($ref_client)."'"); + $sql .= " WHERE rowid = ".((int) $this->id); + + dol_syslog(__METHOD__.' $this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->errors[] = $this->db->error(); + $error++; + } + + if (!$error) { + $this->oldcopy = clone $this; + $this->ref_client = $ref_client; + } + + if (!$notrigger && empty($error)) { + // Call trigger + $result = $this->call_trigger('FICHINTER_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if (!$error) { + $this->db->commit(); + return 1; + } else { + foreach ($this->errors as $errmsg) { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } + } else { + return -1; + } + } } /** diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f0e028ea92f..d83a1438f1a 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -58,6 +58,7 @@ $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'interventionlist'; $search_ref = GETPOST('search_ref') ?GETPOST('search_ref', 'alpha') : GETPOST('search_inter', 'alpha'); +$search_ref_client = GETPOST('search_ref_client', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); $search_desc = GETPOST('search_desc', 'alpha'); $search_projet_ref = GETPOST('search_projet_ref', 'alpha'); @@ -122,6 +123,7 @@ if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) { // Definition of fields for list $arrayfields = array( 'f.ref'=>array('label'=>'Ref', 'checked'=>1), + 'f.ref_client'=>array('label'=>'RefCustomer', 'checked'=>1), 's.nom'=>array('label'=>'ThirdParty', 'checked'=>1), 'pr.ref'=>array('label'=>'Project', 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1)), 'c.ref'=>array('label'=>'Contract', 'checked'=>1, 'enabled'=>(empty($conf->contrat->enabled) ? 0 : 1)), @@ -166,6 +168,7 @@ if (empty($reshook)) { // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ""; + $search_ref_client = ""; $search_company = ""; $search_projet_ref = ""; $search_contrat_ref = ""; @@ -218,7 +221,7 @@ foreach ($arrayfields as $tmpkey => $tmpval) { } $sql = "SELECT"; -$sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,"; +$sql .= " f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) { $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; } @@ -267,6 +270,9 @@ $sql .= " AND f.fk_soc = s.rowid"; if ($search_ref) { $sql .= natural_search('f.ref', $search_ref); } +if ($search_ref_client) { + $sql .= natural_search('f.ref_client', $search_ref_client); +} if ($search_company) { $sql .= natural_search('s.nom', $search_company); } @@ -351,6 +357,9 @@ if ($resql) { if ($search_ref) { $param .= "&search_ref=".urlencode($search_ref); } + if ($search_ref_client) { + $param .= "&search_ref_client=".urlencode($search_ref_client); + } if ($search_company) { $param .= "&search_company=".urlencode($search_company); } @@ -447,6 +456,11 @@ if ($resql) { print ''; print '
'; + print ''; + print ''; print ''; @@ -526,6 +540,9 @@ if ($resql) { if (!empty($arrayfields['f.ref']['checked'])) { print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); } + if (!empty($arrayfields['f.ref_client']['checked'])) { + print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], "f.ref_client", "", $param, '', $sortfield, $sortorder); + } if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); } @@ -582,6 +599,7 @@ if ($resql) { $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; + $objectstatic->ref_client = $obj->ref_client; $objectstatic->statut = $obj->status; $objectstatic->status = $obj->status; @@ -630,6 +648,15 @@ if ($resql) { $totalarray['nbfield']++; } } + if (!empty($arrayfields['f.ref_client']['checked'])) { + // Customer ref + print ''; + print $obj->ref_client; + print ''; print $companystatic->getNomUrl(1, '', 44); diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index bf3d7052a86..8fc181e18e0 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -67,6 +67,15 @@ class PaiementFourn extends Paiement */ public $type_code; + /** + * @var string Id of prelevement + */ + public $id_prelevement; + + /** + * @var string num_prelevement + */ + public $num_prelevement; /** diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 287327f2a6a..b4193004a13 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -720,6 +720,11 @@ if (empty($reshook)) { //exit; // Replacement invoice + if (GETPOST('type', 'int') === '') { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); + $error++; + } + if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) { if (empty($dateinvoice)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors'); @@ -1974,10 +1979,10 @@ if ($action == 'create') { $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; } else { - $cond_reglement_id = $societe->cond_reglement_supplier_id; - $mode_reglement_id = $societe->mode_reglement_supplier_id; - $transport_mode_id = $societe->transport_mode_supplier_id; - $fk_account = $societe->fk_account; + $cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0; + $mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0; + $transport_mode_id = !empty($societe->transport_mode_supplier_id) ? $societe->transport_mode_supplier_id : 0; + $fk_account = !empty($societe->fk_account) ? $societe->fk_account : 0; $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); @@ -2004,7 +2009,7 @@ if ($action == 'create') { print '
'; print ''; print ''; - if ($societe->id > 0) { + if (!empty($societe->id) && $societe->id > 0) { print ''."\n"; } print ''; @@ -2030,12 +2035,12 @@ if ($action == 'create') { print '
'.$langs->trans('Supplier').''; - if ($societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) { + if (!empty($societe->id) && $societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) { $absolute_discount = $societe->getAvailableDiscounts('', '', 0, 1); print $societe->getNomUrl(1, 'supplier'); print ''; } else { - print img_picto('', 'company').$form->select_company($societe->id, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); + print img_picto('', 'company').$form->select_company(!empty($societe->id) ? $societe->id : 0, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); // reload page to retrieve supplier informations if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { print ''; - } - } elseif ($val['type'] == 'product') { - if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); - $form->select_produits($selected, $constname, '', 0); - } - } else { - print ''; - } - print '
'; - - print '
'; - print ''; - print '
'; - - print ''; - } - + print $formSetup->generateOutput(true); print '
'; +} elseif (!empty($formSetup->items)) { + print $formSetup->generateOutput(); + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; } else { - if ($useFormSetup && (float) DOL_VERSION >= 15) { - if (!empty($formSetup->items)) { - print $formSetup->generateOutput(); - } - } else { - if (!empty($arrayofparameters)) { - print ''; - print ''; - - foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { - $setupnotempty++; - print ''; - } - } - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); - print $form->textwithpicto($langs->trans($constname), $tooltiphelp); - print ''; - - if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); - } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; - } elseif ($val['type'] == 'yesno') { - print ajax_constantonoff($constname); - } elseif (preg_match('/emailtemplate:/', $val['type'])) { - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $tmp = explode(':', $val['type']); - - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); - if ($template<0) { - setEventMessages(null, $formmail->errors, 'errors'); - } - print $langs->trans($template->label); - } elseif (preg_match('/category:/', $val['type'])) { - $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); - if ($result < 0) { - setEventMessages(null, $c->errors, 'errors'); - } elseif ($result > 0 ) { - $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text - $toprint = array(); - foreach ($ways as $way) { - $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; - } - print '
      ' . implode(' ', $toprint) . '
    '; - } - } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { - print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { - print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { - print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { - print $langs->trans("NorProspectNorCustomer"); - } - } elseif ($val['type'] == 'product') { - $product = new Product($db); - $resprod = $product->fetch($conf->global->{$constname}); - if ($resprod > 0) { - print $product->ref; - } elseif ($resprod < 0) { - setEventMessages(null, $product->errors, "errors"); - } - } else { - print $conf->global->{$constname}; - } - print '
    '; - } - } - - if ($setupnotempty) { - print '
    '; - print ''.$langs->trans("Modify").''; - print '
    '; - } else { - print '
    '.$langs->trans("NothingToSetup"); - } + print '
    '.$langs->trans("NothingToSetup"); } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index a0868fa0580..bfe753cd244 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -150,6 +150,12 @@ class MyObject extends CommonObject */ public $amount; + /** + * @var int Thirdparty ID + */ + public $socid; // both socid and fk_soc are used + public $fk_soc; // both socid and fk_soc are used + /** * @var int Status */ diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 211db6e70ad..0b57c4ed306 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -55,6 +55,8 @@ $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); $status = GETPOST('status', 'int'); $opp_status = GETPOST('opp_status', 'int'); $opp_percent = price2num(GETPOST('opp_percent', 'alpha')); +$objcanvas = GETPOST("objcanvas", "alpha"); +$comefromclone = GETPOST("comefromclone", "alpha"); if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && !GETPOST("cancel"))) { accessforbidden(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 737bd94e2a7..c08880e44ea 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -103,7 +103,7 @@ $search_date_end_endday = GETPOST('search_date_end_endday', 'int'); $search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projecttasklist'; - +$optioncss = GETPOST('optioncss', 'aZ'); //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 686c301af79..e546986ba98 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -408,18 +408,40 @@ class Societe extends CommonObject */ public $idprof1; + /** + * @var string Professional ID 1 + * @deprecated + * @see $idprof1 + */ + public $siren; + + /** * Professional ID 2 (Ex: Siret in France) * @var string */ public $idprof2; + /** + * @var string Professional ID 2 + * @deprecated + * @see $idprof2 + */ + public $siret; + /** * Professional ID 3 (Ex: Ape in France) * @var string */ public $idprof3; + /** + * @var string Professional ID 3 + * @deprecated + * @see $idprof3 + */ + public $ape; + /** * Professional ID 4 (Ex: RCS in France) * @var string diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 6478df005d6..0dc3317b1ef 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -339,6 +339,7 @@ if ($contextpage == 'employeelist' && $search_employee == 1) { } $morejs = array(); $morecss = array(); +$morehtmlright = ""; // Build and execute select // -------------------------------------------------------------------- diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 889599e2fa9..55876016680 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -340,7 +340,7 @@ if ($result) { $obj = $db->fetch_object($result); // If line is for a module that does not exist anymore (absent of includes/module), we ignore it - if (empty($modules[$obj->module])) { + if (!isset($obj->module) || empty($modules[$obj->module])) { $i++; continue; }