diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 746383fef0b..d00a968571f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -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 '
'; - $i = 0; print '
'; print ""; print ""; @@ -837,7 +837,7 @@ if (empty($action) || $action == 'view') { print '"; print "\n"; - $r = ''; + $i = 0; $invoicestatic = new FactureFournisseur($db); $companystatic = new Fournisseur($db); @@ -887,6 +887,7 @@ if (empty($action) || $action == 'view') { print ''; print ""; + $i++; continue; } if ($errorforinvoice[$key] == 'somelinesarenotbound') { @@ -906,6 +907,8 @@ if (empty($action) || $action == 'view') { print ''; print ''; print ""; + + $i++; } // Third party @@ -936,6 +939,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // Product / Service @@ -972,6 +977,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // VAT @@ -1009,6 +1016,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } } } @@ -1037,11 +1046,17 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } } } } + if (!$i) { + print ''; + } + print "
'.$langs->trans("AccountingCredit")."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.($mt >= 0 ? price($mt) : '')."'.($mt < 0 ? price(-$mt) : '')."
'.($mt >= 0 ? price($mt) : '')."'.($mt < 0 ? price(-$mt) : '')."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.$langs->trans("NoRecordFound").'
"; print '
'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 666024833d0..a5e3a62bb66 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -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 '
'; - $i = 0; print '
'; print ""; print ""; @@ -859,7 +867,7 @@ if (empty($action) || $action == 'view') { print '"; print "\n"; - $r = ''; + $i = 0; $companystatic = new Client($db); $invoicestatic = new Facture($db); @@ -907,6 +915,7 @@ if (empty($action) || $action == 'view') { print ''; print ""; + $i++; continue; } if ($errorforinvoice[$key] == 'somelinesarenotbound') { @@ -926,6 +935,8 @@ if (empty($action) || $action == 'view') { print ''; print ''; print ""; + + $i++; } // Warranty @@ -986,6 +997,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // Product / Service @@ -1022,6 +1035,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // VAT @@ -1058,11 +1073,17 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } } } } + if (!$i) { + print ''; + } + print "
'.$langs->trans("AccountingCredit")."
'.($mt >= 0 ? price($mt) : '')."'.($mt < 0 ? price(-$mt) : '')."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.$langs->trans("NoRecordFound").'
"; print '
'; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2e87e76c7ce..5a5914723b0 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1926,8 +1926,8 @@ if ($id > 0) { if (!is_null($withentity)) { print ''; } - print ''; - print ''; + print ''; + print ''; print ''; } else { $tmpaction = 'view'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0bdedf90672..b5332b033ef 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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 { diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 0408f9d3a3f..e9b2ac88039 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -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(); } /** diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index a87754f9883..a1045beedb9 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -134,10 +134,12 @@ $(document).ready(function () {
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.'"' : ''; +} ?>>
diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 50594489d8b..80558b67e49 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -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 .= '
'.$langs->trans("CreatedBy").' '; if ($object->fk_user_creat > 0) { $fuser = new User($db);