diff --git a/dev/initdemo/initdemopassword.sh b/dev/initdemo/initdemopassword.sh index a67dec61785..bcf2b14887e 100755 --- a/dev/initdemo/initdemopassword.sh +++ b/dev/initdemo/initdemopassword.sh @@ -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. diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 994cb9b1466..6b5f09693ce 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -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 diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 3d2930cf66b..005056112f8 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -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"; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 288e34b5dcb..48a3e6891cc 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -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; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 6b0f50674ac..ae217414b5f 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -3,11 +3,11 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France - * Copyright (C) 2018 Eric Seigne + * Copyright (C) 2018 Eric Seigne * * 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 ''.$langs->trans("AccountingCredit").""; print "\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 ''; + print ""; + print "".$date.""; + print "".$expensereportstatic->getNomUrl(1).""; + // Account + print ""; + print ''.$langs->trans('ErrorInvoiceContainsLinesNotYetBoundedShort', $val['ref']).''; + print ''; + // Subledger account + print ""; + print ''; + print ""; + print ""; + print ''; + print ''; + print ""; + + $i++; + } + // Fees foreach ($tabht[$key] as $k => $mt) { $accountingaccount = new AccountingAccount($db); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3dd1c612943..f43d38ef5ce 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -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++; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f61e78c5d41..b6fd2fec085 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -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++; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 83350c353dc..8c10c3ce7ab 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -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 diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index a861acb303f..61f8fcf2936 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -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); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index a14eff9a1bb..7473eb9044b 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -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 ''.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1, 'customer').''; print ''; + // Invoice subtype + if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) { + print "".$langs->trans("InvoiceSubtype").""; + print $form->getSelectInvoiceSubtype(GETPOSTISSET('subtype') ? GETPOST('subtype') : $object->subtype, 'subtype', -1, 0, 0, ''); + print ""; + } + $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 ''; + // Invoice subtype + if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) { + print ""; + } + + // Author print '"; + // Amount (excl. tax) print ''; print ''; print ''; + // Amount tax print ''; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c99bea286f6..fb2a5662010 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -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++; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index e526b4049f2..0a6ad7c2423 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2020 Frédéric France + * 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. diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 0bc3ec45779..d9199baa03c 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -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ódulo Impuestos y cargas sociales (IVA, impuestos)'; +$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module_Taxes_et_charges_spéciales|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; llxHeader("", $title, $help_url); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index c1e9c9afeae..e4e072e87b3 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -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 = ''; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 272b1a1713a..98340d74a00 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -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; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 308e7269aab..6811573f564 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -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)) { diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index d58a208b606..656ebf8181e 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -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 diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 417e57fabe1..a4bff092793 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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'); diff --git a/htdocs/langs/nl_NL/main.lang b/htdocs/langs/nl_NL/main.lang index cd362326eaf..269170130d2 100644 --- a/htdocs/langs/nl_NL/main.lang +++ b/htdocs/langs/nl_NL/main.lang @@ -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 diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 9bd54510b46..d95d70fa39c 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1168,6 +1168,7 @@ if ($resql) { print $obj->qty_view; // qty found print ''; } + print ''."\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) { diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 90fa9fd3094..cc8cdb44cb6 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -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 = ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f9a0ca160dd..73c6bcbefe0 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -2204,7 +2204,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } } if (!empty($arrayfields['p.project_label']['checked'])) { - print ''; 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 ''; if (!$i) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 10678285d06..60aa52567c1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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++; }
".$langs->trans("InvoiceSubtype").""; + print $object->getSubtypeLabel('facture_rec'); + print "
'.$langs->trans("Author").''; print $author->getNomUrl(-1); print "
'.$langs->trans("AmountHT").''.price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency).'
'.$langs->trans("AmountVAT").''.price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency).'
'; if ($obj->fk_movement > 0) { $stockmovment = new MouvementStock($db); $stockmovment->fetch($obj->fk_movement); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 570ea0ef6b9..3cd777d65d3 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -613,7 +613,6 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { } print '
'; 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 ''; + print dol_escape_htmltag($tmpproject->title); print ''; + print ''; print dol_escape_htmltag($task_time->label); print '