diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c143acf9aa0..e58dd24f0a1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3426,7 +3426,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", fk_product = ".((int) $fk_product); $sql .= ", product_type = ".((int) $this->product_type); $sql .= ", info_bits = ".((int) $this->info_bits); - $sql .= ", fk_unit = ".($fk_unit > 0 ? (int) $fk_unit : 'null'); + $sql .= ", fk_unit = ".((int) $fk_unit); // Multicurrency $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e8d2851f649..582caa3338a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3231,19 +3231,21 @@ if ($action == 'create') { } print ''; print ''; - print ''.price($resteapayeraffiche).''; + print ''.price($resteapayeraffiche).' '; // Remainder to pay Multicurrency if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { print ''; print ''; - print $langs->trans('MulticurrencyRemainderToPay'); + if ($resteapayeraffiche <= 0) { + print $langs->trans('RemainderToPayBackMulticurrency'); + } else { + print $langs->trans('ExcessPaidMulticurrency'); + } print ''; print ''; - print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($object->multicurrency_tx*$resteapayeraffiche, 'MT')).''; + print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($object->multicurrency_tx*$resteapayeraffiche, 'MT')).' '; } - - print ' '; } else // Credit note { $cssforamountpaymentcomplete = 'amountpaymentneutral'; @@ -3266,8 +3268,21 @@ if ($action == 'create') { } print ''; print ''; - print ''.price($sign * $resteapayeraffiche).''; - print ' '; + print ''.price($sign * $resteapayeraffiche).' '; + + // Remainder to pay back Multicurrency + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; + if ($resteapayeraffiche <= 0) { + print $langs->trans('RemainderToPayBackMulticurrency'); + } else { + print $langs->trans('ExcessPaidMulticurrency'); + } + print ''; + print ''; + print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($sign * $object->multicurrency_tx * $resteapayeraffiche, 'MT')).' '; + } // Sold credit note // print ''.$langs->trans('TotalTTC').' :'; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 203b0201f9b..e475a815ac9 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -234,12 +234,17 @@ AlreadyPaidBack=Already paid back AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and down payments) Abandoned=Abandoned RemainderToPay=Remaining unpaid +RemainderToPayMulticurrency=Remaining unpaid, original currency RemainderToTake=Remaining amount to take +RemainderToTakeMulticurrency=Remaining amount to take, original currency RemainderToPayBack=Remaining amount to refund +RemainderToPayBackMulticurrency=Remaining amount to refund, original currency Rest=Pending AmountExpected=Amount claimed ExcessReceived=Excess received +ExcessReceivedMulticurrency=Excess received, original currency ExcessPaid=Excess paid +ExcessPaidMulticurrency=Excess paid, original currency EscompteOffered=Discount offered (payment before term) EscompteOfferedShort=Discount SendBillRef=Submission of invoice %s @@ -591,6 +596,5 @@ SituationTotalRayToRest=Remainder to pay without taxe PDFSituationTitle=Situation n° %d SituationTotalProgress=Total progress %d %% SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s -RegisterPaymentAndClasiffiedPayed=Enter payment and classify 'Paid' NoPaymentAvailable=No payment available for %s PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to paid diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 36c4a22d763..e6d8e5c6dfa 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2019 Laurent Destailleur * Copyright (C) 2006-2010 Regis Houssin * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2021 Alexandre Spangaro * * 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 @@ -71,12 +72,22 @@ if ($mine) { $search_task_user = $user->id; $mine = 0; } -$search_sday = GETPOST('search_sday', 'int'); -$search_smonth = GETPOST('search_smonth', 'int'); -$search_syear = GETPOST('search_syear', 'int'); -$search_eday = GETPOST('search_eday', 'int'); -$search_emonth = GETPOST('search_emonth', 'int'); -$search_eyear = GETPOST('search_eyear', 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int'); +$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int'); +$search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int'); +$search_datelimit_endday = GETPOST('search_datelimit_endday', 'int'); +$search_datelimit_endmonth = GETPOST('search_datelimit_endmonth', 'int'); +$search_datelimit_endyear = GETPOST('search_datelimit_endyear', 'int'); +$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear); +$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear); // Initialize context for list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'tasklist'; @@ -191,12 +202,22 @@ if (empty($reshook)) { $search_task_progress = ""; $search_task_user = -1; $search_project_user = -1; - $search_sday = ''; - $search_smonth = ''; - $search_syear = ''; - $search_eday = ''; - $search_emonth = ''; - $search_eyear = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_datelimit_startday = ''; + $search_datelimit_startmonth = ''; + $search_datelimit_startyear = ''; + $search_datelimit_endday = ''; + $search_datelimit_endmonth = ''; + $search_datelimit_endyear = ''; + $search_datelimit_start = ''; + $search_datelimit_end = ''; $toselect = ''; $search_array_options = array(); } @@ -372,8 +393,18 @@ if ($search_task_progress) { if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } -$sql .= dolSqlDateFilter('t.dateo', $search_sday, $search_smonth, $search_syear); -$sql .= dolSqlDateFilter('t.datee', $search_eday, $search_emonth, $search_eyear); +if ($search_date_start) { + $sql .= " AND t.dateo >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND t.dateo <= '".$db->idate($search_date_end)."'"; +} +if ($search_datelimit_start) { + $sql .= " AND t.datee >= '".$db->idate($search_datelimit_start)."'"; +} +if ($search_datelimit_end) { + $sql .= " AND t.datee <= '".$db->idate($search_datelimit_end)."'"; +} if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } @@ -454,23 +485,41 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } -if ($search_sday) { - $param .= '&search_sday='.urlencode($search_sday); +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } -if ($search_smonth) { - $param .= '&search_smonth='.urlencode($search_smonth); +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } -if ($search_syear) { - $param .= '&search_syear='.urlencode($search_syear); +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); } -if ($search_eday) { - $param .= '&search_eday='.urlencode($search_eday); +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); } -if ($search_emonth) { - $param .= '&search_emonth='.urlencode($search_emonth); +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); } -if ($search_eyear) { - $param .= '&search_eyear='.urlencode($search_eyear); +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); +} +if ($search_datelimit_startday) { + $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); +} +if ($search_datelimit_startmonth) { + $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); +} +if ($search_datelimit_startyear) { + $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); +} +if ($search_datelimit_endday) { + $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); +} +if ($search_datelimit_endmonth) { + $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); +} +if ($search_datelimit_endyear) { + $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); } if ($socid) { $param .= '&socid='.urlencode($socid); @@ -646,22 +695,26 @@ if (!empty($arrayfields['t.description']['checked'])) { } // Start date if (!empty($arrayfields['t.dateo']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - print $formother->selectyear($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // End date if (!empty($arrayfields['t.datee']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - print $formother->selectyear($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1); + print ''; + print '
'; + print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + // TODO Add option late + //print '
'.$langs->trans("Alert"); + print '
'; print ''; } if (!empty($arrayfields['p.ref']['checked'])) { diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 917a0a8b64b..33a32cea0a8 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -491,6 +491,12 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target"; if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } + +// Add joins from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= " WHERE e.entity IN (".getEntity('reception').")"; if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all $sql .= " AND e.fk_soc = sc.fk_soc";