diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 522576350e7..27f23d36a74 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -509,10 +509,9 @@ $moreforfilter = ''; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= '
'; -$moreforfilter .= $langs->trans('From').' '; -$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200'); -$moreforfilter .= ' '.$langs->trans('to').' '; -$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200'); +$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200'); +$moreforfilter .= ' '; +$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200'); $moreforfilter .= '
'; $moreforfilter .= '
'; @@ -671,23 +670,19 @@ while ($i < min($num, $limit)) { $accountg = length_accountg($line->numero_compte); //if (empty($accountg)) $accountg = '-'; + $colspan = 0; // colspan before field 'label of operation' + $colspanend = 3; // colspan after debit/credit + if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } + // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - $colnumber = 5; - $colnumberend = 8; - - if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_export']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_validated']['checked'])) { - $colnumber--; - } - - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; // Show a subtotal by accounting account if (isset($displayed_account_number)) { print ''; @@ -926,9 +921,7 @@ while ($i < min($num, $limit)) { $i++; } -if ($num > 0) { - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; +if ($num > 0 && $colspan > 0) { print ''; print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; print ''.price($sous_total_debit).''; diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index efc93f1b96c..5e83c729fb1 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -511,10 +511,9 @@ $moreforfilter = ''; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= '
'; -$moreforfilter .= $langs->trans('From').' '; -$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, 'maxwidth200'); -$moreforfilter .= ' '.$langs->trans('to').' '; -$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, 'maxwidth200'); +$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200'); +$moreforfilter .= ' '; +$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200'); $moreforfilter .= '
'; $moreforfilter .= '
'; @@ -673,23 +672,19 @@ while ($i < min($num, $limit)) { $accountg = length_accounta($line->subledger_account); //if (empty($accountg)) $accountg = '-'; + $colspan = 0; // colspan before field 'label of operation' + $colspanend = 3; // colspan after debit/credit + if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } + // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - $colnumber = 5; - $colnumberend = 8; - - if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_export']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_validated']['checked'])) { - $colnumber--; - } - - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; // Show a subtotal by accounting account if (isset($displayed_account_number)) { print ''; @@ -937,9 +932,7 @@ while ($i < min($num, $limit)) { $i++; } -if ($num > 0) { - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; +if ($num > 0 && $colspan > 0) { print ''; print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; print ''.price($sous_total_debit).''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 34e533974fc..bdda4583d54 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -177,7 +177,7 @@ $accountingjournalstatic->fetch($id_journal); $journal = $accountingjournalstatic->code; $journal_label = $accountingjournalstatic->label; - +//print $sql; dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -252,6 +252,7 @@ if ($result) { ); // Set accountancy code for user + // $obj->accountancy_code is the accountancy_code of table u=user but it is defined only if a link with type 'user' exists) $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : ''); $tabuser[$obj->rowid] = array( @@ -277,7 +278,7 @@ if ($result) { $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); } - // Load of url links to the line into llx_bank + // Load of url links to the line into llx_bank (so load llx_bank_url) $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) // By default @@ -287,7 +288,7 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links) && count($links) > 0) { - // Now loop on each link of record in bank. + // Now loop on each link of record in bank (code similar to bankentries_list.php) foreach ($links as $key => $val) { if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { // So we excluded 'company' and 'user' here. We want only payment lines @@ -302,6 +303,7 @@ if ($result) { } } + // Special case to ask later to add more request to get information for old links without company link. if ($links[$key]['type'] == 'withdraw') { $tabmoreinfo[$obj->rowid]['withdraw'] = 1; } @@ -401,6 +403,44 @@ if ($result) { $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; + + // This part of code is no more required. it is here to solve case where a link were missing (ith v14.0.0) and keep writing in accountancy complete. + // Note: A better way to fix this is to delete payement of salary and recreate it, or to fix the bookkeeping table manually after. + if (!empty($conf->global->ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT)) { + $tmpsalary = new Salary($db); + $tmpsalary->fetch($paymentsalstatic->id); + $tmpsalary->fetch_user($tmpsalary->fk_user); + + $userstatic->id = $tmpsalary->user->id; + $userstatic->name = $tmpsalary->user->name; + $userstatic->email = $tmpsalary->user->email; + $userstatic->firstname = $tmpsalary->user->firstname; + $userstatic->lastname = $tmpsalary->user->lastname; + $userstatic->statut = $tmpsalary->user->statut; + $userstatic->accountancy_code = $tmpsalary->user->accountancy_code; + + if ($userstatic->id > 0) { + $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0); + } else { + $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen + } + + if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user. + $compta_user = $userstatic->accountancy_code; + if ($compta_user) { + $tabtp[$obj->rowid][$compta_user] += $obj->amount; + $tabuser[$obj->rowid] = array( + 'id' => $userstatic->id, + 'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname), + 'lastname' => $userstatic->lastname, + 'firstname' => $userstatic->firstname, + 'email' => $userstatic->email, + 'accountancy_code' => $compta_user, + 'status' => $userstatic->statut + ); + } + } + } } elseif ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= $paymentexpensereportstatic->getNomUrl(2); @@ -468,7 +508,7 @@ if ($result) { } } - // If no links were found to know the amount on thirdparty, we init it to account 'NotDefined'. + // If no links were found to know the amount on thirdparty/user, we init it to account 'NotDefined'. if (empty($tabtp[$obj->rowid])) { $tabtp[$obj->rowid]['NotDefined'] = $tabbq[$obj->rowid][$compta_bank]; } @@ -1162,9 +1202,9 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'unknown') { // We will accept writing, but into a waiting account if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') { - print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; + print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; } else { - print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account + print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account } } else { // We will refuse writing @@ -1187,7 +1227,7 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'member') { $errorstring = 'MainAccountForSubscriptionPaymentNotDefined'; } - print ''.$langs->trans($errorstring).''; + print ''.$langs->trans($errorstring).''; } } else { print $accounttoshow; @@ -1196,7 +1236,7 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; - if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payment with subledger + if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payments that uses a subledger $accounttoshowsubledger = length_accounta($k); if ($accounttoshow != $accounttoshowsubledger) { if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') { @@ -1205,14 +1245,14 @@ if (empty($action) || $action == 'view') { var_dump($tabbq[$key]);*/ //print ''.$langs->trans("ThirdpartyAccountNotDefined").''; if (!empty($tabcompany[$key]['code_compta'])) { - if (in_array($tabtype[$key], array('payment_various'))) { + if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) { // For such case, if subledger is not defined, we won't use subledger accounts. - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; } else { - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; } } else { - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").''; + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").''; } } else { print $accounttoshowsubledger; @@ -1220,10 +1260,15 @@ if (empty($action) || $action == 'view') { } } print ""; + print "".$reflabel.""; + print ''.$val["type_payment"].""; + print ''.($mt < 0 ? price(-$mt) : '').""; + print ''.($mt >= 0 ? price($mt) : '').""; + print ""; } } diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index be5dc4e76e6..43ad8c15929 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -156,36 +156,38 @@ print ""; // Bank account (from Banks module) print ''.$langs->trans("BankToPayCreditTransfer").''; -print ''; -$form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1); +print ''; +print img_picto('', 'bank_account', 'class="pictofixedwidth"'); +print $form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1, '', 0, 'minwidth200', 1); print ''; /* Moved to bank account data // ICS print ''.$langs->trans("ICS").''; -print ''; +print ''; print ''; print ''; */ //User print ''.$langs->trans("ResponsibleUser").''; -print ''; -print $form->select_dolusers($conf->global->PAYMENTBYBANKTRANSFER_USER, 'PAYMENTBYBANKTRANSFER_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print ''; +print img_picto('', 'user', 'class="pictofixedwidth"'); +print $form->select_dolusers($conf->global->PAYMENTBYBANKTRANSFER_USER, 'PAYMENTBYBANKTRANSFER_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'minwidth200 maxwidth500'); print ''; print ''; /* //EntToEnd print ''.$langs->trans("END_TO_END").''; -print ''; -print ''; +print ''; +print ''; print ''; //USTRD print ''.$langs->trans("USTRD").''; -print ''; -print ''; +print ''; +print ''; print ''; */ @@ -195,7 +197,7 @@ print ''; if (!$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS) { $conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS = 0; } -print ''; +print ''; print ''; print ''; print '
'; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index c7de6d59896..01e3b6d4913 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -160,8 +160,9 @@ print ""; // Bank account (from Banks module) print ''.$langs->trans("BankToReceiveWithdraw").''; -print ''; -$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1); +print ''; +print img_picto('', 'bank_account', 'class="pictofixedwidth"'); +print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1, '', 0, 'minwidth200', 1); print ''; /* Moved to bank account data @@ -179,8 +180,9 @@ print ''; //User print ''.$langs->trans("ResponsibleUser").''; -print ''; -print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print ''; +print img_picto('', 'user', 'class="pictofixedwidth"'); +print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'minwidth200 maxwidth500'); print ''; print ''; @@ -189,8 +191,8 @@ print ''; $htmltext = $langs->trans("KeepThisEmptyInMostCases"); print $form->textwithpicto($langs->trans("END_TO_END"), $htmltext); print ''; -print ''; -print ''; +print ''; +print ''; print ''; //USTRD @@ -199,16 +201,16 @@ $htmltext = $langs->trans("KeepThisEmptyInMostCases"); print $form->textwithpicto($langs->trans("USTRD"), $htmltext); print ''; print ''; -print ''; +print ''; print ''; //ADDDAYS print ''.$langs->trans("ADDDAYS").''; -print ''; +print ''; if (empty($conf->global->PRELEVEMENT_ADDDAYS)) { $conf->global->PRELEVEMENT_ADDDAYS = 0; } -print ''; +print ''; print ''; print ''; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index f307a5905b8..bc587845cda 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -59,8 +59,10 @@ $specimenthirdparty->initAsSpecimen(); if ($action == 'updateMask') { $maskconstinvoice = GETPOST('maskconstinvoice', 'alpha'); $maskconstcredit = GETPOST('maskconstcredit', 'alpha'); + $maskconstdeposit = GETPOST('maskconstdeposit', 'alpha'); $maskinvoice = GETPOST('maskinvoice', 'alpha'); $maskcredit = GETPOST('maskcredit', 'alpha'); + $maskdeposit = GETPOST('maskdeposit', 'alpha'); if ($maskconstinvoice) { $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity); @@ -68,6 +70,9 @@ if ($action == 'updateMask') { if ($maskconstcredit) { $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity); } + if ($maskconstdeposit) { + $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity); + } if (!($res > 0)) { $error++; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 666621cbdd6..14aeee29d69 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1346,7 +1346,7 @@ if ($resql) { print ''; print $labeltoshow; // Already escaped - // Add links after description + // Add info about links after description $cachebankaccount = array(); foreach ($links as $key => $val) { print ''; @@ -1424,6 +1424,7 @@ if ($resql) { } elseif ($links[$key]['type'] == 'sc') { } elseif ($links[$key]['type'] == 'vat') { } elseif ($links[$key]['type'] == 'salary') { + // Information is already shown using the payment_salary link. No need of this link. } else { // Show link with label $links[$key]['label'] if (!empty($objp->label) && !empty($links[$key]['label'])) { @@ -1530,15 +1531,21 @@ if ($resql) { } if ($companylinked_id) { - // TODO Add a cache of loaded companies here + // TODO Add a cache of loaded companies here ? $companystatic->fetch($companylinked_id); print $companystatic->getNomUrl(1); } elseif ($userlinked_id && (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) { - // TODO Add a cache of loaded users here - $userstatic->fetch($userlinked_id); - print $userstatic->getNomUrl(1); + // Get object user from cache or load it + if (!empty($conf->cache['user'][$userlinked_id])) { + $tmpuser = $conf->cache['user'][$userlinked_id]; + } else { + $tmpuser = new User($db); + $tmpuser->fetch($userlinked_id); + $conf->cache['user'][$userlinked_id] = $tmpuser; + } + print $tmpuser->getNomUrl(1); } else { print ' '; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8619ff25dae..ed61da3592e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -399,9 +399,9 @@ class Account extends CommonObject /** * Add a link between bank line record and its source * - * @param int $line_id Id ecriture bancaire - * @param int $url_id Id parametre url - * @param string $url Url + * @param int $line_id Id of bank entry + * @param int $url_id Id of object related to link + * @param string $url Url (deprecated, we use now 'url_id' and 'type' instead) * @param string $label Link label * @param string $type Type of link ('payment', 'company', 'member', ...) * @return int <0 if KO, id line if OK @@ -412,13 +412,13 @@ class Account extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; $sql .= "fk_bank"; $sql .= ", url_id"; - $sql .= ", url"; + $sql .= ", url"; // deprecated $sql .= ", label"; $sql .= ", type"; $sql .= ") VALUES ("; $sql .= " ".((int) $line_id); - $sql .= ", '".$this->db->escape($url_id)."'"; - $sql .= ", '".$this->db->escape($url)."'"; + $sql .= ", ".((int) $url_id); + $sql .= ", '".$this->db->escape($url)."'"; // dperecated $sql .= ", '".$this->db->escape($label)."'"; $sql .= ", '".$this->db->escape($type)."'"; $sql .= ")"; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 2c33085aa6d..05aed6a215e 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -624,21 +624,21 @@ if ($result) { print ''; - print '"; + print '"; if ($user->rights->banque->consolidate) { print ''; } else { - print ''; + print ''; } print ''; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 937750648bb..be18099b6a8 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -67,6 +67,7 @@ $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard')); /* * Actions */ + if (GETPOST('cancel', 'alpha')) { $massaction = ''; } @@ -165,7 +166,11 @@ llxHeader('', $langs->trans("NewStandingOrder")); if (prelevement_check_config($type) < 0) { $langs->load("errors"); - setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors'); + $modulenametoshow = "Withdraw"; + if ($type == 'bank-transfer') { + $modulenametoshow = "PaymentByBankTransfer"; + } + setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv($modulenametoshow)), null, 'errors'); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 55f53a6e057..9bcbf08f71a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1953,15 +1953,12 @@ class Form } dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); $i = 0; if ($num) { - // Enhance with select2 - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname); - // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined $out .= ''; + + if ($num) { + // Enhance with select2 + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); + } } else { dol_print_error($this->db); } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a7b732643c4..89f4c37f459 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1345,15 +1345,15 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Accounting $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); - // Balance - $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); - // General Ledger $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); // Journals $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); + // Account Balance + $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); + // Files if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index ec74c9361f5..771f0a83e7b 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -246,9 +246,9 @@ DescThirdPartyReport=Consult here the list of third-party customers and vendors ListAccounts=List of the accounting accounts UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error -ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. We will use %s +ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Subledger account not defined or third party or user unknown. We will use %s ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Third-party unknown and subledger not defined on the payment. We will keep the subledger account value empty. -ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Third-party account not defined or third party unknown. Blocking error. +ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Subledger account not defined or third party or user unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service OpeningBalance=Opening balance diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index f10adee334e..4408afd9ff1 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2021 Laurent Destailleur * Copyright (C) 2013-2014 Cedric GROSS * * This program is free software; you can redistribute it and/or modify @@ -44,8 +44,8 @@ class Productbatch extends CommonObject public $tms = ''; public $fk_product_stock; - public $sellby = ''; - public $eatby = ''; + public $sellby = ''; // dlc + public $eatby = ''; // dmd/dluo public $batch = ''; public $qty; public $warehouseid; diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index e2b199780f0..76236bb88aa 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -477,7 +477,7 @@ class PaymentSalary extends CommonObject * All payment properties must have been set first like after a call to create(). * * @param User $user Object of user making payment - * @param string $mode 'payment_sc' + * @param string $mode 'payment_salary' * @param string $label Label to use in bank record * @param int $accountid Id of bank account to do link with * @param string $emetteur_nom Name of transmitter @@ -516,8 +516,8 @@ class PaymentSalary extends CommonObject $this->datev ); - // Mise a jour fk_bank dans llx_paiement. - // On connait ainsi le paiement qui a genere l'ecriture bancaire + // Update fk_bank into llx_paiement_salary. + // so we know the payment that was used to generated the bank entry. if ($bank_line_id > 0) { $result = $this->update_fk_bank($bank_line_id); if ($result <= 0) { @@ -525,9 +525,12 @@ class PaymentSalary extends CommonObject dol_print_error($this->db); } - // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction + // Add link 'payment_salary' in bank_url between payment and bank transaction $url = ''; - if ($mode == 'payment_salary') $url = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='; + if ($mode == 'payment_salary') { + $url = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='; + } + if ($url) { $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); if ($result <= 0) { @@ -536,14 +539,31 @@ class PaymentSalary extends CommonObject } } - // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) - $linkaddedforthirdparty = array(); + // Add link 'user' in bank_url between user and bank transaction foreach ($this->amounts as $key => $value) { - if ($mode == 'payment_salary') { - $salary = new Salary($this->db); - $salary->fetch($key); - $result = $acc->add_url_line($bank_line_id, $salary->id, DOL_URL_ROOT.'/salaries/card.php?id=', '('.$salary->label.')', 'salary'); - if ($result <= 0) dol_print_error($this->db); + if (!$error) { + if ($mode == 'payment_salary') { + $salary = new Salary($this->db); + $salary->fetch($key); + $salary->fetch_user($salary->fk_user); + + $fuser = $salary->user; + + if ($fuser->id > 0) { + $result = $acc->add_url_line( + $bank_line_id, + $fuser->id, + DOL_URL_ROOT.'/user/card.php?id=', + $fuser->getFullName($langs), + 'user' + ); + } + if ($result <= 0) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->error); + $error++; + } + } } } } else { diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 35ceb8a1931..cc50c57ec84 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -88,6 +88,12 @@ class Salary extends CommonObject */ public $fk_user_modif; + /** + * @var user User + */ + public $user; + + const STATUS_UNPAID = 0; const STATUS_PAID = 1; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 0d9de5d857f..c29fc519258 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -30,10 +30,13 @@ $langs->loadLangs(array("products", "other")); $id = GETPOST('id', 'int'); $valueid = GETPOST('valueid', 'int'); $ref = GETPOST('ref', 'alpha'); -$weight_impact = GETPOST('weight_impact', 'alpha'); -$price_impact = GETPOST('price_impact', 'alpha'); +$weight_impact = price2num(GETPOST('weight_impact', 'alpha'), 2); $price_impact_percent = (bool) GETPOST('price_impact_percent'); - +if ($price_impact_percent) { + $price_impact = price2num(GETPOST('price_impact', 'alpha'), 2); +} else { + $price_impact = price2num(GETPOST('price_impact', 'alpha'), 'MU'); +} $level_price_impact = GETPOST('level_price_impact', 'array'); $level_price_impact_percent = GETPOST('level_price_impact_percent', 'array'); diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index dcf4fdcdb43..ecb42ba25e2 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -16,8 +16,8 @@ */ require '../main.inc.php'; -require DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; $action = GETPOST('action', 'aZ09'); $object = new ProductAttribute($db);
'.$langs->trans("Conciliation")."
'.$form->textwithpicto($langs->trans("AccountStatement"), $langs->trans("InputReceiptNumber"))."'; if ($objp->rappro) { - print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; + print 'rappro ? ' disabled' : '').'>'; print ''; } else { - print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; + print 'rappro ? ' disabled' : '').'>'; } if ($objp->num_releve) { print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; } print ''.$objp->num_releve.' '.$objp->num_releve.'