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

This commit is contained in:
Laurent Destailleur 2023-03-02 21:28:32 +01:00
commit 040958f73d
7 changed files with 65 additions and 31 deletions

View File

@ -104,7 +104,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
}
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,";
@ -200,8 +200,8 @@ if ($result) {
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
}
$line = new SupplierInvoiceLine($db);
$line->fetch($obj->fdid);
//$line = new SupplierInvoiceLine($db);
//$line->fetch($obj->fdid);
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
@ -233,7 +233,8 @@ if ($result) {
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
if (!empty($line->tva_npr)) { // Add an entry for counterpart
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
if ($tva_npr) { // If NPR, we add an entry for counterpartWe into tabother
$tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva;
}
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
@ -824,7 +825,6 @@ if (empty($action) || $action == 'view') {
*/
print '<br>';
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@ -837,7 +837,7 @@ if (empty($action) || $action == 'view') {
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';
$i = 0;
$invoicestatic = new FactureFournisseur($db);
$companystatic = new Fournisseur($db);
@ -887,6 +887,7 @@ if (empty($action) || $action == 'view') {
print '<td class="right"></td>';
print "</tr>";
$i++;
continue;
}
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
@ -906,6 +907,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right"></td>';
print '<td class="right"></td>';
print "</tr>";
$i++;
}
// Third party
@ -936,6 +939,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
$i++;
}
// Product / Service
@ -972,6 +977,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
$i++;
}
// VAT
@ -1009,6 +1016,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
$i++;
}
}
}
@ -1037,11 +1046,17 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
$i++;
}
}
}
}
if (!$i) {
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";
print '</div>';

View File

@ -107,7 +107,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
}
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,";
@ -206,17 +206,17 @@ if ($result) {
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
}
$line = new FactureLigne($db);
$line->fetch($obj->fdid);
// Situation invoices handling
$prev_progress = $line->get_prev_progress($obj->rowid);
if ($obj->type == Facture::TYPE_SITUATION) {
// Avoid divide by 0
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
$line = new FactureLigne($db);
$line->fetch($obj->fdid);
// Situation invoices handling
$prev_progress = $line->get_prev_progress($obj->rowid);
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
}
} else {
@ -249,6 +249,11 @@ if ($result) {
$tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
}
// Compensation of data for invoice situation by using $situation_ratio. This works (nearly) for invoice that was not correctly recorded
// but it may introduces an error for situation invoices that were correctly saved. There is still rounding problem that differs between
// real data we should have stored and result obtained with a compensation.
// It also seems that credit notes on situation invoices are correctly saved (but it depends on the version used in fact).
// For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes.
$total_ttc = $obj->total_ttc * $situation_ratio;
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) {
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');
@ -257,11 +262,14 @@ if ($result) {
}
$tabttc[$obj->rowid][$compta_soc] += $total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
if (empty($line->tva_npr)) {
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
if (!$tva_npr) { // We ignore line if VAT is a NPR
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
}
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
$tabcompany[$obj->rowid] = array(
'id' => $obj->socid,
'name' => $obj->name,
@ -658,7 +666,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
foreach ($tabfac as $key => $val) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta = $tabcompany[$key]['code_compta']; // deprecated
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->client = 3;
@ -846,7 +855,6 @@ if (empty($action) || $action == 'view') {
*/
print '<br>';
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@ -859,7 +867,7 @@ if (empty($action) || $action == 'view') {
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';
$i = 0;
$companystatic = new Client($db);
$invoicestatic = new Facture($db);
@ -907,6 +915,7 @@ if (empty($action) || $action == 'view') {
print '<td class="right"></td>';
print "</tr>";
$i++;
continue;
}
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
@ -926,6 +935,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right"></td>';
print '<td class="right"></td>';
print "</tr>";
$i++;
}
// Warranty
@ -986,6 +997,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
$i++;
}
// Product / Service
@ -1022,6 +1035,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
$i++;
}
// VAT
@ -1058,11 +1073,17 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
$i++;
}
}
}
}
if (!$i) {
print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";
print '</div>';

View File

@ -1926,8 +1926,8 @@ if ($id > 0) {
if (!is_null($withentity)) {
print '<input type="hidden" name="entity" value="'.$withentity.'">';
}
print '<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button button-edit small" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel small" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
} else {
$tmpaction = 'view';

View File

@ -6509,6 +6509,7 @@ class FactureLigne extends CommonInvoiceLine
{
// phpcs:enable
global $invoicecache;
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
return 0;
} else {

View File

@ -344,12 +344,7 @@ class Ldap
*/
public function close()
{
$r_type = get_resource_type($this->connection);
if ($this->connection && ($r_type === "Unknown" || !@ldap_close($this->connection))) {
return false;
} else {
return true;
}
return $this->unbind();
}
/**

View File

@ -134,10 +134,12 @@ $(document).ready(function () {
<?php } ?>
<div class="login_center center"<?php
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
if (empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
}
?>>
<div class="login_vertical_align">

View File

@ -473,7 +473,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}*/
// Author
if (!empty($object->email_msgid)) {
$morehtmlref .= $langs->trans("CreatedBy").' : ';
$morehtmlref .= '<br>'.$langs->trans("CreatedBy").' ';
if ($object->fk_user_creat > 0) {
$fuser = new User($db);