Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/filefunc.inc.php
This commit is contained in:
Laurent Destailleur 2021-08-03 17:08:49 +02:00
commit ede571dcfe
18 changed files with 204 additions and 120 deletions

View File

@ -509,10 +509,9 @@ $moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$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 .= '</div>';
$moreforfilter .= '</div>';
@ -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 '<tr class="liste_total">';
@ -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 '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';

View File

@ -511,10 +511,9 @@ $moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$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 .= '</div>';
$moreforfilter .= '</div>';
@ -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 '<tr class="liste_total">';
@ -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 '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';

View File

@ -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 '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
print '<span class="error small">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
} else {
print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
print '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // 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 '<span class="error">'.$langs->trans($errorstring).'</span>';
print '<span class="error small">'.$langs->trans($errorstring).'</span>';
}
} else {
print $accounttoshow;
@ -1196,7 +1236,7 @@ if (empty($action) || $action == 'view') {
// Subledger account
print "<td>";
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 '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
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 '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
print '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
} else {
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
print '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
}
} else {
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
print '<span class="error small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
}
} else {
print $accounttoshowsubledger;
@ -1220,10 +1260,15 @@ if (empty($action) || $action == 'view') {
}
}
print "</td>";
print "<td>".$reflabel."</td>";
print '<td class="center">'.$val["type_payment"]."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
}
}

View File

@ -156,36 +156,38 @@ print "</tr>";
// Bank account (from Banks module)
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("BankToPayCreditTransfer").'</td>';
print '<td class="left">';
$form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1);
print '<td>';
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 '</td></tr>';
/* Moved to bank account data
// ICS
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ICS").'</td>';
print '<td class="left">';
print '<td>';
print '<input type="text" name="PAYMENTBYBANKTRANSFER_ICS" value="'.$conf->global->PAYMENTBYBANKTRANSFER_ICS.'" size="15" ></td>';
print '</td></tr>';
*/
//User
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
print '<td class="left">';
print $form->select_dolusers($conf->global->PAYMENTBYBANKTRANSFER_USER, 'PAYMENTBYBANKTRANSFER_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<td>';
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 '</td>';
print '</tr>';
/*
//EntToEnd
print '<tr class="oddeven"><td>'.$langs->trans("END_TO_END").'</td>';
print '<td class="left">';
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->PRELEVEMENT_END_TO_END.'" size="15" ></td>';
print '<td>';
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->PRELEVEMENT_END_TO_END.'" class="width100"></td>';
print '</td></tr>';
//USTRD
print '<tr class="oddeven"><td>'.$langs->trans("USTRD").'</td>';
print '<td class="left">';
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->PRELEVEMENT_USTRD.'" size="15" ></td>';
print '<td>';
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->PRELEVEMENT_USTRD.'" class="width100"></td>';
print '</td></tr>';
*/
@ -195,7 +197,7 @@ print '<td class="left">';
if (!$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS) {
$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS = 0;
}
print '<input type="text" name="PAYMENTBYBANKTRANSFER_ADDDAYS" value="'.$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS.'" size="15" ></td>';
print '<input type="text" name="PAYMENTBYBANKTRANSFER_ADDDAYS" value="'.$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS.'" class="width50"></td>';
print '</td></tr>';
print '</table>';
print '<br>';

View File

@ -160,8 +160,9 @@ print "</tr>";
// Bank account (from Banks module)
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("BankToReceiveWithdraw").'</td>';
print '<td class="left">';
$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1);
print '<td>';
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 '</td></tr>';
/* Moved to bank account data
@ -179,8 +180,9 @@ print '</td></tr>';
//User
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
print '<td class="left">';
print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<td>';
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 '</td>';
print '</tr>';
@ -189,8 +191,8 @@ print '<tr class="oddeven"><td>';
$htmltext = $langs->trans("KeepThisEmptyInMostCases");
print $form->textwithpicto($langs->trans("END_TO_END"), $htmltext);
print '</td>';
print '<td class="left">';
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->PRELEVEMENT_END_TO_END.'" size="15" ></td>';
print '<td>';
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->PRELEVEMENT_END_TO_END.'" class="width100"></td>';
print '</td></tr>';
//USTRD
@ -199,16 +201,16 @@ $htmltext = $langs->trans("KeepThisEmptyInMostCases");
print $form->textwithpicto($langs->trans("USTRD"), $htmltext);
print '</td>';
print '<td class="left">';
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->PRELEVEMENT_USTRD.'" size="15" ></td>';
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->PRELEVEMENT_USTRD.'" class="width100"></td>';
print '</td></tr>';
//ADDDAYS
print '<tr class="oddeven"><td>'.$langs->trans("ADDDAYS").'</td>';
print '<td class="left">';
print '<td>';
if (empty($conf->global->PRELEVEMENT_ADDDAYS)) {
$conf->global->PRELEVEMENT_ADDDAYS = 0;
}
print '<input type="text" name="PRELEVEMENT_ADDDAYS" value="'.$conf->global->PRELEVEMENT_ADDDAYS.'" size="5" ></td>';
print '<input type="text" name="PRELEVEMENT_ADDDAYS" value="'.$conf->global->PRELEVEMENT_ADDDAYS.'" class="width50"></td>';
print '</td></tr>';
print '</table>';

View File

@ -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++;

View File

@ -1346,7 +1346,7 @@ if ($resql) {
print '<td class="tdoverflowmax300"'.($titletoshow ? ' title="'.dol_escape_htmltag($titletoshow).'"' : '').'>';
print $labeltoshow; // Already escaped
// Add links after description
// Add info about links after description
$cachebankaccount = array();
foreach ($links as $key => $val) {
print '<!-- '.$links[$key]['type'].' -->';
@ -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 '&nbsp;';
}

View File

@ -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 .= ")";

View File

@ -624,21 +624,21 @@ if ($result) {
print '<table class="border centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("Conciliation")."</td>";
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("AccountStatement"), $langs->trans("InputReceiptNumber"))."</td>";
if ($user->rights->banque->consolidate) {
print '<td>';
if ($objp->rappro) {
print $langs->trans("AccountStatement").' <input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
print '<input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
print '<input name="num_rel" type="hidden" value="'.$objp->num_releve.'">';
} else {
print $langs->trans("AccountStatement").' <input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
print '<input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
}
if ($objp->num_releve) {
print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?num='.$objp->num_releve.'&account='.$acct->id.'">'.$langs->trans("AccountStatement").' '.$objp->num_releve.')</a>';
}
print '</td>';
} else {
print '<td>'.$objp->num_releve.'&nbsp;</td>';
print '<td>'.$objp->num_releve.'</td>';
}
print '</tr>';

View File

@ -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');
}

View File

@ -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 .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
if ($show_empty && !$multiple) {
@ -2069,6 +2066,12 @@ class Form
$out .= '<option value="">'.$langs->trans("None").'</option>';
}
$out .= '</select>';
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);
}

View File

@ -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&amp;leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire);
// General Ledger
$newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire);
// Journals
$newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire);
// Account Balance
$newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&amp;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&amp;leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire);

View File

@ -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

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
*
* 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;

View File

@ -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 {

View File

@ -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;

View File

@ -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');

View File

@ -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);