diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 78160c15954..81060f0e413 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -924,7 +924,7 @@ class AccountancyExport
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
- $date_validation = dol_print_date($line->date_validated, '%Y%m%d');
+ $date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
// FEC:JournalCode
@@ -1030,7 +1030,7 @@ class AccountancyExport
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
- $date_validation = dol_print_date($line->date_validated, '%Y%m%d');
+ $date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
// FEC:JournalCode
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 55700fe8439..1e7c38b2607 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -369,9 +369,9 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print ''.$langs->trans("DescVentilDoneCustomer").' ';
- print '
';
print '';
print $langs->trans("LinkedToDolibarrUser");
@@ -641,7 +641,9 @@ if ($rowid > 0) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} else {
if ($object->user_id) {
- $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
+ $linkeduser = new User($db);
+ $linkeduser->fetch($object->user_id);
+ print $linkeduser->getNomUrl(-1);
} else {
print ''.$langs->trans("NoDolibarrAccess").' ';
}
diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php
index 19a440520b1..3e878b9398b 100644
--- a/htdocs/admin/debugbar.php
+++ b/htdocs/admin/debugbar.php
@@ -90,7 +90,7 @@ print ' ';
print '';
print '';
print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
-print ' ';
+print ' ';
print " \n";
print ''.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").' ';
diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php
index 0b12f8d3741..802cc939caa 100644
--- a/htdocs/admin/expensereport_rules.php
+++ b/htdocs/admin/expensereport_rules.php
@@ -319,7 +319,7 @@ foreach ($rules as $rule) {
echo ''.img_edit().' ';
echo ''.img_delete().' ';
} else {
- echo ' ';
+ echo ' ';
echo ''.$langs->trans("Cancel").' ';
}
echo '';
diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php
index 839ce4c3f86..d725a659e08 100644
--- a/htdocs/bookmarks/card.php
+++ b/htdocs/bookmarks/card.php
@@ -186,10 +186,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
- print '';
- print ' ';
- print ' ';
- print '
';
+ print $form->buttonsSaveCancel("CreateBookmark");
print '';
}
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index dbfbc84b69f..2ed56683c02 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -749,7 +749,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
- print '
';
+ print $form->buttonsSaveCancel("CreateMailing", '');
print '';
} else {
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 97c6735221f..3283957f8a2 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -424,7 +424,7 @@ if ($object->fetch($id) >= 0) {
print '';
if ($allowaddtarget) {
- print '
';
+ print '
';
} else {
print '
';
//print $langs->trans("MailNoChangePossible");
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 72eee9c22df..b5f05e72795 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1974,6 +1974,21 @@ if ($action == 'create') {
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
}
+ // mandatoryPeriod
+ $nbMandated = 0;
+ foreach ($object->lines as $line) {
+ $res = $line->fetch_product();
+ if ($res > 0 ) {
+ if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) {
+ $nbMandated++;
+ break;
+ }
+ }
+ }
+ if ($nbMandated > 0) {
+ $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
';
+ }
+
if (!$error) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
}
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 2e37cdcd0a1..decabedc2e8 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -294,6 +294,7 @@ if (empty($reshook)) {
if (!empty($origin) && !empty($originid)) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
+ $regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
@@ -1410,6 +1411,7 @@ if (empty($reshook)) {
/*
* View
*/
+
$title = $langs->trans('Order')." - ".$langs->trans('Card');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url);
@@ -1922,6 +1924,21 @@ if ($action == 'create' && $usercancreate) {
);
}
+ // mandatoryPeriod
+ $nbMandated = 0;
+ foreach ($object->lines as $line) {
+ $res = $line->fetch_product();
+ if ($res > 0 ) {
+ if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) {
+ $nbMandated++;
+ break;
+ }
+ }
+ }
+ if ($nbMandated > 0 ) $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
';
+
+
+
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
}
@@ -2358,17 +2375,17 @@ if ($action == 'create' && $usercancreate) {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT
print '
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).' ';
- print ''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
+ print ''.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
print '';
// Multicurrency Amount VAT
print '
'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).' ';
- print ''.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
+ print ''.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
print '';
// Multicurrency Amount TTC
print '
'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).' ';
- print ''.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
+ print ''.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
print '';
}
@@ -2378,23 +2395,23 @@ if ($action == 'create' && $usercancreate) {
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
}
print '
'.$langs->trans('AmountHT').' ';
- print ''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).$alert.' ';
+ print ''.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.' ';
// Total VAT
- print ''.$langs->trans('AmountVAT').' '.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).' ';
+ print '
'.$langs->trans('AmountVAT').' '.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).' ';
// Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
print '
'.$langs->transcountry("AmountLT1", $mysoc->country_code).' ';
- print ''.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).' ';
+ print '
'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).' ';
}
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).' ';
- print ''.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).' ';
+ print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).' ';
}
// Total TTC
- print ''.$langs->trans('AmountTTC').' '.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' ';
+ print ''.$langs->trans('AmountTTC').' '.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).' ';
// Statut
//print '' . $langs->trans('Status') . ' ' . $object->getLibStatut(4) . ' ';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 105c94d6a73..7ddb90cd4da 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -408,13 +408,21 @@ if (empty($reshook)) {
} elseif ($action == 'setinvoicedate' && $usercancreate) {
$object->fetch($id);
$old_date_lim_reglement = $object->date_lim_reglement;
- $date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'));
- if (empty($date)) {
+ $newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver');
+ if (empty($newdate)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
- header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
+ header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken());
exit;
}
- $object->date = $date;
+ if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
+ setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
+ } else {
+ setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
+ }
+ }
+
+ $object->date = $newdate;
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
if ($new_date_lim_reglement > $old_date_lim_reglement) {
$object->date_lim_reglement = $new_date_lim_reglement;
@@ -428,7 +436,9 @@ if (empty($reshook)) {
}
} elseif ($action == 'setdate_pointoftax' && $usercancreate) {
$object->fetch($id);
- $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
+
+ $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
+
$object->date_pointoftax = $date_pointoftax;
$result = $object->update($user);
if ($result < 0) {
@@ -1001,14 +1011,16 @@ if (empty($reshook)) {
$error++;
}
+ $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
+ $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
+
// Replacement invoice
if (GETPOST('type') == Facture::TYPE_REPLACEMENT) {
- $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@@ -1020,8 +1032,6 @@ if (empty($reshook)) {
$action = 'create';
}
- $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
-
if (!$error) {
// This is a replacement invoice
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
@@ -1064,19 +1074,16 @@ if (empty($reshook)) {
$action = 'create';
}
- $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
}
- $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
-
if (!$error) {
if (!empty($originentity)) {
$object->entity = $originentity;
@@ -1280,19 +1287,16 @@ if (empty($reshook)) {
// Standard invoice or Deposit invoice, created from a Predefined template invoice
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) {
- $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
}
- $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
-
if (!$error) {
$object->socid = GETPOST('socid', 'int');
$object->type = GETPOST('type');
@@ -1327,8 +1331,6 @@ if (empty($reshook)) {
$typeamount = GETPOST('typedeposit', 'aZ09');
$valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU');
$valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU');
- $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
- $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (GETPOST('socid', 'int') < 1) {
$error++;
@@ -1340,7 +1342,7 @@ if (empty($reshook)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@@ -1822,19 +1824,16 @@ if (empty($reshook)) {
// Situation invoices
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) {
- $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors');
- } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
+ } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
}
- $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
-
if (!(GETPOST('situations', 'int') > 0)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
@@ -3529,7 +3528,8 @@ if ($action == 'create') {
print '';
}
- $newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
+ $newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver');
+ $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
// Date invoice
print ''.$langs->trans('DateInvoice').' ';
@@ -3539,7 +3539,6 @@ if ($action == 'create') {
// Date point of tax
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
print ' '.$langs->trans('DatePointOfTax').' ';
- $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
print ' ';
}
@@ -4014,6 +4013,21 @@ if ($action == 'create') {
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) { // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on
$text .= ' '.img_warning().' '.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive");
}
+
+ // mandatoryPeriod
+ $nbMandated = 0;
+ foreach ($object->lines as $line) {
+ $res = $line->fetch_product();
+ if ($res > 0 ) {
+ if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) {
+ $nbMandated++;
+ break;
+ }
+ }
+ }
+ if ($nbMandated > 0 ) $text .= ''.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
';
+
+
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, (($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) ? "no" : "yes"), 2);
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 5186bbb297c..22cd946275c 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2267,7 +2267,6 @@ class Facture extends CommonInvoice
$sql .= ' SET fk_facture = NULL, fk_facture_line = NULL';
$sql .= ' WHERE fk_facture_line IN ('.$this->db->sanitize(join(',', $list_rowid_det)).')';
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (!$this->db->query($sql)) {
$this->error = $this->db->error()." sql=".$sql;
$this->errors[] = $this->error;
@@ -2276,6 +2275,30 @@ class Facture extends CommonInvoice
}
}
+ // Remove other links to the deleted invoice
+
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee';
+ $sql .= ' SET fk_invoice = NULL';
+ $sql .= ' WHERE fk_invoice = '.((int) $rowid);
+
+ if (!$this->db->query($sql)) {
+ $this->error = $this->db->error()." sql=".$sql;
+ $this->errors[] = $this->error;
+ $this->db->rollback();
+ return -5;
+ }
+
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time';
+ $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL';
+ $sql .= ' WHERE invoice_id = '.((int) $rowid);
+
+ if (!$this->db->query($sql)) {
+ $this->error = $this->db->error()." sql=".$sql;
+ $this->errors[] = $this->error;
+ $this->db->rollback();
+ return -5;
+ }
+
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
@@ -2299,17 +2322,13 @@ class Facture extends CommonInvoice
// Invoice line extrafileds
$main = MAIN_DB_PREFIX.'facturedet';
$ef = $main."_extrafields";
- $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
+ $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
// Delete invoice line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid);
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
-
if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid);
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
-
$resql = $this->db->query($sql);
if ($resql) {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index ca4d3d6ccaf..5fe028e1268 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
// Load translation files required by the page
$langs->loadLangs(array('bills', 'companies', 'other'));
-$mode = GETPOST("mode") ?GETPOST("mode") : 'customer';
+$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
if ($mode == 'customer' && !$user->rights->facture->lire) {
accessforbidden();
}
@@ -244,7 +244,7 @@ if (!count($arrayyears)) {
$h = 0;
$head = array();
-$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.$mode;
+$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode);
$head[$h][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear';
$h++;
@@ -261,12 +261,12 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type);
print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
-$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
-//Array passed as an argument to Form::selectarray to build a proper select input
-$companies = array();
-
-foreach ($tmp_companies as $value) {
- $companies[$value['key']] = $value['label'];
+$filter = '';
+if ($mode == 'customer') {
+ $filter = 's.client in (1,2,3)';
+}
+if ($mode == 'supplier') {
+ $filter = 's.fournisseur = 1';
}
print '';
@@ -281,14 +281,8 @@ print '
';
print ''.$langs->trans("Filter").' ';
// Company
print ''.$langs->trans("ThirdParty").' ';
-if ($mode == 'customer') {
- $filter = 's.client in (1,2,3)';
-}
-if ($mode == 'supplier') {
- $filter = 's.fournisseur = 1';
-}
print img_picto('', 'company', 'class="pictofixedwidth"');
-print $form->selectarray('socid', $companies, $socid, 1, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1);
+print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
print ' ';
// ThirdParty Type
diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php
index 5aa7344eea5..bea351ac46c 100644
--- a/htdocs/compta/prelevement/line.php
+++ b/htdocs/compta/prelevement/line.php
@@ -222,7 +222,7 @@ if ($id) {
print '
';
//Confirm Button
- print '
';
+ print '
';
print '';
}
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 835e7f0cafb..44ace66f05b 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -1288,7 +1288,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($objsoc->id > 0) {
$morehtmlref .= $objsoc->getNomUrl(1, 'contact');
} else {
- $morehtmlref .= $langs->trans("ContactNotLinkedToCompany");
+ $morehtmlref .= '
'.$langs->trans("ContactNotLinkedToCompany").' ';
}
}
$morehtmlref .= '
';
diff --git a/htdocs/core/ajax/fetchKnowledgeRecord.php b/htdocs/core/ajax/fetchKnowledgeRecord.php
index 00294d1b3c9..0182887c225 100644
--- a/htdocs/core/ajax/fetchKnowledgeRecord.php
+++ b/htdocs/core/ajax/fetchKnowledgeRecord.php
@@ -54,7 +54,6 @@ $action = GETPOST('action', 'aZ09');
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
$lang = GETPOST('lang', 'aZ09');
-$popupurl = GETPOST('popupurl', 'bool');
/*
* Actions
@@ -69,13 +68,12 @@ $popupurl = GETPOST('popupurl', 'bool');
if ($action == "getKnowledgeRecord") {
$response = '';
- $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,l.url,ctc.code";
- $sql .= " FROM ".MAIN_DB_PREFIX."links as l";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ON kr.rowid = l.objectid";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
+ $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,kr.url,ctc.code";
+ $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ";
+ $sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
$sql .= " WHERE ctc.code = '".$db->escape($idticketgroup)."'";
- $sql .= " AND ctc.active = 1 AND ctc.public = 1 AND (kr.lang = '".$db->escape($lang)."' OR kr.lang = 0)";
- $sql .= " AND kr.status = 1";
+ $sql .= " AND ctc.active = 1 AND ctc.public = 1 AND (kr.lang = '".$db->escape($lang)."' OR kr.lang = 0 OR kr.lang IS NULL)";
+ $sql .= " AND kr.status = 1 AND (kr.answer IS NOT NULL AND kr.answer <> '')";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@@ -83,33 +81,7 @@ if ($action == "getKnowledgeRecord") {
$response = array();
while ($i < $num) {
$obj = $db->fetch_object($resql);
- if ($popupurl == "false") {
- $url = "
url. "\" target=\"_blank\">".$obj->url." ";
- $response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$url);
- } else {
- $name = $obj->ref;
- $buttonstring = $obj->url;
- $url = $obj->url;
- $urltoprint = '
'.$buttonstring.' ';
- $urltoprint .= '';
- $urltoprint .= '';
- $response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$urltoprint);
- }
+ $response[] = array('title'=>$obj->question,'ref'=>$obj->ref,'answer'=>dol_escape_htmltag(preg_replace('/\\r|\\r\\n|\\n/', "", $obj->answer)),'url'=>$obj->url);
$i++;
}
} else {
diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php
index 7b271fafdf2..6047d8d289c 100644
--- a/htdocs/core/ajax/row.php
+++ b/htdocs/core/ajax/row.php
@@ -99,6 +99,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
$perm = 1;
+ } elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
+ $perm = 1;
} else {
$tmparray = explode('_', $table_element_line);
$tmpmodule = $tmparray[0]; $tmpobject = preg_replace('/line$/', '', $tmparray[1]);
@@ -111,7 +113,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
// We should not be here. If we are not allowed to reorder rows, feature should not be visible on script.
// If we are here, it is a hack attempt, so we report a warning.
print 'Bad permission to modify position of lines for object in table '.$table_element_line;
- dol_syslog('Bad permission to modify position of lines for object in table '.$table_element_line.', fk_element '.$fk_element, LOG_WARNING);
+ dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING);
accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line);
}
diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php
index e4418020bfc..fe01eae730b 100644
--- a/htdocs/core/boxes/box_graph_invoices_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_permonth.php
@@ -145,9 +145,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
// default value for customer mode
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') {
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
}
$px1 = new DolGraph();
diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php
index 14a431bcb84..22d9ad956e7 100644
--- a/htdocs/core/boxes/box_graph_invoices_peryear.php
+++ b/htdocs/core/boxes/box_graph_invoices_peryear.php
@@ -129,8 +129,10 @@ class box_graph_invoices_peryear extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesamountyears-".$endyear.".png";
// default value for customer mode
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png';
- if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png';
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png';
+ if ($mode == 'supplier') {
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png';
+ }
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index eb5edb921f3..7adf7a89079 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3539,7 +3539,7 @@ abstract class CommonObject
$this->db->free($resql);
- // Now update global field total_ht, total_ttc and tva
+ // Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
$fieldht = 'total_ht';
$fieldtva = 'tva';
$fieldlocaltax1 = 'localtax1';
@@ -3582,6 +3582,7 @@ abstract class CommonObject
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
$resql = $this->db->query($sql);
+
if (!$resql) {
$error++;
$this->error = $this->db->lasterror();
diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php
index 66f0b52878c..40bcf3aa529 100644
--- a/htdocs/core/class/commonobjectline.class.php
+++ b/htdocs/core/class/commonobjectline.class.php
@@ -26,6 +26,8 @@
/**
* Parent class for class inheritance lines of business objects
* This class is useless for the moment so no inherit are done on it
+ *
+ * TODO For the moment we use the extends on CommonObject until PHP min is 5.4 so we can use Traits.
*/
abstract class CommonObjectLine extends CommonObject
{
@@ -61,7 +63,7 @@ abstract class CommonObjectLine extends CommonObject
}
/**
- * Returns the label, shot_label or code found in units dictionary from ->fk_unit.
+ * Returns the label, short_label or code found in units dictionary from ->fk_unit.
* A langs->trans() must be called on result to get translated value.
*
* @param string $type Label type ('long', 'short' or 'code'). This can be a translation key.
@@ -104,7 +106,4 @@ abstract class CommonObjectLine extends CommonObject
return -1;
}
}
- // Currently we need function at end of file CommonObject for all object lines. Should find a way to avoid duplicate code.
-
- // For the moment we use the extends on CommonObject until PHP min is 5.4 so use Traits.
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 46159a52519..01bd1a13141 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -7874,6 +7874,11 @@ class Form
if (empty($conf->expedition->enabled)) {
continue; // Do not show if module disabled
}
+ } elseif ($objecttype == 'mo') {
+ $tplpath = 'mrp/mo';
+ if (empty($conf->mrp->enabled)) {
+ continue; // Do not show if module disabled
+ }
} elseif ($objecttype == 'ficheinter') {
$tplpath = 'fichinter';
if (empty($conf->ficheinter->enabled)) {
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index 4b12b4513e5..0048031d0e7 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -221,13 +221,14 @@ class FormActions
if ($typeelement == 'project') {
$projectid = $object->id;
}
+ $taskid = 0;
if ($typeelement == 'task') {
$taskid = $object->id;
}
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) {
- $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').($taskid > 0 ? '&taskid='.$taskid : '').'&backtopage='.urlencode($urlbacktopage);
+ $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
}
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index ac6bad50e41..d1fc8f65edb 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -761,20 +761,21 @@ class FormCompany extends Form
/**
* Return a select list with types of contacts
*
- * @param object $object Object to use to find type of contact
- * @param string $selected Default selected value
- * @param string $htmlname HTML select name
- * @param string $source Source ('internal' or 'external')
- * @param string $sortorder Sort criteria ('position', 'code', ...)
- * @param int $showempty 1=Add en empty line
- * @param string $morecss Add more css to select component
- * @param int $output 0=return HTML, 1= direct print
+ * @param object $object Object to use to find type of contact
+ * @param string $selected Default selected value
+ * @param string $htmlname HTML select name
+ * @param string $source Source ('internal' or 'external')
+ * @param string $sortorder Sort criteria ('position', 'code', ...)
+ * @param int $showempty 1=Add en empty line
+ * @param string $morecss Add more css to select component
+ * @param int $output 0=return HTML, 1= direct print
* @param int $forcehidetooltip Force hide tooltip for admin
- * @return void
+ * @return string|void Depending on $output param, return the HTML select list (recommended method) or nothing
*/
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '', $output = 1, $forcehidetooltip = 0)
{
global $user, $langs;
+
$out = '';
if (is_object($object) && method_exists($object, 'liste_type_contact')) {
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 591fb5ed2d1..ca7e939fb6f 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -2033,8 +2033,8 @@ class FormFile
print '
'.dol_print_date(dol_now(), "dayhour", "tzuser").' ';
print '
';
print '
';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
} else {
print '
';
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 04d4ad34e89..823e90fcac3 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -956,15 +956,14 @@ class FormMail extends Form
$out .= '
'."\n";
if ($this->withform == 1 || $this->withform == -1) {
- $out .= '';
- $out .= ' trans("SendMail").'"';
// Add a javascript test to avoid to forget to submit file before sending email
if ($this->withfile == 2 && $conf->use_javascript_ajax) {
$out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
}
$out .= ' />';
if ($this->withcancel) {
- $out .= ' ';
$out .= ' ';
}
$out .= '
'."\n";
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 9696dca7183..18b42c597bf 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -39,6 +39,8 @@ class FormProjets
*/
public $error = '';
+ public $nboftasks;
+
/**
* Constructor
@@ -307,11 +309,11 @@ class FormProjets
* @param int $disabled Disabled
* @param string $morecss More css added to the select component
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
- * @param string $showproject 'all' = Show project info, ''=Hide project info
+ * @param string $showmore 'all' = Show project info, 'progress' = Show task progression, ''=Show nothing more
* @param User $usertofilter User object to use for filtering
* @return int Nbr of tasks if OK, <0 if KO
*/
- public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
+ public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showmore = 'all', $usertofilter = null)
{
global $user, $conf, $langs;
@@ -336,7 +338,8 @@ class FormProjets
}
// Search all projects
- $sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,';
+ $sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,';
+ $sql .= ' p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,';
$sql .= ' s.nom as name';
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
@@ -407,7 +410,7 @@ class FormProjets
$disabled = 1;
}
- if ($showproject == 'all') {
+ if (preg_match('/all/', $showmore)) {
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
@@ -442,6 +445,10 @@ class FormProjets
// Label for task
$labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
$titletoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
+ if ($obj->usage_task && preg_match('/progress/', $showmore)) {
+ $labeltoshow .= ' ('.$obj->progress.'%) ';
+ $titletoshow .= ' ('.$obj->progress.'%) ';
+ }
if (!empty($selected) && $selected == $obj->rowid) {
$out .= 'nboftasks = $num;
+
print $out;
$this->db->free($resql);
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index dd43ae0ffae..c37766b24df 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -21,7 +21,7 @@
/**
* \file htdocs/core/class/html.formticket.class.php
* \ingroup ticket
- * \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire
+ * \brief File of class to generate the form for creating a new ticket.
*/
require_once DOL_DOCUMENT_ROOT."/core/class/html.form.class.php";
require_once DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php";
@@ -32,12 +32,12 @@ if (!class_exists('FormCompany')) {
}
/**
- * Classe permettant la generation du formulaire d'un nouveau ticket.
+ * Class to generate the form for creating a new ticket.
+ * Usage: $formticket = new FormTicket($db)
+ * $formticket->proprietes=1 ou chaine ou tableau de valeurs
+ * $formticket->show_form() affiche le formulaire
*
* @package Ticket
- * \remarks Utilisation: $formticket = new FormTicket($db)
- * \remarks $formticket->proprietes=1 ou chaine ou tableau de valeurs
- * \remarks $formticket->show_form() affiche le formulaire
*/
class FormTicket
{
@@ -258,43 +258,41 @@ class FormTicket
if (idgroupticket != "") {
$.ajax({ url: \''.DOL_URL_ROOT.'/core/ajax/fetchKnowledgeRecord.php\',
- data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\', popupurl:false},
+ data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\'},
type: \'GET\',
success: function(response) {
var urllist = \'\';
console.log("We received response "+response);
response = JSON.parse(response)
for (key in response) {
- console.log(response[key])
- urllist += "" + response[key].title + ": " +response[key].url+" ";
+ answer = response[key].answer;
+ urllist += \' \';
}
if (urllist != "") {
- console.log(urllist)
- $("#KWwithajax").html(\''.$langs->trans("KMFoundForTicketGroup").' \');
+ $("#KWwithajax").html(\''.$langs->trans("KMFoundForTicketGroup").' \');
$("#KWwithajax").show();
+ $(".button_KMpopup").on("click",function(){
+ console.log("Open popup with jQuery(...).dialog() with KM article")
+ var $dialog = $("
").html($(this).attr("data-html"))
+ .dialog({
+ autoOpen: false,
+ modal: true,
+ height: (window.innerHeight - 150),
+ width: "80%",
+ title: $(this).attr("title"),
+ });
+ $dialog.dialog("open");
+ console.log($dialog);
+ })
}
},
error : function(output) {
- console.log("error");
+ console.error("Error on Fetch of KM articles");
},
});
}
};
- $("#selectcategory_code").bind("change",function() { groupticketchange(); });
- MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
- var trackChange = function(element) {
- var observer = new MutationObserver(function(mutations, observer) {
- if (mutations[0].attributeName == "value") {
- $(element).trigger("change");
- }
- });
- observer.observe(element, {
- attributes: true
- });
- }
-
- trackChange($("#selectcategory_code")[0]);
-
+ $("#selectcategory_code").on("change",function() { groupticketchange(); });
if ($("#selectcategory_code").val() != "") {
groupticketchange();
}
@@ -666,7 +664,7 @@ class FormTicket
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
- if (empty($outputlangs)) {
+ if (is_null($outputlangs) || !is_object($outputlangs)) {
$outputlangs = $langs;
}
$outputlangs->load("ticket");
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 357fcc9972f..698bf4410da 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2508,7 +2508,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '')
* False or 0 or 'tzserver' = local to server TZ
* 'auto'
* 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented.
- * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user.
+ * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user into a GMT date.
* 'tz,TimeZone' = use specified timezone
* @param int $check 0=No check on parameters (Can use day 32, etc...)
* @return int|string Date as a timestamp, '' or false if error
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 1400dc40458..9d6b9c48192 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -126,7 +126,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
|| !empty($conf->propal->enabled) || !empty($conf->commande->enabled)
|| !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
- || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) {
+ || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->stock->enabled)) {
$nbElements = 0;
// Enable caching of thirdrparty count Contacts
$cachekey = 'count_elements_project_'.$project->id;
@@ -134,6 +134,9 @@ function project_prepare_head(Project $project, $moreparam = '')
if (!is_null($dataretrieved)) {
$nbElements = $dataretrieved;
} else {
+ if (!empty($conf->stock->enabled)) {
+ $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project');
+ }
if (!empty($conf->propal->enabled)) {
$nbElements += $project->getElementCount('propal', 'propal');
}
@@ -974,6 +977,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
+ // Computed progress
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) {
print '';
if ($total_projectlinesa_planned) {
@@ -981,6 +985,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
print ' ';
}
+
+ // Declared progress
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress']['checked'])) {
print '';
if ($total_projectlinesa_planned) {
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 4c36244a5bf..da5d9388bd8 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -513,8 +513,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->salaries->delete) {
$deleteok = 0;
}
- } elseif ($feature == 'salaries') {
- if (!$user->rights->salaries->delete) {
+ } elseif ($feature == 'adherent') {
+ if (!$user->rights->adherent->supprimer) {
$deleteok = 0;
}
} elseif (!empty($feature2)) { // This is for permissions on 2 levels
diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
index b1f48450d0d..f5862bfc5f2 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -175,10 +175,11 @@ class pdf_standard extends ModeleExpenseReport
//$this->posxdate=88;
//$this->posxtype=107;
//$this->posxprojet=120;
- $this->posxtva = 130;
- $this->posxup = 145;
- $this->posxqty = 168;
- $this->postotalttc = 178;
+ $this->posxtva = 112;
+ $this->posxup = 127;
+ $this->posxqty = 150;
+ $this->postotalht = 160;
+ $this->postotalttc = 180;
// if (empty($conf->projet->enabled)) {
// $this->posxtva-=20;
// $this->posxup-=20;
@@ -642,11 +643,15 @@ class pdf_standard extends ModeleExpenseReport
// Quantity
$pdf->SetXY($this->posxqty, $curY);
- $pdf->MultiCell($this->postotalttc - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R');
+ $pdf->MultiCell($this->postotalht - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R');
+
+ // Total without taxes
+ $pdf->SetXY($this->postotalht, $curY);
+ $pdf->MultiCell($this->postotalttc - $this->postotalht - 0.8, 4, price($object->lines[$linenumber]->total_ht), 0, 'R');
// Total with all taxes
$pdf->SetXY($this->postotalttc - 1, $curY);
- $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R');
+ $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R');
// Comments
$pdf->SetXY($this->posxcomment, $curY);
@@ -950,14 +955,14 @@ class pdf_standard extends ModeleExpenseReport
// Accountancy piece
if (empty($hidetop)) {
$pdf->SetXY($this->posxpiece - 1, $tab_top + 1);
- $pdf->MultiCell($this->posxcomment - $this->posxpiece - 1, 1, '', '', 'R');
+ $pdf->MultiCell($this->posxcomment - $this->posxpiece - 0.8, 1, '', '', 'R');
}
// Comments
$pdf->line($this->posxcomment - 1, $tab_top, $this->posxcomment - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxcomment - 1, $tab_top + 1);
- $pdf->MultiCell($this->posxdate - $this->posxcomment - 1, 1, $outputlangs->transnoentities("Description"), '', 'L');
+ $pdf->MultiCell($this->posxdate - $this->posxcomment - 0.8, 1, $outputlangs->transnoentities("Description"), '', 'L');
}
// Date
@@ -990,7 +995,7 @@ class pdf_standard extends ModeleExpenseReport
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
- $pdf->SetXY($this->posxtva - 1, $tab_top + 1);
+ $pdf->SetXY($this->posxtva - 0.8, $tab_top + 1);
$pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
}
}
@@ -998,22 +1003,29 @@ class pdf_standard extends ModeleExpenseReport
// Unit price
$pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
- $pdf->SetXY($this->posxup - 1, $tab_top + 1);
- $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceU"), '', 'C');
+ $pdf->SetXY($this->posxup - 0.8, $tab_top + 1);
+ $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUTTC"), '', 'C');
}
// Quantity
$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
- $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
- $pdf->MultiCell($this->postotalttc - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
+ $pdf->SetXY($this->posxqty - 0.8, $tab_top + 1);
+ $pdf->MultiCell($this->postotalht - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
+ }
+
+ // Total without taxes
+ $pdf->line($this->postotalht - 1, $tab_top, $this->postotalht - 1, $tab_top + $tab_height);
+ if (empty($hidetop)) {
+ $pdf->SetXY($this->postotalht - 0.8, $tab_top + 1);
+ $pdf->MultiCell($this->postotalttc - $this->postotalht + 1, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
}
// Total with all taxes
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
if (empty($hidetop)) {
- $pdf->SetXY($this->postotalttc - 1, $tab_top + 1);
- $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R');
+ $pdf->SetXY($this->postotalttc - 0.8, $tab_top + 1);
+ $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R');
}
$pdf->SetTextColor(0, 0, 0);
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index f978a436354..aeac5d038f3 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -68,6 +68,7 @@ if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf-
if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier'))) {
$colspan++; // With this, there is a column move button
}
+
//print $object->element;
// Lines for extrafield
$objectline = null;
@@ -673,15 +674,27 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
$("#prod_entry_mode_predef").click();
+ if (in_array($this->table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?>
+ $("#date_start, #date_end").focusout(function() {
+ let type = $(this).attr('type');
+ let mandatoryP = $(this).attr('mandatoryperiod');
+ if (type == 1 && mandatoryP == 1) {
+ if ($(this).val() == '' && !$(this).hasClass('inputmandatory')) {
+ $(this).addClass('inputmandatory');
+ }else{
+ $(this).removeClass('inputmandatory');
+ }
+ }
+ });
+
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function()
{
console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val());
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
-
jQuery('#trlinefordates').show();
rights->margins->creer) {
{ 'id': $(this).val(), 'socid': socid; ?> },
function(data) {
console.log("Load unit price end, we got value "+data.price_ht);
+
+ $('#date_start').removeAttr('type');
+ $('#date_end').removeAttr('type');
+ $('#date_start').attr('type', data.type);
+ $('#date_end').attr('type', data.type);
+
+ $('#date_start').removeAttr('mandatoryperiod');
+ $('#date_end').removeAttr('mandatoryperiod');
+ $('#date_start').attr('mandatoryperiod', data.mandatory_period);
+ $('#date_end').attr('mandatoryperiod', data.mandatory_period);
+
+ // service and we setted mandatory_period to true
+ if (data.mandatory_period == 1 && data.type == 1) {
+ jQuery('#date_start').addClass('inputmandatory');
+ jQuery('#date_end').addClass('inputmandatory');
+ }else{
+ jQuery('#date_start').removeClass('inputmandatory');
+ jQuery('#date_end').removeClass('inputmandatory');
+ }
+
jQuery("#price_ht").val(data.price_ht);
global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
@@ -984,6 +1017,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
jQuery("#fournprice_predef").hide();
}
+
function setforpredef() {
console.log("Call setforpredef. We hide some fields and show dates");
jQuery("#select_type").val(-1);
diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php
index 9094daaa2d1..611d6a9cce5 100644
--- a/htdocs/core/tpl/objectline_edit.tpl.php
+++ b/htdocs/core/tpl/objectline_edit.tpl.php
@@ -333,9 +333,18 @@ $coldisplay++;
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
}
+
+
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
}
+
+ $res = $line->fetch_product();
+ if ($res > 0 ) {
+ if ( $line->product->isMandatoryPeriod() && $line->product->isService()) {
+ print 'jQuery("#date_start").addClass("error");';
+ }
+ }
}
if (!$line->date_end) {
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
@@ -344,6 +353,14 @@ $coldisplay++;
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
}
+
+ $res = $line->fetch_product();
+ // on doit fetch le product là !!! pour connaître le type
+ if ($res > 0 ) {
+ if ($line->product->isMandatoryperiod() && $line->product->isService()) {
+ print 'jQuery("#date_end").addClass("error");';
+ }
+ }
}
print ''
?>
@@ -451,7 +468,17 @@ jQuery(document).ready(function()
}
});
- table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?>
+ $("#date_start, #date_end").focusout(function() {
+ if ( $(this).val() == '' && !$(this).hasClass('inputmandatory') ) {
+ $(this).addClass('inputmandatory');
+ } else {
+ $(this).removeClass('inputmandatory');
+ }
+ });
+ margin->enabled)) {
?>
/* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index ad27dae210c..8ebb767a4d8 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -182,6 +182,22 @@ if (($line->info_bits & 2) == 2) {
if ($line->date_start || $line->date_end) {
print ''.get_date_range($line->date_start, $line->date_end, $format).'
';
}
+ if (!$line->date_start || !$line->date_end) {
+ // show warning under line
+ // we need to fetch product associated to line for some test
+ if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') {
+ $res = $line->fetch_product();
+ if ($res > 0 ) {
+ if ($line->product->isService() && $line->product->isMandatoryPeriod()) {
+ print ''.$langs->trans("mandatoryPeriodNeedTobeSet").'
';
+ }
+ }
+ }
+ }
+
+
+
+
//print get_date_range($line->date_start, $line->date_end, $format);
}
diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php
index 04f9aaa17cc..dd1462ecf5f 100644
--- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php
+++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php
@@ -101,8 +101,11 @@ class InterfaceEventOrganization extends DolibarrTriggers
$defaultref = '';
}
$task->ref = $defaultref;
- $task->date_start = $object->date_start;
- $task->date_end = $object->date_end;
+
+ // TODO Can set offset for start date or endline from setup of task to create when creating event
+ $task->date_start = null;
+ $task->date_end = null;
+
$result = $task->create($user);
if ($result < 0) {
$this->errors=array_merge($this->errors, $task->errors);
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 54b1e6b6bb8..aed93b51f6f 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -729,10 +729,10 @@ class EcmDirectory extends CommonObject
// We count number of _ to have level (we use strlen that is faster than dol_strlen)
$this->cats[$id_categ]['level'] = strlen(preg_replace('/([^_])/i', '', $this->cats[$id_categ]['fullpath']));
- // Traite ces enfants
+ // Process children
$protection++;
if ($protection > 20) {
- return; // On ne traite pas plus de 20 niveaux
+ return; // We never go more than 20 levels
}
if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children'])) {
foreach ($this->cats[$id_categ]['id_children'] as $key => $val) {
diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php
index 4b9d0a847f2..623d626935d 100644
--- a/htdocs/ecm/class/htmlecm.form.class.php
+++ b/htdocs/ecm/class/htmlecm.form.class.php
@@ -55,9 +55,10 @@ class FormEcm
* @param int $selected Id of preselected section
* @param string $select_name Name of HTML select component
* @param string $module Module ('ecm', 'medias', ...)
+ * @param array $ids_to_ignore Array of id to ignore
* @return string String with HTML select
*/
- public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm')
+ public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm', $ids_to_ignore = array())
{
global $conf, $langs;
$langs->load("ecm");
@@ -65,6 +66,9 @@ class FormEcm
if ($select_name == '') {
$select_name = "catParent";
}
+ if (!is_array($ids_to_ignore)) {
+ $ids_to_ignore = array($ids_to_ignore);
+ }
$cate_arbo = null;
if ($module == 'ecm') {
@@ -83,13 +87,15 @@ class FormEcm
} else {
$output .= ' ';
foreach ($cate_arbo as $key => $value) {
- $valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id'];
- if ($selected && $valueforoption == $selected) {
- $add = 'selected ';
- } else {
- $add = '';
+ if (!in_array($cate_arbo[$key]['id'], $ids_to_ignore)) {
+ $valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id'];
+ if ($selected && $valueforoption == $selected) {
+ $add = 'selected ';
+ } else {
+ $add = '';
+ }
+ $output .= ''.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).' ';
}
- $output .= ''.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).' ';
}
}
}
diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php
index fec8151728e..b6aa59720ae 100644
--- a/htdocs/ecm/dir_card.php
+++ b/htdocs/ecm/dir_card.php
@@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/ecm/class/htmlecm.form.class.php';
// Load translation files required by page
$langs->loadLangs(array('ecm', 'companies', 'other'));
@@ -204,6 +205,12 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) {
// Fetch was already done
$ecmdir->label = dol_sanitizeFileName(GETPOST("label"));
+ $fk_parent = GETPOST("catParent", 'int');
+ if ($fk_parent == "-1") {
+ $ecmdir->fk_parent = "0";
+ } else {
+ $ecmdir->fk_parent = $fk_parent;
+ }
$ecmdir->description = GETPOST("description");
$ret = $extrafields->setOptionalsFromPost(null, $ecmdir);
if ($ret < 0) {
@@ -219,8 +226,10 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) {
}
$result = $ecmdir->update($user);
if ($result > 0) {
+ $newdir = $ecmdir->getRelativePath(1);
+ $newdir = $conf->ecm->dir_output.'/'.$newdir;
// Try to rename file if changed
- if ($oldlabel != $ecmdir->label && file_exists($olddir)) {
+ if (($oldlabel != $ecmdir->label && file_exists($olddir)) || ($olddir != $newdir && file_exists($olddir))) {
$newdir = $ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory
$newdir = $conf->ecm->dir_output.'/'.$newdir;
//print $olddir.'-'.$newdir;
@@ -270,6 +279,7 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) {
*/
$form = new Form($db);
+$formecm = new FormEcm($db);
$object = new EcmDirectory($db); // Need to create a new one instance
$extrafields = new ExtraFields($db);
@@ -317,11 +327,7 @@ if ($module == 'ecm') {
$tmpecmdir->fetch($ecmdir->id);
while ($tmpecmdir && $result > 0) {
$tmpecmdir->ref = $tmpecmdir->label;
- if ($i == 0 && $action == 'edit') {
- $s = ' ';
- } else {
- $s = $tmpecmdir->getNomUrl(1).$s;
- }
+ $s = $tmpecmdir->getNomUrl(1).$s;
if ($tmpecmdir->fk_parent) {
$s = ' -> '.$s;
$result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
@@ -371,6 +377,16 @@ print img_picto('','object_dir').' '.$l
print $s;
print ' ';*/
if ($module == 'ecm') {
+ if ($action == 'edit') {
+ print ''.$langs->trans("ECMDirName").' ';
+ print ' ';
+ print ' ';
+ print ''.$langs->trans("ECMParentDirectory").' ';
+ print $formecm->selectAllSections($ecmdir->fk_parent, '', 'ecm', array($ecmdir->id));
+ print ' ';
+ print ' ';
+ }
+
print ''.$langs->trans("Description").' ';
if ($action == 'edit') {
print '
';
}
+
+ print "\n";
} else {
if ($id > 0 || !empty($ref)) {
//
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index fb0969dc7ef..f4f6e9e349f 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -57,6 +57,7 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
-- v15
+ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0;
ALTER TABLE llx_holiday ADD COLUMN date_approve DATETIME DEFAULT NULL;
ALTER TABLE llx_holiday ADD COLUMN fk_user_approve integer DEFAULT NULL;
diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql
index c7a7f8ecf7f..b780d24f1e2 100644
--- a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql
+++ b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql
@@ -29,10 +29,10 @@ create table llx_commande_fournisseurdet
label varchar(255), -- product label
description text,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3) DEFAULT 0, -- taux tva
- localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
+ tva_tx double(7,4) DEFAULT 0, -- taux tva
+ localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
diff --git a/htdocs/install/mysql/tables/llx_commandedet.sql b/htdocs/install/mysql/tables/llx_commandedet.sql
index c7b94a46add..caff1ce7028 100644
--- a/htdocs/install/mysql/tables/llx_commandedet.sql
+++ b/htdocs/install/mysql/tables/llx_commandedet.sql
@@ -29,10 +29,10 @@ create table llx_commandedet
label varchar(255) DEFAULT NULL,
description text,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3), -- Vat rate
- localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
+ tva_tx double(7,4), -- Vat rate
+ localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
diff --git a/htdocs/install/mysql/tables/llx_contratdet.sql b/htdocs/install/mysql/tables/llx_contratdet.sql
index bbe19955e33..e9be3c4ad0c 100644
--- a/htdocs/install/mysql/tables/llx_contratdet.sql
+++ b/htdocs/install/mysql/tables/llx_contratdet.sql
@@ -38,10 +38,10 @@ create table llx_contratdet
date_cloture datetime,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3) DEFAULT 0, -- taux tva
- localtax1_tx double(6,3) DEFAULT 0, -- local tax 1 rate
+ tva_tx double(7,4) DEFAULT 0, -- taux tva
+ localtax1_tx double(7,4) DEFAULT 0, -- local tax 1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- local tax 2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- local tax 2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real NOT NULL, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
diff --git a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql
index 6d01cf4bba1..b505f8f6a31 100644
--- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql
+++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql
@@ -21,6 +21,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
fk_soc integer,
fk_actioncomm integer,
fk_project integer NOT NULL,
+ fk_invoice integer NULL,
email varchar(100),
date_subscription datetime,
amount double DEFAULT NULL,
diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql
index bd97600e2c8..e6304f64c7f 100644
--- a/htdocs/install/mysql/tables/llx_expensereport_det.sql
+++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql
@@ -31,10 +31,10 @@ CREATE TABLE llx_expensereport_det
value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120)
remise_percent real,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3), -- Vat rate
- localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
+ tva_tx double(7,4), -- Vat rate
+ localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
total_ht double(24,8) DEFAULT 0 NOT NULL,
total_tva double(24,8) DEFAULT 0 NOT NULL,
diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql
index 40b613d4ac5..4012fb7087d 100644
--- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql
+++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql
@@ -33,10 +33,10 @@ create table llx_facture_fourn_det
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
fk_remise_except integer NULL, -- Lien vers table des remises fixes
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3), -- TVA taux product/service
- localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
+ tva_tx double(7,4), -- TVA taux product/service
+ localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
total_ht double(24,8), -- Total line price of product excluding tax
tva double(24,8), -- Total TVA of line
diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql
index 3b1ea86cc0e..5e48b16be09 100644
--- a/htdocs/install/mysql/tables/llx_facturedet.sql
+++ b/htdocs/install/mysql/tables/llx_facturedet.sql
@@ -31,10 +31,10 @@ create table llx_facturedet
label varchar(255) DEFAULT NULL,
description text,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3), -- Vat rate (example 20%)
- localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
+ tva_tx double(7,4), -- Vat rate (example 20%)
+ localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real, -- Quantity (exemple 2). Note: for credit note, the price is negative, not the quantity. Like for discount, price is negative, not quantity.
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
diff --git a/htdocs/install/mysql/tables/llx_facturedet_rec.sql b/htdocs/install/mysql/tables/llx_facturedet_rec.sql
index a66d7ccb0c3..f515276c442 100644
--- a/htdocs/install/mysql/tables/llx_facturedet_rec.sql
+++ b/htdocs/install/mysql/tables/llx_facturedet_rec.sql
@@ -30,10 +30,10 @@ create table llx_facturedet_rec
label varchar(255) DEFAULT NULL,
description text,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3), -- taux tva
- localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
+ tva_tx double(7,4), -- taux tva
+ localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql
index e89a7658e5a..78560c5a05e 100644
--- a/htdocs/install/mysql/tables/llx_product.sql
+++ b/htdocs/install/mysql/tables/llx_product.sql
@@ -47,11 +47,11 @@ create table llx_product
price_base_type varchar(3) DEFAULT 'HT',
cost_price double(24,8) DEFAULT NULL, -- Cost price without tax. Can be used for margin calculation.
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
- tva_tx double(6,3), -- Default VAT rate of product
+ tva_tx double(7,4), -- Default VAT rate of product
recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT
- localtax1_tx double(6,3) DEFAULT 0,
+ localtax1_tx double(7,4) DEFAULT 0,
localtax1_type varchar(10) NOT NULL DEFAULT '0',
- localtax2_tx double(6,3) DEFAULT 0,
+ localtax2_tx double(7,4) DEFAULT 0,
localtax2_type varchar(10) NOT NULL DEFAULT '0',
fk_user_author integer DEFAULT NULL, -- user making creation
fk_user_modif integer, -- user making last change
@@ -103,6 +103,9 @@ create table llx_product
desiredstock float DEFAULT 0,
fk_unit integer DEFAULT NULL,
price_autogen tinyint DEFAULT 0,
+ fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specifif to a project
+ mandatory_period tinyint DEFAULT 0 -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action)
+
fk_default_bom integer DEFAULT NULL,
fk_project integer DEFAULT NULL -- Used when the product was generated by a project or is specific to a project
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_product_customer_price.sql b/htdocs/install/mysql/tables/llx_product_customer_price.sql
index 361a42a5b54..7f843a8784e 100644
--- a/htdocs/install/mysql/tables/llx_product_customer_price.sql
+++ b/htdocs/install/mysql/tables/llx_product_customer_price.sql
@@ -35,11 +35,11 @@ create table llx_product_customer_price
price_min_ttc double(24,8) DEFAULT 0,
price_base_type varchar(3) DEFAULT 'HT',
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
- tva_tx double(6,3),
+ tva_tx double(7,4),
recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT
- localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1
+ localtax1_tx double(7,4) DEFAULT 0, -- Other local VAT 1
localtax1_type varchar(10) NOT NULL DEFAULT '0',
- localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2
+ localtax2_tx double(7,4) DEFAULT 0, -- Other local VAT 2
localtax2_type varchar(10) NOT NULL DEFAULT '0',
fk_user integer,
import_key varchar(14) -- Import key
diff --git a/htdocs/install/mysql/tables/llx_product_customer_price_log.sql b/htdocs/install/mysql/tables/llx_product_customer_price_log.sql
index 29906fe7ff2..cd591b41099 100644
--- a/htdocs/install/mysql/tables/llx_product_customer_price_log.sql
+++ b/htdocs/install/mysql/tables/llx_product_customer_price_log.sql
@@ -34,11 +34,11 @@ create table llx_product_customer_price_log
price_min_ttc double(24,8) DEFAULT 0,
price_base_type varchar(3) DEFAULT 'HT',
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
- tva_tx double(6,3),
+ tva_tx double(7,4),
recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT
- localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1
+ localtax1_tx double(7,4) DEFAULT 0, -- Other local VAT 1
localtax1_type varchar(10) NOT NULL DEFAULT '0',
- localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2
+ localtax2_tx double(7,4) DEFAULT 0, -- Other local VAT 2
localtax2_type varchar(10) NOT NULL DEFAULT '0',
fk_user integer,
import_key varchar(14) -- Import key
diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
index 2a01df30e4b..51b691e8ae2 100644
--- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
+++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
@@ -39,10 +39,10 @@ create table llx_product_fournisseur_price
default_vat_code varchar(10),
barcode varchar(180) DEFAULT NULL, -- barcode
fk_barcode_type integer DEFAULT NULL, -- barcode type
- tva_tx double(6,3) NOT NULL,
- localtax1_tx double(6,3) DEFAULT 0,
+ tva_tx double(7,4) NOT NULL,
+ localtax1_tx double(7,4) DEFAULT 0,
localtax1_type varchar(10) NOT NULL DEFAULT '0',
- localtax2_tx double(6,3) DEFAULT 0,
+ localtax2_tx double(7,4) DEFAULT 0,
localtax2_type varchar(10) NOT NULL DEFAULT '0',
info_bits integer NOT NULL DEFAULT 0,
fk_user integer,
diff --git a/htdocs/install/mysql/tables/llx_product_price.sql b/htdocs/install/mysql/tables/llx_product_price.sql
index ff862e427e0..9ebbeed9f96 100644
--- a/htdocs/install/mysql/tables/llx_product_price.sql
+++ b/htdocs/install/mysql/tables/llx_product_price.sql
@@ -35,11 +35,11 @@ create table llx_product_price
price_min_ttc double(24,8) default NULL,
price_base_type varchar(3) DEFAULT 'HT',
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
- tva_tx double(6,3) DEFAULT 0 NOT NULL, -- Used only when option PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on (not supported)
+ tva_tx double(7,4) DEFAULT 0 NOT NULL, -- Used only when option PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on (not supported)
recuperableonly integer NOT NULL DEFAULT '0',
- localtax1_tx double(6,3) DEFAULT 0,
+ localtax1_tx double(7,4) DEFAULT 0,
localtax1_type varchar(10) NOT NULL DEFAULT '0',
- localtax2_tx double(6,3) DEFAULT 0,
+ localtax2_tx double(7,4) DEFAULT 0,
localtax2_type varchar(10) NOT NULL DEFAULT '0',
fk_user_author integer,
tosell tinyint DEFAULT 1,
diff --git a/htdocs/install/mysql/tables/llx_propaldet.sql b/htdocs/install/mysql/tables/llx_propaldet.sql
index 7156d90af2f..4dc9d570838 100644
--- a/htdocs/install/mysql/tables/llx_propaldet.sql
+++ b/htdocs/install/mysql/tables/llx_propaldet.sql
@@ -29,10 +29,10 @@ create table llx_propaldet
description text,
fk_remise_except integer NULL, -- Lien vers table des remises fixes
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3) DEFAULT 0, -- Vat rate
- localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
+ tva_tx double(7,4) DEFAULT 0, -- Vat rate
+ localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
- localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
+ localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type
qty real, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index c40a42ee0bd..7112b6e93ea 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -99,9 +99,9 @@ create table llx_societe
fk_shipping_method integer, -- preferred shipping method id
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
- localtax1_value double(6,3),
+ localtax1_value double(7,4),
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
- localtax2_value double(6,3),
+ localtax2_value double(7,4),
barcode varchar(180), -- barcode
fk_barcode_type integer NULL DEFAULT 0, -- barcode type
price_level integer NULL, -- level of price for multiprices
diff --git a/htdocs/install/mysql/tables/llx_societe_remise.sql b/htdocs/install/mysql/tables/llx_societe_remise.sql
index 2d4e3a9c258..37746051b0b 100644
--- a/htdocs/install/mysql/tables/llx_societe_remise.sql
+++ b/htdocs/install/mysql/tables/llx_societe_remise.sql
@@ -27,7 +27,7 @@ create table llx_societe_remise
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
datec datetime, -- creation date
fk_user_author integer, -- creation user
- remise_client double(6,3) DEFAULT 0 NOT NULL, -- discount
+ remise_client double(7,4) DEFAULT 0 NOT NULL, -- discount
note text
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_societe_remise_except.sql b/htdocs/install/mysql/tables/llx_societe_remise_except.sql
index 63762f8ad32..8fed65fe5f0 100644
--- a/htdocs/install/mysql/tables/llx_societe_remise_except.sql
+++ b/htdocs/install/mysql/tables/llx_societe_remise_except.sql
@@ -29,7 +29,7 @@ create table llx_societe_remise_except
amount_ht double(24,8) NOT NULL,
amount_tva double(24,8) DEFAULT 0 NOT NULL,
amount_ttc double(24,8) DEFAULT 0 NOT NULL,
- tva_tx double(6,3) DEFAULT 0 NOT NULL,
+ tva_tx double(7,4) DEFAULT 0 NOT NULL,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
fk_user integer NOT NULL,
fk_facture_line integer,
diff --git a/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql b/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql
index d6dfdc20d9d..85ba8e9b7ff 100644
--- a/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql
+++ b/htdocs/install/mysql/tables/llx_societe_remise_supplier.sql
@@ -27,7 +27,7 @@ create table llx_societe_remise_supplier
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
datec datetime, -- creation date
fk_user_author integer, -- creation user
- remise_supplier double(6,3) DEFAULT 0 NOT NULL, -- discount
+ remise_supplier double(7,4) DEFAULT 0 NOT NULL, -- discount
note text
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql b/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql
index 6990bf334e5..4e3d8bd13f9 100644
--- a/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql
+++ b/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql
@@ -24,10 +24,10 @@ CREATE TABLE llx_supplier_proposaldet (
description text,
fk_remise_except integer DEFAULT NULL,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
- tva_tx double(6,3) DEFAULT 0, -- Vat rate
- localtax1_tx double(6,3) DEFAULT 0,
+ tva_tx double(7,4) DEFAULT 0, -- Vat rate
+ localtax1_tx double(7,4) DEFAULT 0,
localtax1_type varchar(10) DEFAULT NULL,
- localtax2_tx double(6,3) DEFAULT 0,
+ localtax2_tx double(7,4) DEFAULT 0,
localtax2_type varchar(10) DEFAULT NULL,
qty double DEFAULT NULL,
remise_percent double DEFAULT '0',
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index f2cb92efc7f..27d34e2aa51 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -144,11 +144,6 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
- // Create the global $hookmanager object
- include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
- $hookmanager = new HookManager($db);
- $hookmanager->initHooks(array('upgrade'));
-
if (!$db->connected) {
print '