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

develop
This commit is contained in:
Laurent Destailleur 2023-11-13 02:59:22 +01:00
commit 8fd688bb51
24 changed files with 146 additions and 62 deletions

View file

@ -171,6 +171,7 @@ fi
if [ -s "$mydir/initdemopostsql.sql" ]; then
echo A file initdemopostsql.sql was found, we execute it.
echo "mysql -P$port $base < \"$mydir/initdemopostsql.sql\""
mysql -P$port $base < "$mydir/initdemopostsql.sql"
else
echo No file initdemopostsql.sql found, so no extra sql action done.

View file

@ -435,8 +435,8 @@ if ($action != 'export_csv') {
if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) {
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
}
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountingDebit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountingCredit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
// Hook fields

View file

@ -401,6 +401,7 @@ class AccountingAccount extends CommonObject
{
global $langs;
// TODO Looks a stupid check
$sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet";
$sql .= " WHERE fk_code_ventilation=".((int) $this->id).")";
$sql .= "UNION";

View file

@ -1176,7 +1176,6 @@ class BookKeeping extends CommonObject
$sql = 'SELECT';
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
if (!empty($option)) {
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
@ -1221,11 +1220,11 @@ class BookKeeping extends CommonObject
if (!empty($option)) {
$sql .= " AND t.subledger_account IS NOT NULL";
$sql .= " AND t.subledger_account <> ''";
$sql .= " GROUP BY t.numero_compte, t.label_compte, t.subledger_account, t.subledger_label";
$sql .= " GROUP BY t.numero_compte, t.subledger_account, t.subledger_label";
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
} else {
$sql .= ' GROUP BY t.numero_compte, t.label_compte';
$sql .= ' GROUP BY t.numero_compte';
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
}
@ -1246,7 +1245,7 @@ class BookKeeping extends CommonObject
$line = new BookKeepingLine();
$line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
//$line->label_compte = $obj->label_compte;
if (!empty($option)) {
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;

View file

@ -3,11 +3,11 @@
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
*
* 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
@ -423,8 +423,8 @@ if ($action == 'writebookkeeping' && !$error) {
}
}
// Protection against a bug on line before
if (!$errorforline && price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) {
// Protection against a bug on lines before
if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))) {
$error++;
$errorforline++;
$errorforinvoice[$key] = 'amountsnotbalanced';
@ -622,7 +622,7 @@ if (empty($action) || $action == 'view') {
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';
$i = 0;
$expensereportstatic = new ExpenseReport($db);
$expensereportlinestatic = new ExpenseReportLine($db);
@ -634,6 +634,27 @@ if (empty($action) || $action == 'view') {
$date = dol_print_date($val["date"], 'day');
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
print '<tr class="oddeven">';
print "<!-- Some lines are not bound -->";
print "<td>".$date."</td>";
print "<td>".$expensereportstatic->getNomUrl(1)."</td>";
// Account
print "<td>";
print '<span class="error">'.$langs->trans('ErrorInvoiceContainsLinesNotYetBoundedShort', $val['ref']).'</span>';
print '</td>';
// Subledger account
print "<td>";
print '</td>';
print "<td>";
print "</td>";
print '<td class="right"></td>';
print '<td class="right"></td>';
print "</tr>";
$i++;
}
// Fees
foreach ($tabht[$key] as $k => $mt) {
$accountingaccount = new AccountingAccount($db);

View file

@ -1322,11 +1322,11 @@ if (empty($reshook)) {
// Check price is not lower than minimum
if ($usermustrespectpricemin) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') {
$mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
@ -1495,12 +1495,12 @@ if (empty($reshook)) {
// Check price is not lower than minimum
if ($usermustrespectpricemin) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < price2num($price_min))) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
$action = 'editline';
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') {
$mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;

View file

@ -1026,11 +1026,11 @@ if (empty($reshook)) {
// Check price is not lower than minimum
if ($usermustrespectpricemin) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') {
$mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
@ -1195,12 +1195,12 @@ if (empty($reshook)) {
// Check price is not lower than minimum
if ($usermustrespectpricemin) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
$action = 'editline';
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') {
$mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;

View file

@ -472,7 +472,7 @@ if (empty($reshook)) {
$array_options = $lines[$i]->array_options;
}
$objecttmp->context['createfromclone'];
$objecttmp->context['createfromclone'] = 'createfromclone';
$rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
//there may already be rows from previous orders

View file

@ -172,7 +172,7 @@ if (GETPOST("account") || GETPOST("ref")) {
$error = 0;
$tab_sqlobjOrder = array();
$tab_sqlobj = array();
$nbtotalofrecords = '';
$nbtotalofrecords = 0;
foreach ($sqls as $sql) {
$resql = $db->query($sql);

View file

@ -204,21 +204,22 @@ if (empty($reshook)) {
}
if (!$error) {
$object->title = GETPOST('title', 'alphanohtml');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->model_pdf = GETPOST('modelpdf', 'alphanohtml');
$object->usenewprice = GETPOST('usenewprice', 'alphanohtml');
$object->subtype = GETPOST('subtype');
$object->title = GETPOST('title', 'alphanohtml');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->model_pdf = GETPOST('modelpdf', 'alphanohtml');
$object->usenewprice = GETPOST('usenewprice', 'alphanohtml');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->frequency = $frequency;
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
$object->nb_gen_max = $nb_gen_max;
$object->auto_validate = GETPOST('auto_validate', 'int');
$object->generate_pdf = GETPOST('generate_pdf', 'int');
$object->fk_project = $projectid;
$object->frequency = $frequency;
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
$object->nb_gen_max = $nb_gen_max;
$object->auto_validate = GETPOST('auto_validate', 'int');
$object->generate_pdf = GETPOST('generate_pdf', 'int');
$object->fk_project = $projectid;
$date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
$object->date_when = $date_next_execution;
@ -1002,6 +1003,13 @@ if ($action == 'create') {
print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1, 'customer').'</td>';
print '</tr>';
// Invoice subtype
if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) {
print "<tr><td>".$langs->trans("InvoiceSubtype")."</td><td>";
print $form->getSelectInvoiceSubtype(GETPOSTISSET('subtype') ? GETPOST('subtype') : $object->subtype, 'subtype', -1, 0, 0, '');
print "</td></tr>";
}
$note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $object->note_public;
$note_private = GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : $object->note_private;
@ -1285,14 +1293,24 @@ if ($action == 'create') {
print '<table class="border centpercent tableforfield">';
// Invoice subtype
if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) {
print "<tr><td>".$langs->trans("InvoiceSubtype")."</td><td>";
print $object->getSubtypeLabel('facture_rec');
print "</td></tr>";
}
// Author
print '<tr><td class="titlefield">'.$langs->trans("Author").'</td><td>';
print $author->getNomUrl(-1);
print "</td></tr>";
// Amount (excl. tax)
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
print '<td>'.price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency).'</td>';
print '</tr>';
// Amount tax
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency).'</td>';
print '</tr>';

View file

@ -126,6 +126,9 @@ if ($id > 0 || !empty($ref)) {
$fetch_situation = true;
}
$ret = $object->fetch($id, $ref, '', '', $fetch_situation);
if ($ret > 0 && isset($object->fk_project)) {
$ret = $object->fetch_project();
}
}
}
@ -2378,11 +2381,11 @@ if (empty($reshook)) {
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if ($usermustrespectpricemin && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') {
$mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
@ -2594,12 +2597,12 @@ if (empty($reshook)) {
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if ($usermustrespectpricemin && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)) {
if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min))) {
if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min)) && $price_base_type == 'HT') {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
$action = 'editline';
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') {
$mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;

View file

@ -7,6 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2023 Nick Fragoulis
*
* 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
@ -174,7 +175,8 @@ class FactureRec extends CommonInvoice
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'subtype' =>array('type'=>'smallint(6)', 'label'=>'InvoiceSubtype', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>55, 'isameasure'=>1),
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>65, 'isameasure'=>1),
@ -273,6 +275,7 @@ class FactureRec extends CommonInvoice
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (";
$sql .= "titre";
$sql .= ", fk_soc";
$sql .= ", subtype";
$sql .= ", entity";
$sql .= ", datec";
$sql .= ", amount";
@ -301,6 +304,7 @@ class FactureRec extends CommonInvoice
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
$sql .= ", ".((int) $this->socid);
$sql .= ", ".($this->subtype ? "'".$this->db->escape($this->subtype)."'" : "null");
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".(!empty($facsrc->total_ttc) ? ((float) $facsrc->total_ttc) : '0');
@ -545,7 +549,7 @@ class FactureRec extends CommonInvoice
{
dol_syslog('FactureRec::fetch', LOG_DEBUG);
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.total_tva, f.localtax1, f.localtax2, f.total_ht, f.total_ttc';
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.subtype, f.total_tva, f.localtax1, f.localtax2, f.total_ht, f.total_ttc';
$sql .= ', f.date_lim_reglement as dlr';
$sql .= ', f.note_private, f.note_public, f.fk_user_author';
$sql .= ', f.modelpdf as model_pdf';
@ -583,6 +587,7 @@ class FactureRec extends CommonInvoice
$this->titre = $obj->title; // deprecated
$this->title = $obj->title;
$this->ref = $obj->title;
$this->subtype = $obj->subtype;
$this->suspended = $obj->suspended;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
@ -1345,6 +1350,7 @@ class FactureRec extends CommonInvoice
$facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
$facture->type = self::TYPE_STANDARD;
$facture->subtype = $facturerec->subtype;
$facture->statut = self::STATUS_DRAFT; // deprecated
$facture->status = self::STATUS_DRAFT;
$facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.

View file

@ -334,7 +334,7 @@ if (isModEnabled('project')) {
$now = dol_now();
$title = $langs->trans("SocialContribution").' - '.$langs->trans("Card");
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module_Taxes_et_charges_spéciales|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
llxHeader("", $title, $help_url);

View file

@ -694,6 +694,27 @@ abstract class CommonInvoice extends CommonObject
$resql = $this->db->query($sql);
if ($resql) {
$subtypeLabel = '';
while ($obj = $this->db->fetch_object($resql)) {
$subtypeLabel = $obj->label;
}
if (!empty($subtypeLabel)) {
print ' ' . $subtypeLabel;
}
} else {
dol_print_error($this->db);
return -1;
}
} elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') {
$sql = "SELECT s.label FROM " . MAIN_DB_PREFIX . $table . " AS f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_invoice_subtype AS s ON f.subtype = s.rowid";
$sql .= " WHERE f.titre = '".$this->db->escape($this->titre)."'";
$resql = $this->db->query($sql);
if ($resql) {
$subtypeLabel = '';

View file

@ -62,12 +62,15 @@ class FormAdmin
* @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...)
* @return string Return HTML select string with list of languages
*/
public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = null, $mainlangonly = 0)
public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = array(), $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array(), $mainlangonly = 0)
{
// phpcs:enable
global $conf, $langs;
if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) {
if (!is_array($filter)) {
$filter = array();
}
$filter[getDolGlobalString('MAIN_DEFAULT_LANGUAGE_FILTER')] = 1;
}

View file

@ -1468,8 +1468,10 @@ class pdf_sponge extends ModelePDFFactures
$percent = 0;
$i = 0;
foreach ($object->lines as $line) {
$percent += $line->situation_percent;
$i++;
if ($line->product_type != 9) {
$percent += $line->situation_percent;
$i++;
}
}
if (!empty($i)) {

View file

@ -313,6 +313,8 @@ class modFournisseur extends DolibarrModules
$langs->loadLangs(array("suppliers", "multicurrency"));
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'Vendor invoices and lines of invoices';
@ -327,7 +329,7 @@ class modFournisseur extends DolibarrModules
'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.remise_percent'=>"Discount", 'fd.total_ht'=>"LineTotalHT",
'fd.total_ttc'=>"LineTotalTTC", 'fd.tva'=>"LineTotalVAT", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode',
'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.fk_product'=>'ProductId',
'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'p.accountancy_code_buy'=>'ProductAccountancyBuyCode', 'project.rowid'=>'ProjectId',
'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', $alias_product_perentity.'.accountancy_code_buy'=>'ProductAccountancyBuyCode', 'project.rowid'=>'ProjectId',
'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel'
);
if (isModEnabled("multicurrency")) {
@ -348,7 +350,7 @@ class modFournisseur extends DolibarrModules
's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>'Date',
'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.note_public'=>"Text", 'fd.description'=>"Text", 'fd.tva_tx'=>"Text",
'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.tva'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", 'fd.special_code'=>"Numeric",
'fd.product_type'=>'Numeric', 'fd.fk_product'=>'List:product:label',
'fd.product_type'=>'Numeric', 'fd.fk_product'=>'List:product:label', $alias_product_perentity . '.accountancy_code_buy'=>'Text',
'p.ref'=>'Text', 'p.label'=>'Text', 'project.ref'=>'Text', 'project.title'=>'Text'
);
$this->export_entities_array[$r] = array(
@ -358,7 +360,7 @@ class modFournisseur extends DolibarrModules
'f.paye'=>"invoice", 'f.fk_statut'=>'invoice', 'f.note_public'=>"invoice", 'fd.rowid'=>'invoice_line', 'fd.description'=>"invoice_line", 'fd.tva_tx'=>"invoice_line", 'fd.qty'=>"invoice_line",
'fd.remise_percent'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>"invoice_line",
'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product',
'p.ref'=>'product', 'p.label'=>'product', 'p.accountancy_code_buy'=>'product', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project'
'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity.'.accountancy_code_buy'=>'product', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project'
);
$this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object

View file

@ -733,8 +733,11 @@ if (empty($reshook)) {
$paiementfourn = new PaiementFourn($db);
$result = $paiementfourn->fetch(GETPOST('paiement_id'));
if ($result > 0) {
$result = $paiementfourn->delete(); // If fetch ok and found
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
$result = $paiementfourn->delete();
if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
}
if ($result < 0) {
setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors');

View file

@ -25,8 +25,8 @@ FormatHourShort=%I:%M %p
FormatHourShortDuration=%H:%M
FormatDateTextShort=%b %d, %Y
FormatDateText=%B %d, %Y
FormatDateHourShort=%m/%d/%Y %I:%M %p
FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
FormatDateHourShort=%d-%m-%Y %I:%M %p
FormatDateHourSecShort=%d-%m-%Y %I:%M:%S %p
FormatDateHourTextShort=%b %d, %Y, %I:%M %p
FormatDateHourText=%B %d, %Y, %I:%M %p
DatabaseConnection=Databaseverbinding

View file

@ -1168,6 +1168,7 @@ if ($resql) {
print $obj->qty_view; // qty found
print '</td>';
}
print '<td>';
if ($obj->fk_movement > 0) {
$stockmovment = new MouvementStock($db);
$stockmovment->fetch($obj->fk_movement);

View file

@ -613,7 +613,6 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
}
print '</tr>'."\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label
@ -686,7 +685,6 @@ $warehouse = new Entrepot($db);
// --------------------------------------------------------------------
$i = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {

View file

@ -1040,6 +1040,9 @@ if (!empty($socid)) {
}
if ($search_usage_event_organization == 1) {
$url .= '&usage_organize_event=1';
if (((int) $search_usage_opportunity) < 1) {
$url .= '&usage_opportunity=0';
}
}
$newcardbutton = '';

View file

@ -2204,7 +2204,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
}
}
if (!empty($arrayfields['p.project_label']['checked'])) {
print '<td class="nowraponall">';
if (empty($conf->cache['project'][$task_time->fk_projet])) {
$tmpproject = new Project($db);
$tmpproject->fetch($task_time->fk_projet);
@ -2212,7 +2211,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
} else {
$tmpproject = $conf->cache['project'][$task_time->fk_projet];
}
print $tmpproject->title;
print '<td class="tdoverflowmax250" title="'.dol_escape_htmltag($tmpproject->title).'">';
print dol_escape_htmltag($tmpproject->title);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -2244,7 +2244,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Task label
if (!empty($arrayfields['t.element_label']['checked'])) {
if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task
print '<td class="nowrap tdoverflowmax300" title="'.dol_escape_htmltag($task_time->label).'">';
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($task_time->label).'">';
print dol_escape_htmltag($task_time->label);
print '</td>';
if (!$i) {

View file

@ -1025,13 +1025,15 @@ class Societe extends CommonObject
$this->add_commercial($user, $user->id);
}
if ($ret >= 0 && !$notrigger) {
// Call trigger
$result = $this->call_trigger('COMPANY_CREATE', $user);
if ($result < 0) {
$error++;
if ($ret >= 0) {
if (! $notrigger) {
// Call trigger
$result = $this->call_trigger('COMPANY_CREATE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
// End call triggers
} else {
$error++;
}