diff --git a/ChangeLog b/ChangeLog
index 2e8bfc968c7..de1482ea183 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
+
+***** ChangeLog for 15.0.0 compared to 14.0.0 *****
+
+For developers:
+---------------
+
+WARNING:
+
+Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
+* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
+* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
+* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
+
+
+
***** ChangeLog for 14.0.2 compared to 14.0.1 *****
FIX: #18353 Invoice list translation issue
@@ -86,19 +101,6 @@ FIX: using Tulip, deposit mask was not saved
FIX: #yogosha6907
-***** ChangeLog for 15.0.0 compared to 14.0.0 *****
-
-For developers:
----------------
-
-WARNING:
-
-Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
-* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
-* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
-
-
-
***** ChangeLog for 14.0.0 compared to 13.0.0 *****
For users:
diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile
index dca74e9e720..eb8e3ade6dc 100644
--- a/build/docker/Dockerfile
+++ b/build/docker/Dockerfile
@@ -57,7 +57,6 @@ RUN echo "host mail" >> /etc/msmtprc
RUN echo "from local@localdomain.com" >> /etc/msmtprc
RUN echo "domain localhost.localdomain" >> /etc/msmtprc
RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
-RUN echo "localhost localhost.localdomain" >> /etc/hosts
EXPOSE 80
diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml
index 2167f069f25..b72118de5fb 100644
--- a/build/docker/docker-compose.yml
+++ b/build/docker/docker-compose.yml
@@ -46,6 +46,8 @@ services:
networks:
- internal-pod
- external-pod
+ extra_hosts:
+ - "localhost.localdomain:127.0.0.1"
mail:
image: maildev/maildev
diff --git a/dev/initdemo/initdemopassword.sh b/dev/initdemo/initdemopassword.sh
index 933c3b1afa2..37264fb8e4d 100755
--- a/dev/initdemo/initdemopassword.sh
+++ b/dev/initdemo/initdemopassword.sh
@@ -171,7 +171,10 @@ if [ $res -ne 0 ]; then
fi
if [ -s "$mydir/initdemopostsql.sql" ]; then
+ echo A file initdemopostsql.sql was found, we execute it.
mysql -P$port $base < "$mydir/initdemopostsql.sql"
+else
+ echo No file initdemopostsql.sql found, we extra sql action done.
fi
diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php
index cb931f550d8..2e369e19de1 100644
--- a/htdocs/accountancy/admin/categories_list.php
+++ b/htdocs/accountancy/admin/categories_list.php
@@ -811,7 +811,7 @@ if ($resql) {
// Modify link
if ($canbemodified) {
- print '
'.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php
index ad1804048c3..c3308393c27 100644
--- a/htdocs/accountancy/admin/subaccount.php
+++ b/htdocs/accountancy/admin/subaccount.php
@@ -439,13 +439,13 @@ if ($resql) {
$e = '';
// Customer
if ($obj->type == 1) {
- $e .= ''.img_edit().' ';
+ $e .= ''.img_edit().' ';
} elseif ($obj->type == 2) {
// Supplier
- $e .= ''.img_edit().' ';
+ $e .= ''.img_edit().' ';
} elseif ($obj->type == 3) {
// User
- $e .= ''.img_edit().' ';
+ $e .= ''.img_edit().' ';
}
print $e;
print ''."\n";
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 1fab2cbf894..c71958691bd 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -433,7 +433,7 @@ if ($action == 'create') {
print $langs->trans('Docdate');
print '';
if ($action != 'editdate') {
- print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).' ';
+ print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).' ';
}
print '';
print '';
@@ -460,7 +460,7 @@ if ($action == 'create') {
print $langs->trans('Codejournal');
print ' ';
if ($action != 'editjournal') {
- print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).' ';
+ print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).' ';
}
print '';
print '';
@@ -487,7 +487,7 @@ if ($action == 'create') {
print $langs->trans('Piece');
print ' ';
if ($action != 'editdocref') {
- print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).' ';
+ print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).' ';
}
print '';
print '';
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 081d074eab7..1b2f376c33f 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -591,7 +591,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors');
- } elseif (!$notifiedexportdate || !$notifiedvalidationdate) {
+ } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
// Specify as export : update field date_export or date_validated
$error = 0;
$db->begin();
@@ -602,17 +602,18 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET";
- if (!$notifiedexportdate && !$notifiedvalidationdate) {
+ if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
$sql .= " date_export = '".$db->idate($now)."'";
$sql .= ", date_validated = '".$db->idate($now)."'";
- } elseif (!$notifiedexportdate) {
+ } elseif (!empty($notifiedexportdate)) {
$sql .= " date_export = '".$db->idate($now)."'";
- } elseif (!$notifiedvalidationdate) {
+ } elseif (!empty($notifiedvalidationdate)) {
$sql .= " date_validated = '".$db->idate($now)."'";
}
$sql .= " WHERE rowid = ".((int) $movement->id);
- dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
+ dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
+
$result = $db->query($sql);
if (!$result) {
$error++;
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 ' ';
$moreforfilter = '';
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index da8bc0cd5e9..61e17ab669c 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -369,9 +369,9 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print ''.$langs->trans("DescVentilDoneSupplier").' ';
- print ' ';
$moreforfilter = '';
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index ca1ad342d8a..dd96ff7dbbd 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -1839,7 +1839,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
}
- // Login Dolibarr
+ // Login Dolibarr - Link to user
print '';
$editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
@@ -1907,7 +1907,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Modify
if (!empty($user->rights->adherent->creer)) {
- print ''.$langs->trans("Modify").' '."\n";
+ print ''.$langs->trans("Modify").' '."\n";
} else {
print ''.$langs->trans("Modify").' '."\n";
}
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index f7a8060d9a5..26a45271801 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -587,7 +587,7 @@ if ($rowid > 0) {
print $langs->trans("LinkedToDolibarrThirdParty");
print ' ';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) {
- print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).' ';
}
print ' ';
print '';
@@ -623,7 +623,7 @@ if ($rowid > 0) {
print ' ';
}
- // Login Dolibarr
+ // Login Dolibarr - Link to user
print '';
print '';
print $langs->trans("LinkedToDolibarrUser");
@@ -631,7 +631,7 @@ if ($rowid > 0) {
if ($action != 'editlogin' && $user->rights->adherent->creer) {
print ' ';
if ($user->rights->user->user->creer) {
- print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).' ';
}
print ' ';
}
@@ -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/adherents/type.php b/htdocs/adherents/type.php
index 839e0c8ba47..6a294b0256a 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -481,12 +481,12 @@ if ($rowid > 0) {
// Edit
if ($user->rights->adherent->configurer) {
- print '';
+ print '';
}
// Add
if ($user->rights->adherent->configurer && !empty($object->status)) {
- print '';
+ print '';
} else {
print '';
}
@@ -728,10 +728,10 @@ if ($rowid > 0) {
// Actions
print '';
if ($user->rights->adherent->creer) {
- print 'id).'">'.img_edit().' ';
+ print 'id).'">'.img_edit().' ';
}
if ($user->rights->adherent->supprimer) {
- print ''.img_picto($langs->trans("Resiliate"), 'disable.png').' ';
+ print ''.img_picto($langs->trans("Resiliate"), 'disable.png').' ';
}
print " ";
diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php
index 63ff01584b0..88f45c9c20e 100644
--- a/htdocs/adherents/type_translation.php
+++ b/htdocs/adherents/type_translation.php
@@ -185,9 +185,9 @@ print "\n\n";
if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) {
- print '
'.$langs->trans("Add").' ';
+ print '
'.$langs->trans("Add").' ';
if ($cnt_trans > 0) {
- print '
'.$langs->trans("Update").' ';
+ print '
'.$langs->trans("Update").' ';
}
}
}
diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index de05203f5f6..5b48301c30d 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -373,7 +373,7 @@ if ($conf->product->enabled) {
print '';
print '
'.$modBarCode->getExample($langs)." \n";
- if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
+ if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
print '
';
print img_picto($langs->trans("Activated"), 'switch_on');
print ' ';
diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php
index df14ef4c1b0..fab1787f5b9 100644
--- a/htdocs/admin/dav.php
+++ b/htdocs/admin/dav.php
@@ -145,7 +145,7 @@ if ($action == 'edit') {
print '
';
print '';
}
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 '';
} else {
print ' '.$langs->trans("NothingToSetup");
diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php
index bdaaa5845f3..d32ef64aebc 100644
--- a/htdocs/admin/expensereport_ik.php
+++ b/htdocs/admin/expensereport_ik.php
@@ -33,10 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php'
// Load translation files required by the page
$langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
-if (!$user->admin) {
- accessforbidden();
-}
-
$error = 0;
$action = GETPOST('action', 'aZ09');
@@ -45,10 +41,20 @@ $ikoffset = GETPOST('ikoffset', 'int');
$coef = GETPOST('coef', 'int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
-$fk_range = GETPOST('fk_range');
+$fk_range = GETPOST('fk_range', 'int');
+
+$expIk = new ExpenseReportIk($db);
+
+if (!$user->admin) {
+ accessforbidden();
+}
+
+
+/*
+ * Actions
+ */
if ($action == 'updateik') {
- $expIk = new ExpenseReportIk($db);
if ($id > 0) {
$result = $expIk->fetch($id);
if ($result < 0) {
@@ -61,13 +67,13 @@ if ($action == 'updateik') {
if ($result > 0) {
setEventMessages('SetupSaved', null, 'mesgs');
+
header('Location: '.$_SERVER['PHP_SELF']);
exit;
} else {
setEventMessages($expIk->error, $expIk->errors, 'errors');
}
} elseif ($action == 'delete') { // TODO add confirm
- $expIk = new ExpenseReportIk($db);
if ($id > 0) {
$result = $expIk->fetch($id);
if ($result < 0) {
@@ -77,12 +83,11 @@ if ($action == 'updateik') {
$expIk->delete($user);
}
-
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
-$rangesbycateg = ExpenseReportIk::getAllRanges();
+$rangesbycateg = $expIk->getAllRanges();
/*
@@ -102,7 +107,8 @@ print dol_get_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"),
echo ''.$langs->trans('ExpenseReportIkDesc').' ';
print ' ';
-echo ' ';
if ($user->rights->asset->write) {
- print 'rowid.'">'.img_edit().' ';
+ print 'rowid.'">'.img_edit().' ';
} else {
print ' ';
}
@@ -503,7 +503,7 @@ if ($rowid > 0) {
// Edit
if ($user->rights->asset->write) {
- print '';
+ print '';
}
// Delete
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 2c3896a6282..9ef77fb0d98 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -121,7 +121,7 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
$coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
} else {
- print 'id.'&action=editline&lineid='.$line->id.'">'.img_edit().' ';
+ print 'id.'&action=editline&token='.newToken().'&lineid='.$line->id.'">'.img_edit().' ';
}
print '';
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/categories/traduction.php b/htdocs/categories/traduction.php
index 80f64210bf5..2bbb4b5f0a8 100644
--- a/htdocs/categories/traduction.php
+++ b/htdocs/categories/traduction.php
@@ -231,9 +231,9 @@ print "\n\n";
if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) {
- print '
'.$langs->trans('Add').' ';
+ print '
'.$langs->trans('Add').' ';
if ($cnt_trans > 0) {
- print '
'.$langs->trans('Update').' ';
+ print '
'.$langs->trans('Update').' ';
}
}
}
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 8a10b39826f..e56a2e89fcf 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1688,7 +1688,7 @@ if ($id > 0) {
print img_picto('', 'project', 'class="paddingrightonly"');
$numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500');
if ($numprojet == 0) {
- print '
id.'&action=edit').'"> ';
+ print '
id.'&action=edit').'"> ';
}
print '
';
}
@@ -2168,7 +2168,7 @@ if ($id > 0) {
if ($action != 'edit') {
if ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
- print '';
+ print '';
} else {
print '';
}
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 79fb13a8717..a4c06b65d1f 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1245,7 +1245,6 @@ class ActionComm extends CommonObject
* Load all objects with filters.
* @todo WARNING: This make a fetch on all records instead of making one request with a join.
*
- * @param DoliDb $db Not used
* @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to
@@ -1255,7 +1254,7 @@ class ActionComm extends CommonObject
* @param string $limit Limit number of answers
* @return array|string Error string if KO, array with actions if OK
*/
- public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
+ public function getActions($socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
{
global $conf, $langs;
@@ -1277,33 +1276,33 @@ class ActionComm extends CommonObject
$sql .= " (SELECT fk_actioncomm FROM ".MAIN_DB_PREFIX."actioncomm_resources WHERE";
$sql .= " element_type = 'socpeople' AND fk_element = ".((int) $fk_element).')';
} else {
- $sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$db->escape($elementtype)."'";
+ $sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$this->db->escape($elementtype)."'";
}
}
if (!empty($filter)) {
$sql .= $filter;
}
if ($sortorder && $sortfield) {
- $sql .= $db->order($sortfield, $sortorder);
+ $sql .= $this->db->order($sortfield, $sortorder);
}
- $sql .= $db->plimit($limit, 0);
+ $sql .= $this->db->plimit($limit, 0);
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
if ($num) {
for ($i = 0; $i < $num; $i++) {
- $obj = $db->fetch_object($resql);
- $actioncommstatic = new ActionComm($db);
+ $obj = $this->db->fetch_object($resql);
+ $actioncommstatic = new ActionComm($this->db);
$actioncommstatic->fetch($obj->id);
$resarray[$i] = $actioncommstatic;
}
}
- $db->free($resql);
+ $this->db->free($resql);
return $resarray;
} else {
- return $db->lasterror();
+ return $this->db->lasterror();
}
}
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index f891bf722cc..c9f422d78c8 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -406,7 +406,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditions');
print '';
if (($action != 'editconditions') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -424,7 +424,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode');
print ' ';
if (($action != 'editmode') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -443,7 +443,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentBankAccount');
print ' ';
if (($action != 'editbankaccount') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
@@ -569,7 +569,7 @@ if ($object->id > 0) {
print $langs->trans('SendingMethod');
print ' ';
if (($action != 'editshipping') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -589,7 +589,7 @@ if ($object->id > 0) {
print $langs->trans('IntracommReportTransportMode');
print ' ';
if (($action != 'edittransportmode') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -652,7 +652,7 @@ if ($object->id > 0) {
print $langs->trans('ProspectLevel');
print ' ';
if ($action != 'editlevel' && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('Modify'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('Modify'), 1).' ';
}
print '';
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..cff5c5d0e35 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);
}
@@ -2078,7 +2093,7 @@ if ($action == 'create') {
print $langs->trans('DatePropal');
print '
';
if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '';
@@ -2105,7 +2120,7 @@ if ($action == 'create') {
print $langs->trans('DateEndPropal');
print ' ';
if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -2135,7 +2150,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort');
print ' ';
if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).' ';
}
print '';
print '';
@@ -2154,7 +2169,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).' ';
}
print '';
print '';
@@ -2183,7 +2198,7 @@ if ($action == 'create') {
}
print ' ';
if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).' ';
}
print '';
print '';
@@ -2203,7 +2218,7 @@ if ($action == 'create') {
print $langs->trans('SendingMethod');
print ' ';
if ($action != 'editshippingmethod' && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
}
print '';
print '';
@@ -2240,7 +2255,7 @@ if ($action == 'create') {
print $langs->trans('Source');
print ' ';
if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).' ';
}
print '';
print '';
@@ -2261,7 +2276,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $usercancreate) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -2281,7 +2296,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -2322,7 +2337,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
@@ -2358,7 +2373,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index bff848c78e2..5791937079b 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -472,11 +472,11 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
-$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
+$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
-if ($search_categ_cus) {
+if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
// Add fields from extrafields
@@ -494,7 +494,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
-if (!empty($search_categ_cus)) {
+if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
@@ -599,6 +599,7 @@ if ($search_multicurrency_montant_ttc != '') {
if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
+
if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
}
@@ -1715,8 +1716,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->email;
- $userstatic->statut = $obj->statut;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->user_entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
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/commande/list.php b/htdocs/commande/list.php
index 22b24c048a2..39e9b811a36 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -428,7 +428,7 @@ $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multic
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
-$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
+$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
$sql .= ' c.fk_input_reason';
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
@@ -1697,8 +1697,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->email;
- $userstatic->statut = $obj->statut;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 9fd88f44d4f..1eb764d7af8 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -1696,21 +1696,21 @@ class Account extends CommonObject
/**
* Function used to replace a thirdparty id with another one.
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $dbs Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
- * @return bool
+ * @return bool True=SQL success, False=SQL error
*/
- public static function replaceThirdparty($db, $origin_id, $dest_id)
+ public static function replaceThirdparty($dbs, $origin_id, $dest_id)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'";
- if (!$db->query($sql)) {
- //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
- //$this->errors = $db->lasterror();
- return false;
- } else {
+ if ($dbs->query($sql)) {
return true;
+ } else {
+ //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
+ //$this->errors = $dbs->lasterror();
+ return false;
}
}
}
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index 97184c1b8eb..af0b388cb7a 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -364,7 +364,7 @@ if (empty($numref)) {
print '';
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
- print 'id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&brref='.$objp->numr.'">'.img_edit().' ';
+ print 'id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().' ';
}
print ' ';
diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php
index 77db777c077..33b453cd0b4 100644
--- a/htdocs/compta/deplacement/card.php
+++ b/htdocs/compta/deplacement/card.php
@@ -469,7 +469,7 @@ if ($action == 'create') {
if ($object->statut < Deplacement::STATUS_REFUNDED) { // if not refunded
if ($user->rights->deplacement->creer) {
- print ''.$langs->trans('Modify').' ';
+ print ''.$langs->trans('Modify').' ';
} else {
print ''.$langs->trans('Modify').' ';
}
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 153bd58114d..28143d0340a 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -1269,7 +1269,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort');
print '';
if ($action != 'editconditions' && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -1290,7 +1290,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -1310,7 +1310,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -1326,7 +1326,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -1398,7 +1398,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
@@ -1416,7 +1416,7 @@ if ($action == 'create') {
print $langs->trans('Model');
print ' ';
if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
- print ' id.'">'.img_edit($langs->trans('SetModel'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetModel'), 1).' ';
}
print '';
print '';
@@ -1463,7 +1463,7 @@ if ($action == 'create') {
print $langs->trans('Frequency');
print ' ';
if ($action != 'editfrequency' && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('Edit'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('Edit'), 1).' ';
}
print '';
print '';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 105c94d6a73..764af7a232a 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);
}
@@ -4322,7 +4336,7 @@ if ($action == 'create') {
print $langs->trans('DateInvoice');
print '';
if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
- print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '';
@@ -4342,7 +4356,7 @@ if ($action == 'create') {
print '';
print ' ';
if ($action == 'editdate_pointoftax') {
@@ -4359,7 +4373,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort');
print ' ';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -4380,7 +4394,7 @@ if ($action == 'create') {
print $langs->trans('DateMaxPayment');
print ' ';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '';
@@ -4404,7 +4418,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -4424,7 +4438,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -4440,7 +4454,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -4468,7 +4482,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if (($action != 'editbankaccount') && $usercancreate) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
@@ -4488,7 +4502,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
@@ -4518,7 +4532,7 @@ if ($action == 'create') {
print $langs->trans('RetainedWarranty');
print ' ';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).' ';
}
print '';
@@ -4541,7 +4555,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).' ';
}
print '';
@@ -4576,7 +4590,7 @@ if ($action == 'create') {
print $langs->trans('RetainedWarrantyDateLimit');
print '';
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).' ';
}
print '';
@@ -4662,7 +4676,7 @@ if ($action == 'create') {
print $langs->trans('RevenueStamp');
print '';
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $usercancreate) {
- print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
}
print '';
print '';
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/list.php b/htdocs/compta/facture/list.php
index e6a49cf6077..b2074224412 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -549,7 +549,7 @@ $sql .= ' typent.code as typent_code,';
$sql .= ' state.code_departement as state_code, state.nom as state_name,';
$sql .= ' country.code as country_code,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
-$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
+$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (!$sall) {
@@ -572,7 +572,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
-if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
+if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
@@ -2013,8 +2013,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->email;
- $userstatic->statut = $obj->statut;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index e94fd6f5e1b..7e5a7047060 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -363,7 +363,7 @@ if ($object->id > 0) {
print $langs->trans('DateInvoice');
print ' ';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '';
@@ -386,7 +386,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditionsShort');
print ' ';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -407,7 +407,7 @@ if ($object->id > 0) {
print $langs->trans('DateMaxPayment');
print ' ';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '';
print '';
@@ -436,7 +436,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -453,7 +453,7 @@ if ($object->id > 0) {
print $langs->trans('BankAccount');
print ' ';
if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
@@ -537,7 +537,7 @@ if ($object->id > 0) {
print $langs->trans('RevenueStamp');
print ' ';
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) {
- print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' ';
}
print '';
print '';
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/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index 61d295a29b0..9b235926421 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -529,7 +529,7 @@ if ($action == 'new') {
print $langs->trans('Date');
print '';
if ($action != 'editdate') {
- print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' ';
}
print '
';
print '
';
@@ -554,7 +554,7 @@ if ($action == 'new') {
print '';
print ' ';
if ($action == 'editrefext')
diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php
index 257e7617531..58cfe5be72d 100644
--- a/htdocs/compta/prelevement/card.php
+++ b/htdocs/compta/prelevement/card.php
@@ -198,8 +198,7 @@ if ($id > 0 || $ref) {
print '
';
print '';
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
@@ -237,7 +236,7 @@ if ($id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT));
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
@@ -251,7 +250,7 @@ if ($id > 0 || $ref) {
print ' ';
print ' ';
- print '';
+ print ' ';
$labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile';
@@ -412,10 +411,9 @@ if ($id > 0 || $ref) {
// Status of line
print " ";
+ print '';
print $ligne->LibStatut($obj->statut, 2);
- print " ";
- print ' ';
- print sprintf("%06s", $obj->rowid);
+ print ''.$obj->rowid.' ';
print ' ';
$thirdparty = new Societe($db);
diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php
index 1c57feca37e..dfd8a920f93 100644
--- a/htdocs/compta/prelevement/class/ligneprelevement.class.php
+++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php
@@ -137,29 +137,31 @@ class LignePrelevement
return $langs->trans($this->statuts[$status]);
} elseif ($mode == 1) {
if ($status == 0) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting
+ return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Waiting
} elseif ($status == 2) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited
+ return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Credited
} elseif ($status == 3) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused
+ return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Refused
}
} elseif ($mode == 2) {
if ($status == 0) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut1');
+ return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"');
} elseif ($status == 2) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut6');
+ return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"');
} elseif ($status == 3) {
- return img_picto($langs->trans($this->statuts[$status]), 'statut8');
+ return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"');
}
} elseif ($mode == 3) {
if ($status == 0) {
- return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1');
+ return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"');
} elseif ($status == 2) {
- return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6');
+ return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"');
} elseif ($status == 3) {
- return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8');
+ return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"');
}
}
+
+ //return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index c00c29e1c39..a100cd9156f 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -100,8 +100,8 @@ if ($id > 0 || $ref) {
print '
';
print ''."\n";
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
if ($object->date_trans <> 0) {
@@ -131,7 +131,7 @@ if ($id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
@@ -145,7 +145,7 @@ if ($id > 0 || $ref) {
print ' ';
print ' ';
- print '';
+ print ' ';
$labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile';
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index 8711f663d55..9ff5970e656 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -90,8 +90,8 @@ if ($prev_id > 0 || $ref) {
print '
';
print ''."\n";
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
if ($object->date_trans <> 0) {
@@ -121,7 +121,7 @@ if ($prev_id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
@@ -135,7 +135,7 @@ if ($prev_id > 0 || $ref) {
print ' ';
print ' ';
- print '';
+ print ' ';
$labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile';
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index 4a9bfbf6345..5833f417ddd 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -89,8 +89,8 @@ if ($prev_id > 0 || $ref) {
print '
';
print ''."\n";
- //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
- print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
+ //print ''.$langs->trans("Ref").' '.$object->getNomUrl(1).' ';
+ print ''.$langs->trans("Date").' '.dol_print_date($object->datec, 'day').' ';
print ''.$langs->trans("Amount").' '.price($object->amount).' ';
if ($object->date_trans <> 0) {
@@ -120,7 +120,7 @@ if ($prev_id > 0 || $ref) {
$acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
- print '';
+ print ' ';
$labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer';
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/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index f436c47b10e..1223ad3ec36 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -577,7 +577,7 @@ if ($id > 0) {
print $langs->trans('DefaultPaymentMode');
print ' ';
if ($action != 'editmode') {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '
';
print ' ';
@@ -595,7 +595,7 @@ if ($id > 0) {
print $langs->trans('DefaultBankAccount');
print ' ';
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '
';
print '';
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index 363af314113..83740385f2b 100755
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -573,7 +573,7 @@ if ($id) {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode') {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '
';
print ' ';
@@ -591,7 +591,7 @@ if ($id) {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
index e458cdf3016..adf5bb722d3 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
@@ -139,11 +139,11 @@ if (!empty($this->control->tpl['action_delete'])) {
if (empty($user->socid)) {
print '';
@@ -1348,7 +1348,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $langs->trans('ProspectLevel');
print ' ';
if ($action != 'editlevel' && $user->rights->societe->contact->creer) {
- print ' id.'">'.img_edit($langs->trans('Modify'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('Modify'), 1).' ';
}
print '';
print '';
@@ -1486,11 +1486,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if ($user->rights->societe->contact->creer) {
- print ''.$langs->trans('Modify').' ';
+ print ''.$langs->trans('Modify').' ';
}
if (!$object->user_id && $user->rights->user->user->creer) {
- print ''.$langs->trans("CreateDolibarrLogin").' ';
+ print ''.$langs->trans("CreateDolibarrLogin").' ';
}
// Activer
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index bae32e8b3b1..71e888540b2 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -575,13 +575,13 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
}
$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param .= '&type='.urlencode($type).'&view='.urlencode($view);
-if (!empty($search_categ)) {
+if (!empty($search_categ) && $search_categ != '-1') {
$param .= '&search_categ='.urlencode($search_categ);
}
-if (!empty($search_categ_thirdparty)) {
+if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
$param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
}
-if (!empty($search_categ_supplier)) {
+if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$param .= '&search_categ_supplier='.urlencode($search_categ_supplier);
}
if ($sall != '') {
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index a5b64e37998..285f71cae48 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -311,7 +311,7 @@ if ($action != 'edit') {
print '";
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index bf9208ccb2b..9d8cdb78912 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -1541,12 +1541,12 @@ if ($action == 'create') {
print ' ';
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) {
print '';
- print '';
+ print ' ';
print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow');
print ' ';
}
if ($user->rights->contrat->creer && ($object->statut >= 0)) {
- print '';
+ print ' ';
print img_edit();
print ' ';
}
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 2cc477520ea..a6157d2a26b 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -129,6 +129,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (!$error) {
$result = $object->create($user);
+ var_dump($object);exit;
if ($result > 0) {
// Creation OK
if ($conf->categorie->enabled && method_exists($object, 'setCategories')) {
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/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php
index 5b95b58d29d..0a5e4548e3f 100644
--- a/htdocs/core/boxes/box_members_by_type.php
+++ b/htdocs/core/boxes/box_members_by_type.php
@@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php
index 9de6a3af12f..cf70bcafcb1 100644
--- a/htdocs/core/boxes/box_members_last_modified.php
+++ b/htdocs/core/boxes/box_members_last_modified.php
@@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php
index 3cea44c2dc3..949edd567f3 100644
--- a/htdocs/core/boxes/box_members_last_subscriptions.php
+++ b/htdocs/core/boxes/box_members_last_subscriptions.php
@@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php
index be835511c6b..fe64f37c805 100644
--- a/htdocs/core/boxes/box_members_subscriptions_by_year.php
+++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php
@@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
$this->enabled = 0; // disabled for external users
}
- $this->hidden = !($user->rights->adherent->lire);
+ $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
}
/**
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..8deda2ecd09 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -165,7 +165,7 @@ class Form
$ret .= ' ';
}
if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
- $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).' ';
+ $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).' ';
}
if (!empty($notabletag) && $notabletag == 1) {
$ret .= ' : ';
@@ -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..0590566582d 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -178,7 +178,8 @@ class FormActions
$sortfield = 'a.datep,a.id';
$sortorder = 'DESC,DESC';
- $listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
+ $actioncomm = new ActionComm($this->db);
+ $listofactions = $actioncomm->getActions($socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
if (!is_array($listofactions)) {
dol_print_error($this->db, 'FailedToGetActions');
}
@@ -221,13 +222,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..975738b3809 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1454,7 +1454,7 @@ class FormFile
if ($permtoeditline) {
$paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '§ion_dir='.urlencode($relativepath) : '');
- print ''.img_edit('default', 0, 'class="paddingrightonly"').' ';
+ print ''.img_edit('default', 0, 'class="paddingrightonly"').' ';
}
}
if ($permonobject) {
@@ -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/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index fb59e2b7c42..bdd0f79a0aa 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -83,7 +83,7 @@ class InfoBox
/**
* Return array of boxes qualified for area and user
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $dbs Database handler
* @param string $mode 'available' or 'activated'
* @param int $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...)
* @param User|null $user Object user to filter
@@ -91,7 +91,7 @@ class InfoBox
* @param int $includehidden Include also hidden boxes
* @return array Array of boxes
*/
- public static function listBoxes($db, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1)
+ public static function listBoxes($dbs, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1)
{
global $conf;
@@ -119,12 +119,12 @@ class InfoBox
}
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG);
- $resql = $db->query($sql);
+ $resql = $dbs->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $dbs->num_rows($resql);
$j = 0;
while ($j < $num) {
- $obj = $db->fetch_object($resql);
+ $obj = $dbs->fetch_object($resql);
if (!in_array($obj->box_id, $excludelist)) {
$regs = array();
@@ -144,7 +144,7 @@ class InfoBox
// Goal is to avoid making a "new" done for each boxes returned by select.
dol_include_once($relsourcefile);
if (class_exists($boxname)) {
- $box = new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
+ $box = new $boxname($dbs, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
//$box=new stdClass();
// box properties
@@ -204,8 +204,8 @@ class InfoBox
$j++;
}
} else {
- dol_syslog($db->lasterror(), LOG_ERR);
- return array('error'=>$db->lasterror());
+ dol_syslog($dbs->lasterror(), LOG_ERR);
+ return array('error'=>$dbs->lasterror());
}
return $boxes;
@@ -215,13 +215,13 @@ class InfoBox
/**
* Save order of boxes for area and user
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $dbs Database handler
* @param int $zone Name of area (0 for Homepage, ...)
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* @param int $userid Id of user
* @return int <0 if KO, 0=Nothing done, > 0 if OK
*/
- public static function saveboxorder($db, $zone, $boxorder, $userid = 0)
+ public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0)
{
global $conf;
@@ -235,18 +235,18 @@ class InfoBox
return 0;
}
- $user = new User($db);
+ $user = new User($dbs);
$user->id = $userid;
- $db->begin();
+ $dbs->begin();
// Save parameters to say user has a dedicated setup
$tab = array();
$confuserzone = 'MAIN_BOXES_'.$zone;
$tab[$confuserzone] = 1;
- if (dol_set_user_param($db, $conf, $user, $tab) < 0) {
- $error = $db->lasterror();
- $db->rollback();
+ if (dol_set_user_param($dbs, $conf, $user, $tab) < 0) {
+ $error = $dbs->lasterror();
+ $dbs->rollback();
return -3;
}
@@ -257,7 +257,7 @@ class InfoBox
$sql .= " AND position = ".((int) $zone);
dol_syslog(get_class()."::saveboxorder", LOG_DEBUG);
- $result = $db->query($sql);
+ $result = $dbs->query($sql);
if ($result) {
$colonnes = explode('-', $boxorder);
foreach ($colonnes as $collist) {
@@ -279,12 +279,12 @@ class InfoBox
$sql .= " values (";
$sql .= " ".((int) $id).",";
$sql .= " ".((int) $zone).",";
- $sql .= " '".$db->escape($colonne.$ii)."',";
+ $sql .= " '".$dbs->escape($colonne.$ii)."',";
$sql .= " ".((int) $userid).",";
$sql .= " ".((int) $conf->entity);
$sql .= ")";
- $result = $db->query($sql);
+ $result = $dbs->query($sql);
if ($result < 0) {
$error++;
break;
@@ -297,10 +297,10 @@ class InfoBox
}
if ($error) {
- $db->rollback();
+ $dbs->rollback();
return -2;
} else {
- $db->commit();
+ $dbs->commit();
return 1;
}
}
diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php
index 2a5e0f99c64..eaf4804b213 100644
--- a/htdocs/core/class/link.class.php
+++ b/htdocs/core/class/link.class.php
@@ -274,24 +274,24 @@ class Link extends CommonObject
/**
* Return nb of links
*
- * @param DoliDb $db Database handler
+ * @param DoliDb $dbs Database handler
* @param string $objecttype Type of the associated object in dolibarr
* @param int $objectid Id of the associated object in dolibarr
* @return int Nb of links, -1 if error
**/
- public static function count($db, $objecttype, $objectid)
+ public static function count($dbs, $objecttype, $objectid)
{
global $conf;
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links";
- $sql .= " WHERE objecttype = '".$db->escape($objecttype)."' AND objectid = ".((int) $objectid);
+ $sql .= " WHERE objecttype = '".$dbs->escape($objecttype)."' AND objectid = ".((int) $objectid);
if ($conf->entity != 0) {
$sql .= " AND entity = ".$conf->entity;
}
- $resql = $db->query($sql);
+ $resql = $dbs->query($sql);
if ($resql) {
- $obj = $db->fetch_object($resql);
+ $obj = $dbs->fetch_object($resql);
if ($obj) {
return $obj->nb;
}
diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php
index 9b812df8dc2..c6769ad0619 100644
--- a/htdocs/core/db/Database.interface.php
+++ b/htdocs/core/db/Database.interface.php
@@ -177,6 +177,14 @@ interface Database
*/
public function escape($stringtoencode);
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode);
+
/**
* Sanitize a string for SQL forging
*
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 02a1e5d13d3..0db4e16a897 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -440,6 +440,17 @@ class DoliDBMysqli extends DoliDB
return $this->db->real_escape_string($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return str_replace('_', '\_', $stringtoencode);
+ }
+
/**
* Return generic error code of last operation.
*
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index 9d17d4b9099..5997349d0c5 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -713,6 +713,17 @@ class DoliDBPgsql extends DoliDB
return pg_escape_string($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return str_replace('_', '\_', $stringtoencode);
+ }
+
/**
* Format a SQL IF
*
diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php
index e2a2c124737..c03d2a5ee04 100644
--- a/htdocs/core/db/sqlite3.class.php
+++ b/htdocs/core/db/sqlite3.class.php
@@ -645,6 +645,17 @@ class DoliDBSqlite3 extends DoliDB
return Sqlite3::escapeString($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return str_replace('_', '\_', $stringtoencode);
+ }
+
/**
* Renvoie le code erreur generique de l'operation precedente.
*
diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php
index 12022ed178c..702d6673527 100644
--- a/htdocs/core/lib/barcode.lib.php
+++ b/htdocs/core/lib/barcode.lib.php
@@ -59,7 +59,10 @@ if (empty($font_loc)) {
if (defined('PHP-BARCODE_PATH_COMMAND')) {
$genbarcode_loc = constant('PHP-BARCODE_PATH_COMMAND');
} else {
- $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
+ $genbarcode_loc = '';
+ if (!empty($conf->global->GENBARCODE_LOCATION)) {
+ $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
+ }
}
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 1d8024cf40e..0adcb967991 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1295,7 +1295,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Edit
if ($user->rights->societe->contact->creer) {
- print '';
+ print ' ';
print img_edit();
print ' ';
}
@@ -2003,7 +2003,7 @@ function show_subsidiaries($conf, $langs, $db, $object)
print ''.$obj->code_client.' ';
print '';
- print '';
+ print ' ';
print img_edit();
print ' ';
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/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index ba18e415539..e2067240c45 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -699,7 +699,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
if ($user->rights->agenda->allactions->create ||
(($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
- $out .= ' ';
+ $out .= ' ';
}
$out .= '';
diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php
index fda21e28a21..05e6d51a78d 100644
--- a/htdocs/core/lib/treeview.lib.php
+++ b/htdocs/core/lib/treeview.lib.php
@@ -190,7 +190,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
print "\n".'';
if ($showfk) {
print '';
- print ' ';
+ print ' ';
print $tab[$x]['title'];
print ' ';
print ' (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 29f208e5254..7a9bb12172b 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -400,7 +400,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
if (!file_exists($file)) {
$url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
}
- print ' id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
+ print ' id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
if ($subdir == $conf->global->MAIN_THEME) {
$title = $langs->trans("ThemeCurrentlyActive");
} else {
diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index 89fd777cd20..20380e02aab 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -866,11 +866,11 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= " AND (";
$searchalgo = '';
if (preg_match('/meta/', $algo)) {
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escape($searchstring)."%' OR wp.description LIKE '%".$db->escape($searchstring)."%'";
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escape($searchstring).",%' OR wp.keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%' OR wp.description LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escapeunderscore($db->escape($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escapeunderscore($db->escape($searchstring))."%'"; // TODO Use a better way to scan keywords
}
if (preg_match('/content/', $algo)) {
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($searchstring)."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
}
$sql .= $searchalgo;
if (is_array($otherfilters) && !empty($otherfilters['category'])) {
@@ -879,6 +879,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= ")";
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($max);
+ //print $sql;
$resql = $db->query($sql);
if ($resql) {
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/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php
index 5bf91ec341e..e89a2a4fe3e 100644
--- a/htdocs/core/modules/modMultiCurrency.class.php
+++ b/htdocs/core/modules/modMultiCurrency.class.php
@@ -300,10 +300,11 @@ class modMultiCurrency extends DolibarrModules
{
global $conf, $user, $langs;
- if (!MultiCurrency::checkCodeAlreadyExists($conf->currency)) {
+ $multicurrency = new MultiCurrency($this->db);
+
+ if (! $multicurrency->checkCodeAlreadyExists($conf->currency)) {
$langs->loadCacheCurrencies('');
- $multicurrency = new MultiCurrency($this->db);
$multicurrency->code = $conf->currency;
$multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')';
$r = $multicurrency->create($user);
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index eed6871c465..c3eba65673b 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -281,6 +281,9 @@ class modSociete extends DolibarrModules
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$this->export_fields_array[$r]['s.price_level'] = 'PriceLevel';
}
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ $this->export_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
+ }
// Add multicompany field
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
$nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1
@@ -317,7 +320,8 @@ class modSociete extends DolibarrModules
'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text',
's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text',
'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text',
- 's.entity'=>'Numeric', 's.price_level'=>'Numeric'
+ 's.entity'=>'Numeric', 's.price_level'=>'Numeric',
+ 's.accountancy_code_sell'=>'Text', 's.accountancy_code_buy'=>'Text'
);
$this->export_entities_array[$r] = array('u.login'=>'user', 'u.firstname'=>'user', 'u.lastname'=>'user'); // We define here only fields that use another picto
@@ -488,6 +492,9 @@ class modSociete extends DolibarrModules
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
}
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
+ }
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@@ -621,7 +628,9 @@ class modSociete extends DolibarrModules
's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule",
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)',
- 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"'
+ 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"',
+ 's.accountancy_code_sell' => '707',
+ 's.accountancy_code_buy' => '607',
);
$this->import_updatekeys_array[$r] = array(
's.nom' => 'Name',
diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php
index 88c643c641d..acc5fad8125 100644
--- a/htdocs/core/tpl/ajaxrow.tpl.php
+++ b/htdocs/core/tpl/ajaxrow.tpl.php
@@ -66,7 +66,7 @@ $(document).ready(function(){
var fk_element = "";
var element_id = "";
var filepath = "";
- var token = ""; // We use old 'token' and not 'newtoken' for Ajax call because the ajax page has the NOTOKENRENEWAL constant set.
+ var token = ""; // We use old 'token' and not 'newtoken' for Ajax call because the ajax page has the NOTOKENRENEWAL constant set.
$.post("/core/ajax/row.php",
{
roworder: roworder,
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index f50276821b1..cd58ae554f2 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -208,7 +208,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
$fieldid = 'socid';
}
- print ' '.img_edit().' ';
+ print ''.img_edit().' ';
}
print '
';
print ' ';
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..6a7d48add5e 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);
}
@@ -368,7 +384,7 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin
$coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
} else { ?>
- id.'&action=editline&lineid='.$line->id.'#line_'.$line->id; ?>">
+ id.'&action=editline&token='.newToken().'&lineid='.$line->id.'#line_'.$line->id; ?>">
';
}
print ' ';
@@ -376,7 +392,7 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin
print '';
$coldisplay++;
if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company.
- print 'id.'&action=ask_deleteline&lineid='.$line->id.'">';
+ print ' id.'&action=ask_deleteline&token='.newToken().'&lineid='.$line->id.'">';
print img_delete();
print ' ';
}
@@ -386,12 +402,12 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin
print ' ';
$coldisplay++;
if ($i > 0) { ?>
- id.'&action=up&rowid='.$line->id; ?>">
+ id.'&action=up&token='.newToken().'&rowid='.$line->id; ?>">
- id.'&action=down&rowid='.$line->id; ?>">
+ id.'&action=down&token='.newToken().'&rowid='.$line->id; ?>">
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/cron/card.php b/htdocs/cron/card.php
index 727bf56f836..270fe3f57c4 100644
--- a/htdocs/cron/card.php
+++ b/htdocs/cron/card.php
@@ -745,7 +745,7 @@ if (($action == "create") || ($action == "edit")) {
if (!$user->rights->cron->create) {
print ''.$langs->trans("Edit").' ';
} else {
- print ''.$langs->trans("Edit").' ';
+ print ''.$langs->trans("Edit").' ';
}
if ((empty($user->rights->cron->execute))) {
@@ -753,7 +753,7 @@ if (($action == "create") || ($action == "edit")) {
} elseif (empty($object->status)) {
print ''.$langs->trans("CronExecute").' ';
} else {
- print ''.$langs->trans("CronExecute").' ';
+ print ''.$langs->trans("CronExecute").' ';
}
if (!$user->rights->cron->create) {
diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php
index dde8644571e..8f25461eb64 100644
--- a/htdocs/datapolicy/admin/setup.php
+++ b/htdocs/datapolicy/admin/setup.php
@@ -175,7 +175,7 @@ if ($action == 'edit') {
print '';
print '';
}
diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php
index 267c79ab08e..2d9f70a1eb5 100644
--- a/htdocs/debugbar/class/TraceableDB.php
+++ b/htdocs/debugbar/class/TraceableDB.php
@@ -250,6 +250,17 @@ class TraceableDB extends DoliDB
return $this->db->escape($stringtoencode);
}
+ /**
+ * Escape a string to insert data
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeunderscore($stringtoencode)
+ {
+ return $this->db->escapeunderscore($stringtoencode);
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php
index c72718ffce2..cca399f43af 100644
--- a/htdocs/delivery/card.php
+++ b/htdocs/delivery/card.php
@@ -427,7 +427,7 @@ if ($action == 'create') { // Create. Seems to no be used
print ' ';
if ($action != 'editdate_delivery') {
- print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print '';
print '';
@@ -451,7 +451,7 @@ if ($action == 'create') { // Create. Seems to no be used
print $langs->trans('IncotermLabel');
print ' ';
if ($user->rights->expedition->delivery->creer) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index 528a640b391..8ff0fa62e6c 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -855,7 +855,7 @@ if (!empty($id) && $action != 'edit') {
print ''.$langs->trans("ReOpen").' ';
}
- print '';
+ print '';
if ($object->statut == $object::STATUS_DRAFT) {
print '';
@@ -870,7 +870,7 @@ if (!empty($id) && $action != 'edit') {
if ($remaintopay == 0) {
print ''.$langs->trans('DoPayment').'
';
} else {
- print '';
+ print '';
}
}
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..0b42fc17a02 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 '';
@@ -438,11 +454,11 @@ if ($action != 'edit' && $action != 'delete') {
print '';
if ($permtoadd) {
- print '
'.$langs->trans('Edit').' ';
+ print '
'.$langs->trans('Edit').' ';
}
if ($permtoadd) {
- print '
'.$langs->trans('ECMAddSection').' ';
+ print '
'.$langs->trans('ECMAddSection').' ';
} else {
print '
'.$langs->trans('ECMAddSection').' ';
}
diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
index 17c185426c0..197d995a808 100644
--- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
+++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
@@ -16,6 +16,7 @@
* along with this program. If not, see
.
*
* Output javascript for interactions code of ecm module
+ * $conf, $module, $param, $preopened, $nameforformuserfile may be defined
*/
// Protection to avoid direct call of template
@@ -47,8 +48,8 @@ $(document).ready(function() {
$('#filetree').fileTree({
root: '',
// Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code to this following URL.
- // We must use token=$_SESSION['token'] and not token=$_SESSION['newtoken'] here because ajaxdirtree has NOTOKENRENEWAL define so there is no rollup of token so we must compare with the one valid on main page
- script: '',
+ // We must use token=currentToken() and not newToken() here because ajaxdirtree has NOTOKENRENEWAL define so there is no rollup of token so we must compare with the one valid on main page
+ script: '',
folderEvent: 'click', // 'dblclick'
multiFolder: false },
// Called if we click on a file (not a dir)
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 737d2134ccc..1e92e1aba4b 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -966,7 +966,7 @@ class EmailCollector extends CommonObject
dol_syslog("EmailCollector::doCollectOneCollector start for id=".$this->id, LOG_DEBUG);
- $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda"));
+ $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda", "commercial"));
$error = 0;
$this->output = '';
diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
index 1e76e3544e5..0826a53b772 100644
--- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php
+++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
@@ -248,9 +248,9 @@ class ConferenceOrBoothAttendee extends CommonObject
}
$result = $this->createCommon($user, $notrigger);
- if ($result>0) {
- $result =$this->fetch($result);
- if ($result>0) {
+ if ($result > 0) {
+ $result = $this->fetch($result);
+ if ($result > 0) {
$this->ref = $this->id;
$result = $this->update($user);
}
@@ -293,7 +293,7 @@ class ConferenceOrBoothAttendee extends CommonObject
// Clear fields
if (property_exists($object, 'ref')) {
- $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
+ $object->ref = empty($this->fields['ref']['default']) ? "(PROV)" : $this->fields['ref']['default'];
}
if (property_exists($object, 'label')) {
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
@@ -327,6 +327,9 @@ class ConferenceOrBoothAttendee extends CommonObject
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
+ } else {
+ $object->ref = $object->id;
+ $result = $object->update($user);
}
if (!$error) {
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index 7defb3dbf3c..780b3bebc55 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -41,7 +41,7 @@ global $dolibarr_main_url_root;
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
-$langs->loadLangs(array("eventorganization", "other", "projects"));
+$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php
index 1b4b5f62828..03e309aa41d 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_card.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_card.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("eventorganization", "other"));
+$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
// Get parameters
$id = GETPOST('id', 'int');
@@ -110,6 +110,7 @@ $permissionnote = $user->rights->eventorganization->write; // Used by the includ
$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
+
/*
* Actions
*/
@@ -134,7 +135,7 @@ if (empty($reshook)) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
- $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.($id > 0 ? $id : '__ID__');
+ $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__');
}
}
}
@@ -205,13 +206,12 @@ if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
}
-$withProjectUrl='';
+
$object->project = clone $projectstatic;
if (!empty($withproject)) {
// Tabs for project
$tab = 'eventorganisation';
- $withProjectUrl = "&withproject=1";
$head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
@@ -421,8 +421,10 @@ if (!empty($withproject)) {
if ($action == 'create') {
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto);
- print '
';
+
+ print ' ';
print ' ';
+ print ' ';
if ($confOrBooth->id > 0) {
print ' ';
@@ -432,8 +434,6 @@ if ($action == 'create') {
print ' ';
}
-
- print ' ';
if ($backtopage) {
print ' ';
}
@@ -651,9 +651,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&mode=init#formmailbeforetitle');
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken().'', '', $permissiontoadd);
// Clone
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 84d0cfd452d..c87d2fcc5ce 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -137,8 +137,15 @@ if ($reshook < 0) {
if (empty($reshook)) {
if ($cancel) {
- $action = '';
- $object->fetch($id); // show shipment also after canceling modification
+ if ($origin && $origin_id > 0) {
+ if ($origin == 'commande') {
+ header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.((int) $origin_id));
+ exit;
+ }
+ } else {
+ $action = '';
+ $object->fetch($id); // show shipment also after canceling modification
+ }
}
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@@ -1049,7 +1056,7 @@ if ($action == 'create') {
print ''.$langs->trans("QtyShipped").' ';
print ''.$langs->trans("QtyToShip");
if (empty($conf->productbatch->enabled)) {
- print ''.img_picto($langs->trans("Autofill"), 'autofill', 'class="paddingrightonly"').$langs->trans("Fill").' ';
+ print ''.img_picto($langs->trans("Autofill"), 'autofill', 'class="paddingrightonly"').' ';
print ' / ';
} else {
print ' ';
@@ -1760,7 +1767,7 @@ if ($action == 'create') {
print ' ';
if ($action != 'editdate_livraison') {
- print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print ' ';
print '';
@@ -1892,7 +1899,7 @@ if ($action == 'create') {
print ' ';
if ($action != 'editshipping_method_id') {
- print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).' ';
}
print '';
print '';
@@ -1929,7 +1936,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($user->rights->expedition->creer) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
@@ -2482,7 +2489,7 @@ if ($action == 'create') {
$label = "ClassifyBilled";
$paramaction = 'classifybilled';
}
- print 'id.'&action='.$paramaction.'">'.$langs->trans($label).' ';
+ print 'id.'&action='.$paramaction.'&token='.newToken().'">'.$langs->trans($label).' ';
}
}
@@ -2549,7 +2556,7 @@ if ($action == 'create') {
// Presend form
$modelmail = 'shipping_send';
$defaulttopic = 'SendShippingRef';
- $diroutput = $conf->expedition->dir_output.'/sending';
+ $diroutput = $conf->expedition->dir_output;
$trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index a9372564280..623d3635ba5 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -43,9 +43,7 @@ if (!empty($conf->propal->enabled)) {
if (!empty($conf->commande->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
-if (!empty($conf->productbatch->enabled)) {
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
-}
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionlinebatch.class.php';
/**
@@ -1188,7 +1186,6 @@ class Expedition extends CommonObject
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
$error = 0;
$this->error = '';
@@ -1230,6 +1227,9 @@ class Expedition extends CommonObject
$resql = $this->db->query($sql);
if ($resql) {
$cpt = $this->db->num_rows($resql);
+
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
+
for ($i = 0; $i < $cpt; $i++) {
dol_syslog(get_class($this)."::delete movement index ".$i);
$obj = $this->db->fetch_object($resql);
@@ -1240,11 +1240,12 @@ class Expedition extends CommonObject
// get lot/serial
$lotArray = null;
if ($conf->productbatch->enabled) {
- $lotArray = ExpeditionLineBatch::fetchAll($this->db, $obj->expeditiondet_id);
+ $lotArray = $shipmentlinebatch->fetchAll($obj->expeditiondet_id);
if (!is_array($lotArray)) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
+
if (empty($lotArray)) {
// no lot/serial
// We increment stock of product (and sub-products)
@@ -1276,7 +1277,8 @@ class Expedition extends CommonObject
// delete batch expedition line
if (!$error && $conf->productbatch->enabled) {
- if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) {
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
+ if ($shipmentlinebatch->deleteFromShipment($this->id) < 0) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -1372,7 +1374,6 @@ class Expedition extends CommonObject
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
$error = 0;
$this->error = '';
@@ -1460,15 +1461,16 @@ class Expedition extends CommonObject
// delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously)
if (!$error) {
- if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) {
+ $shipmentlinebatch = ExpeditionLineBatch($this->db);
+ if ($shipmentlinebatch->deleteFromShipment($this->id) < 0) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
if (!$error) {
- $main = MAIN_DB_PREFIX.'expeditiondet';
- $ef = $main."_extrafields";
- $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".((int) $this->id).")";
+ $main = MAIN_DB_PREFIX.'expeditiondet';
+ $ef = $main."_extrafields";
+ $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".((int) $this->id).")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
$sql .= " WHERE fk_expedition = ".((int) $this->id);
@@ -1480,8 +1482,8 @@ class Expedition extends CommonObject
$error++;
}
- // delete extrafields
- $res = $this->deleteExtraFields();
+ // delete extrafields
+ $res = $this->deleteExtraFields();
if ($res < 0) {
$error++;
}
@@ -1597,6 +1599,7 @@ class Expedition extends CommonObject
$this->total_localtax2 = 0;
$line = new ExpeditionLigne($this->db);
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
@@ -1695,9 +1698,8 @@ class Expedition extends CommonObject
// Detail of batch
if (!empty($conf->productbatch->enabled) && $obj->line_id > 0 && $obj->product_tobatch > 0) {
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
+ $newdetailbatch = $shipmentlinebatch->fetchAll($obj->line_id, $obj->fk_product);
- $newdetailbatch = ExpeditionLineBatch::fetchAll($this->db, $obj->line_id, $obj->fk_product);
if (is_array($newdetailbatch)) {
if ($originline != $obj->fk_origin_line) {
$line->detail_batch = $newdetailbatch;
@@ -2925,8 +2927,9 @@ class ExpeditionLigne extends CommonObjectLine
}
// fetch remaining lot qty
- require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
- if (!$error && ($lotArray = ExpeditionLineBatch::fetchAll($this->db, $this->id)) < 0) {
+ $shipmentlinebatch = new ExpeditionLineBatch($this->db);
+
+ if (!$error && ($lotArray = $shipmentlinebatch->fetchAll($this->id)) < 0) {
$this->errors[] = $this->db->lasterror()." - ExpeditionLineBatch::fetchAll";
$error++;
} else {
diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php
similarity index 85%
rename from htdocs/expedition/class/expeditionbatch.class.php
rename to htdocs/expedition/class/expeditionlinebatch.class.php
index 03066869450..b2562734447 100644
--- a/htdocs/expedition/class/expeditionbatch.class.php
+++ b/htdocs/expedition/class/expeditionlinebatch.class.php
@@ -17,7 +17,7 @@
*/
/**
- * \file expedition/class/expeditionbatch.class.php
+ * \file htdocs/expedition/class/expeditionlinebatch.class.php
* \ingroup productbatch
* \brief This file implements CRUD method for managing shipment batch lines
* with batch record
@@ -33,7 +33,10 @@ class ExpeditionLineBatch extends CommonObject
*/
public $element = 'expeditionlignebatch';
- private static $_table_element = 'expeditiondet_batch'; //!< Name of table without prefix where object is stored
+ /**
+ * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management.
+ */
+ public $table_element = 'expeditiondet_batch';
public $sellby;
public $eatby;
@@ -44,6 +47,7 @@ class ExpeditionLineBatch extends CommonObject
public $fk_origin_stock;
public $fk_expeditiondet;
+
/**
* Constructor
*
@@ -74,6 +78,7 @@ class ExpeditionLineBatch extends CommonObject
$sql .= " WHERE pb.rowid = ".(int) $id_stockdluo;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
+
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
@@ -106,7 +111,7 @@ class ExpeditionLineBatch extends CommonObject
$id_line_expdet = (int) $id_line_expdet;
- $sql = "INSERT INTO ".MAIN_DB_PREFIX.self::$_table_element." (";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (";
$sql .= "fk_expeditiondet";
$sql .= ", sellby";
$sql .= ", eatby";
@@ -129,7 +134,8 @@ class ExpeditionLineBatch extends CommonObject
}
if (!$error) {
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.self::$_table_element);
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
+
$this->fk_expeditiondet = $id_line_expdet;
return $this->id;
} else {
@@ -145,17 +151,16 @@ class ExpeditionLineBatch extends CommonObject
/**
* Delete batch record attach to a shipment
*
- * @param DoliDB $db Database object
* @param int $id_expedition rowid of shipment
* @return int -1 if KO, 1 if OK
*/
- public static function deletefromexp($db, $id_expedition)
+ public function deleteFromShipment($id_expedition)
{
- $sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element;
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".((int) $id_expedition).")";
dol_syslog(__METHOD__, LOG_DEBUG);
- if ($db->query($sql)) {
+ if ($this->db->query($sql)) {
return 1;
} else {
return -1;
@@ -165,12 +170,11 @@ class ExpeditionLineBatch extends CommonObject
/**
* Retrieve all batch number detailed information of a shipment line
*
- * @param DoliDB $db Database object
* @param int $id_line_expdet id of shipment line
* @param int $fk_product If provided, load also detailed information of lot
* @return int|array -1 if KO, array of ExpeditionLineBatch if OK
*/
- public static function fetchAll($db, $id_line_expdet, $fk_product = 0)
+ public function fetchAll($id_line_expdet, $fk_product = 0)
{
$sql = "SELECT";
$sql .= " eb.rowid,";
@@ -184,25 +188,24 @@ class ExpeditionLineBatch extends CommonObject
$sql .= ", pl.sellby";
$sql .= ", pl.eatby";
}
- $sql .= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as eb";
+ $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as eb";
if ($fk_product > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.batch = eb.batch AND pl.fk_product = ".((int) $fk_product);
}
$sql .= " WHERE fk_expeditiondet=".(int) $id_line_expdet;
dol_syslog(__METHOD__."", LOG_DEBUG);
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
$i = 0;
$ret = array();
while ($i < $num) {
- $tmp = new self($db);
+ $obj = $this->db->fetch_object($resql);
- $obj = $db->fetch_object($resql);
-
- $tmp->sellby = $db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby);
- $tmp->eatby = $db->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby);
+ $tmp = new self($this->db);
+ $tmp->sellby = $this->db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby);
+ $tmp->eatby = $this->db->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby);
$tmp->batch = $obj->batch;
$tmp->id = $obj->rowid;
$tmp->fk_origin_stock = $obj->fk_origin_stock;
@@ -213,10 +216,12 @@ class ExpeditionLineBatch extends CommonObject
$ret[] = $tmp;
$i++;
}
- $db->free($resql);
+
+ $this->db->free($resql);
+
return $ret;
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
return -1;
}
}
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index f543b8baee4..a6ab016ef7b 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -370,7 +370,7 @@ if ($id > 0 || !empty($ref)) {
print ' ';
if ($action != 'editdate_livraison') {
- print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print '';
print '';
@@ -400,7 +400,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('SendingMethod');
print ' ';
if ($action != 'editshippingmethod' && $user->rights->expedition->creer) {
- print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).' ';
}
print '';
print '';
@@ -421,7 +421,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('Warehouse');
print ' ';
if ($action != 'editwarehouse' && $user->rights->commande->creer) {
- print 'id.'">'.img_edit($langs->trans('SetWarehouse'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetWarehouse'), 1).' ';
}
print '';
print '';
@@ -441,7 +441,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('PaymentConditionsShort');
print ' ';
- if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).' ';
+ if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).' ';
print '';
print '';
if ($action == 'editconditions')
@@ -459,7 +459,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print ' ';
if ($action == 'editmode')
@@ -478,7 +478,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('AvailabilityPeriod');
print ' ';
if ($action != 'editavailability') {
- print 'id.'">'.img_edit($langs->trans('SetAvailability'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetAvailability'), 1).' ';
}
print '';
print '';
@@ -495,7 +495,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('Source');
print ' ';
if ($action != 'editdemandreason') {
- print 'id.'">'.img_edit($langs->trans('SetDemandReason'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDemandReason'), 1).' ';
}
print '';
print '';
@@ -528,7 +528,7 @@ if ($id > 0 || !empty($ref)) {
print $langs->trans('IncotermLabel');
print ' ';
if ($user->rights->commande->creer) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/expensereport/ajax/ajaxik.php b/htdocs/expensereport/ajax/ajaxik.php
index c2cc8345671..6cd8c05fe5b 100644
--- a/htdocs/expensereport/ajax/ajaxik.php
+++ b/htdocs/expensereport/ajax/ajaxik.php
@@ -76,7 +76,8 @@ if (empty($fk_expense) || $fk_expense < 0) {
if ($userauthor->fetch($expense->fk_user_author) <= 0) {
echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_user_author' => $expense->fk_user_author));
} else {
- $range = ExpenseReportIk::getRangeByUser($userauthor, $fk_c_exp_tax_cat);
+ $expenseik = new ExpenseReportIk($db);
+ $range = $expenseik->getRangeByUser($userauthor, $fk_c_exp_tax_cat);
if (empty($range)) {
echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'range' => $range));
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 9941139ea19..f982b046793 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -235,7 +235,7 @@ if (empty($reshook)) {
$object->fk_user_author = $user->id;
}
- // Check that expense report is for a user inside the hierarchy or advanced permission for all is set
+ // Check that expense report is for a user inside the hierarchy, or that advanced permission for all is set
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) {
$error++;
@@ -1110,7 +1110,7 @@ if (empty($reshook)) {
$action = '';
}
- if ((int) $tmpvat < 0 || $tmpvat == '') {
+ if ((float) $tmpvat < 0 || $tmpvat === '') {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors');
$action = '';
@@ -1205,7 +1205,6 @@ if (empty($reshook)) {
}
}
- $object->update_totaux_del($object_ligne->total_ht, $object_ligne->total_tva);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int'));
exit;
} else {
@@ -1255,7 +1254,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$action = '';
}
- if ((int) $tmpvat < 0 || $tmpvat == '') {
+ if ((float) $tmpvat < 0 || $tmpvat == '') {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');
$action = '';
@@ -1292,8 +1291,6 @@ if (empty($reshook)) {
}
}
- $result = $object->recalculer($id);
-
//header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
//exit;
} else {
@@ -1453,8 +1450,6 @@ if ($action == 'create') {
} elseif ($id > 0 || $ref) {
$result = $object->fetch($id, $ref);
- $res = $object->fetch_optionals();
-
if ($result > 0) {
if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) {
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
@@ -1852,12 +1847,22 @@ if ($action == 'create') {
print ' ';
print ''.$langs->trans("AmountVAT").' ';
- print ''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).' ';
+ print ''.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).' ';
print ' ';
+ // 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).' ';
+ }
+ 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 '';
print ''.$langs->trans("AmountTTC").' ';
- print ''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' ';
+ print ''.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).' ';
print ' ';
// List of payments already done
@@ -2062,7 +2067,7 @@ if ($action == 'create') {
// Comment
print ''.dol_nl2br($line->comments).' ';
// VAT rate
- print ''.vatrate($line->vatrate, true).' ';
+ print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).' ';
// Unit price HT
print '';
if (!empty($line->value_unit_ht)) {
@@ -2269,8 +2274,9 @@ if ($action == 'create') {
print ' ';
// VAT
+ $selectedvat = price2num($line->vatrate).($line->vat_src_code ? ' ('.$line->vat_src_code.')' : '');
print '';
- print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $line->vatrate), $mysoc, '', 0, 0, '', false, 1);
+ print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1);
print ' ';
// Unit price
@@ -2548,11 +2554,11 @@ if ($action != 'create' && $action != 'edit') {
if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_DRAFT) {
if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance)) {
// Modify
- print '';
+ print '';
// Validate
if (count($object->lines) > 0) {
- print '';
+ print '';
}
}
}
@@ -2565,12 +2571,12 @@ if ($action != 'create' && $action != 'edit') {
if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_REFUSED) {
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) {
// Modify
- print '';
+ print '';
// setdraft (le statut refusée est identique à brouillon)
//print ''.$langs->trans('ReOpen').' ';
// Enregistrer depuis le statut "Refusée"
- print '';
+ print '';
}
}
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 66d5eb6d7c0..63303554c51 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -80,8 +80,6 @@ class ExpenseReport extends CommonObject
*/
public $fk_statut;
- public $vat_src_code;
-
public $fk_c_paiement;
public $paid;
@@ -124,6 +122,9 @@ class ExpenseReport extends CommonObject
// Paiement
public $user_paid_infos;
+ public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject)
+ public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject)
+
/**
* Draft status
@@ -213,6 +214,10 @@ class ExpenseReport extends CommonObject
$this->total_ht = 0;
$this->total_ttc = 0;
$this->total_tva = 0;
+ $this->total_localtax1 = 0;
+ $this->total_localtax2 = 0;
+ $this->localtax1 = 0; // For backward compatibility
+ $this->localtax2 = 0; // For backward compatibility
$this->modepaymentid = 0;
// List of language codes for status
@@ -314,12 +319,18 @@ class ExpenseReport extends CommonObject
$newndfline->fk_project = $line->fk_project;
$newndfline->vatrate = $line->vatrate;
$newndfline->vat_src_code = $line->vat_src_code;
+ $newndfline->localtax1_tx = $line->localtax1_tx;
+ $newndfline->localtax2_tx = $line->localtax2_tx;
+ $newndfline->localtax1_type = $line->localtax1_type;
+ $newndfline->localtax2_type = $line->localtax2_type;
$newndfline->comments = $line->comments;
$newndfline->qty = $line->qty;
$newndfline->value_unit = $line->value_unit;
$newndfline->total_ht = $line->total_ht;
$newndfline->total_ttc = $line->total_ttc;
$newndfline->total_tva = $line->total_tva;
+ $newndfline->total_localtax1 = $line->total_localtax1;
+ $newndfline->total_localtax2 = $line->total_localtax2;
$newndfline->date = $line->date;
$newndfline->rule_warning_message = $line->rule_warning_message;
$newndfline->fk_c_exp_tax_cat = $line->fk_c_exp_tax_cat;
@@ -539,7 +550,8 @@ class ExpenseReport extends CommonObject
$sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT
$sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
$sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS
- $sql .= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int)
+ $sql .= " d.total_ht, d.total_ttc, d.total_tva,";
+ $sql .= " d.localtax1 as total_localtax1, d.localtax2 as total_localtax2,";
$sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime)
$sql .= " d.fk_user_creat, d.fk_user_author, d.fk_user_modif, d.fk_user_validator,";
$sql .= " d.fk_user_valid, d.fk_user_approve,";
@@ -565,6 +577,11 @@ class ExpenseReport extends CommonObject
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
$this->total_ttc = $obj->total_ttc;
+ $this->localtax1 = $obj->total_localtax1; // For backward compatibility
+ $this->localtax2 = $obj->total_localtax2; // For backward compatibility
+ $this->total_localtax1 = $obj->total_localtax1;
+ $this->total_localtax2 = $obj->total_localtax2;
+
$this->note_public = $obj->note_public;
$this->note_private = $obj->note_private;
$this->detail_refuse = $obj->detail_refuse;
@@ -962,54 +979,6 @@ class ExpenseReport extends CommonObject
}
}
- /**
- * recalculer
- * TODO Replace this with call to update_price if not already done
- *
- * @param int $id Id of expense report
- * @return int <0 if KO, >0 if OK
- */
- public function recalculer($id)
- {
- $sql = 'SELECT tt.total_ht, tt.total_ttc, tt.total_tva';
- $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as tt';
- $sql .= " WHERE tt.".$this->fk_element.' = '.((int) $id);
-
- $total_ht = 0; $total_tva = 0; $total_ttc = 0;
-
- $result = $this->db->query($sql);
- if ($result) {
- $num = $this->db->num_rows($result);
- $i = 0;
- while ($i < $num) {
- $objp = $this->db->fetch_object($result);
- $total_ht += $objp->total_ht;
- $total_tva += $objp->total_tva;
- $i++;
- }
-
- $total_ttc = $total_ht + $total_tva;
- $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
- $sql .= " total_ht = ".((float) price2num($total_ht, 'MT'));
- $sql .= " , total_ttc = ".((float) price2num($total_ttc, 'MT'));
- $sql .= " , total_tva = ".((float) price2num($total_tva, 'MT'));
- $sql .= " WHERE rowid = ".((int) $id);
- $result = $this->db->query($sql);
- if ($result) {
- $this->db->free($result);
- return 1;
- } else {
- $this->error = $this->db->lasterror();
- dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
- return -3;
- }
- } else {
- $this->error = $this->db->lasterror();
- dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
- return -3;
- }
- }
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* fetch_lines
@@ -1024,8 +993,12 @@ class ExpenseReport extends CommonObject
$this->lines = array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
- $sql .= " de.".$this->fk_element.", de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,";
+ $sql .= " de.".$this->fk_element.", de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project,";
+ $sql .= ' de.tva_tx, de.vat_src_code,';
+ $sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,';
+ $sql .= ' de.fk_ecm_files,';
$sql .= ' de.total_ht, de.total_tva, de.total_ttc,';
+ $sql .= ' de.total_localtax1, de.total_localtax2,';
$sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
$sql .= ' p.ref as ref_projet, p.title as title_projet';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
@@ -1065,11 +1038,20 @@ class ExpenseReport extends CommonObject
$deplig->total_ht = $objp->total_ht;
$deplig->total_tva = $objp->total_tva;
$deplig->total_ttc = $objp->total_ttc;
+ $deplig->total_localtax1 = $objp->total_localtax1;
+ $deplig->total_localtax2 = $objp->total_localtax2;
$deplig->type_fees_code = empty($objp->code_type_fees) ? 'TF_OTHER' : $objp->code_type_fees;
$deplig->type_fees_libelle = $objp->libelle_type_fees;
- $deplig->tva_tx = $objp->tva_tx;
+
+ $deplig->tva_tx = $objp->tva_tx;
$deplig->vatrate = $objp->tva_tx;
+ $deplig->vat_src_code = $objp->vat_src_code;
+ $deplig->localtax1_tx = $objp->localtax1_tx;
+ $deplig->localtax2_tx = $objp->localtax2_tx;
+ $deplig->localtax1_type = $objp->localtax1_type;
+ $deplig->localtax2_type = $objp->localtax2_type;
+
$deplig->projet_ref = $objp->ref_projet;
$deplig->projet_title = $objp->title_projet;
@@ -1757,41 +1739,11 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Update total of an expense report when you delete a line.
- *
- * @param string $ligne_total_ht Amount without taxes
- * @param string $ligne_total_tva Amount of all taxes
- * @return void
- */
- public function update_totaux_del($ligne_total_ht, $ligne_total_tva)
- {
- // phpcs:enable
- $this->total_ht = $this->total_ht - $ligne_total_ht;
- $this->total_tva = $this->total_tva - $ligne_total_tva;
- $this->total_ttc = $this->total_ht + $this->total_tva;
-
- $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
- $sql .= " total_ht = ".$this->total_ht;
- $sql .= " , total_ttc = ".$this->total_ttc;
- $sql .= " , total_tva = ".$this->total_tva;
- $sql .= " WHERE rowid = ".((int) $this->id);
-
- $result = $this->db->query($sql);
- if ($result) {
- return 1;
- } else {
- $this->error = $this->db->error();
- return -1;
- }
- }
-
- /**
- * addline
+ * Add expense report line
*
* @param float $qty Qty
- * @param double $up Value init
+ * @param double $up Unit price (price with tax)
* @param int $fk_c_type_fees Type payment
* @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
* @param string $date Date
@@ -1838,7 +1790,14 @@ class ExpenseReport extends CommonObject
$this->line = new ExpenseReportLine($this->db);
- $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty);
+ // We don't know seller and buyer for expense reports
+ $seller = $mysoc; // We use same than current company (expense report are often done in same country)
+ $seller->tva_assuj = 1; // Most seller uses vat
+ $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
+ $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
+ $buyer = new Societe($this->db);
+
+ $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller);
$vat_src_code = '';
$reg = array();
@@ -1848,16 +1807,22 @@ class ExpenseReport extends CommonObject
}
$vatrate = preg_replace('/\*/', '', $vatrate);
- $seller = ''; // seller is unknown
-
- $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
+ $tmp = calcul_price_total($qty, $up, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
$this->line->value_unit = $up;
+
$this->line->vat_src_code = $vat_src_code;
$this->line->vatrate = price2num($vatrate);
+ $this->line->localtax1_tx = $localtaxes_type[1];
+ $this->line->localtax2_tx = $localtaxes_type[3];
+ $this->line->localtax1_type = $localtaxes_type[0];
+ $this->line->localtax2_type = $localtaxes_type[2];
+
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
+ $this->line->total_localtax1 = $tmp[9];
+ $this->line->total_localtax2 = $tmp[10];
$this->line->fk_expensereport = $this->id;
$this->line->qty = $qty;
@@ -1899,13 +1864,13 @@ class ExpenseReport extends CommonObject
/**
* Check constraint of rules and update price if needed
*
- * @param int $type type of line
- * @param string $seller seller, but actually he is unknown
- * @return true or false
+ * @param int $type Type of line
+ * @param string $seller Seller, but actually he is unknown
+ * @return true or false
*/
public function checkRules($type = 0, $seller = '')
{
- global $user, $conf, $db, $langs;
+ global $user, $conf, $db, $langs, $mysoc;
$langs->load('trips');
@@ -1913,7 +1878,17 @@ class ExpenseReport extends CommonObject
return true; // if don't use rules
}
- $rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author);
+ // We don't know seller and buyer for expense reports
+ if (!is_object($seller)) {
+ $seller = $mysoc; // We use same than current company (expense report are often done in same country)
+ $seller->tva_assuj = 1; // Most seller uses vat
+ $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
+ $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
+ }
+ //$buyer = new Societe($this->db);
+
+ $expensereportrule = new ExpenseReportRule($db);
+ $rulestocheck = $expensereportrule->getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author);
$violation = 0;
$rule_warning_message_tab = array();
@@ -1960,6 +1935,8 @@ class ExpenseReport extends CommonObject
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
+ $this->line->total_localtax1 = $tmp[9];
+ $this->line->total_localtax2 = $tmp[10];
return false;
} else {
@@ -1970,11 +1947,13 @@ class ExpenseReport extends CommonObject
/**
* Method to apply the offset if needed
*
- * @return boolean true=applied, false=not applied
+ * @param int $type Type of line
+ * @param string $seller Seller, but actually he is unknown
+ * @return boolean True=applied, False=not applied
*/
- public function applyOffset()
+ public function applyOffset($type = 0, $seller = '')
{
- global $conf;
+ global $conf, $mysoc;
if (empty($conf->global->MAIN_USE_EXPENSE_IK)) {
return false;
@@ -1987,7 +1966,17 @@ class ExpenseReport extends CommonObject
return false;
}
- $range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
+ // We don't know seller and buyer for expense reports
+ if (!is_object($seller)) {
+ $seller = $mysoc; // We use same than current company (expense report are often done in same country)
+ $seller->tva_assuj = 1; // Most seller uses vat
+ $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
+ $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
+ }
+ //$buyer = new Societe($this->db);
+
+ $expenseik = new ExpenseReportIk($db);
+ $range = $expenseik->getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
if (empty($range)) {
$this->error = 'ErrorNoRangeAvailable';
@@ -2010,6 +1999,8 @@ class ExpenseReport extends CommonObject
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
+ $this->line->total_localtax1 = $tmp[9];
+ $this->line->total_localtax2 = $tmp[10];
return true;
}
@@ -2033,7 +2024,7 @@ class ExpenseReport extends CommonObject
$sql .= ' AND d.rowid <> '.((int) $this->line->id);
}
- dol_syslog(get_class($this)."::offsetAlreadyGiven sql=".$sql);
+ dol_syslog(get_class($this)."::offsetAlreadyGiven");
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@@ -2056,7 +2047,7 @@ class ExpenseReport extends CommonObject
* @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)'
* @param string $comments Description
* @param float $qty Qty
- * @param double $value_unit Value init
+ * @param double $value_unit Unit price (with taxes)
* @param int $date Date
* @param int $expensereport_id Expense report id
* @param int $fk_c_exp_tax_cat Id of category of car
@@ -2073,7 +2064,10 @@ class ExpenseReport extends CommonObject
$type = 0; // TODO What if type is service ?
// We don't know seller and buyer for expense reports
- $seller = $mysoc;
+ $seller = $mysoc; // We use same than current company (expense report are often done in same country)
+ $seller->tva_assuj = 1; // Most seller uses vat
+ $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
+ $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
$buyer = new Societe($this->db);
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller);
@@ -2087,8 +2081,8 @@ class ExpenseReport extends CommonObject
}
$vatrate = preg_replace('/\*/', '', $vatrate);
- $tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
-
+ $tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
+ //var_dump($vatrate);var_dump($localtaxes_type);var_dump($tmp);exit;
// calcul total of line
//$total_ttc = price2num($qty*$value_unit, 'MT');
@@ -2109,14 +2103,17 @@ class ExpenseReport extends CommonObject
$this->line->vat_src_code = $vat_src_code;
$this->line->vatrate = price2num($vatrate);
- $this->line->total_ttc = $tmp[2];
- $this->line->total_ht = $tmp[0];
- $this->line->total_tva = $tmp[1];
$this->line->localtax1_tx = $localtaxes_type[1];
$this->line->localtax2_tx = $localtaxes_type[3];
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
+ $this->line->total_ttc = $tmp[2];
+ $this->line->total_ht = $tmp[0];
+ $this->line->total_tva = $tmp[1];
+ $this->line->total_localtax1 = $tmp[9];
+ $this->line->total_localtax2 = $tmp[10];
+
$this->line->fk_ecm_files = $fk_ecm_files;
$this->line->id = ((int) $rowid);
@@ -2184,6 +2181,8 @@ class ExpenseReport extends CommonObject
return -1;
}
+ $this->update_price();
+
$this->db->commit();
return 1;
@@ -2593,9 +2592,17 @@ class ExpenseReportLine
public $projet_title;
public $vatrate;
+ public $vat_src_code;
+ public $localtax1_tx;
+ public $localtax2_tx;
+ public $localtax1_type;
+ public $localtax2_type;
+
public $total_ht;
public $total_tva;
public $total_ttc;
+ public $total_localtax1;
+ public $total_localtax2;
/**
* @var int ID into llx_ecm_files table to link line to attached file
@@ -2623,6 +2630,7 @@ class ExpenseReportLine
{
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
$sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,';
+ $sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2,';
$sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
@@ -2652,11 +2660,20 @@ class ExpenseReportLine
$this->type_fees_libelle = $objp->type_fees_libelle;
$this->projet_ref = $objp->projet_ref;
$this->projet_title = $objp->projet_title;
+
$this->vatrate = $objp->vatrate;
$this->vat_src_code = $objp->vat_src_code;
+ $this->localtax1_tx = $objp->localtax1_tx;
+ $this->localtax2_tx = $objp->localtax2_tx;
+ $this->localtax1_type = $objp->localtax1_type;
+ $this->localtax2_type = $objp->localtax2_type;
+
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
+ $this->total_localtax1 = $objp->total_localtax1;
+ $this->total_localtax2 = $objp->total_localtax2;
+
$this->fk_ecm_files = $objp->fk_ecm_files;
$this->db->free($result);
@@ -2695,18 +2712,29 @@ class ExpenseReportLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
$sql .= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
- $sql .= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
+ $sql .= ' tva_tx, vat_src_code,';
+ $sql .= ' localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
+ $sql .= ' comments, qty, value_unit,';
+ $sql .= ' total_ht, total_tva, total_ttc,';
+ $sql .= ' total_localtax1, total_localtax2,';
+ $sql .= ' date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
$sql .= " VALUES (".$this->db->escape($this->fk_expensereport).",";
$sql .= " ".((int) $this->fk_c_type_fees).",";
$sql .= " ".((int) (!empty($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : ((!empty($this->fk_projet) && $this->fk_projet > 0) ? $this->fk_projet : 'null')).",";
$sql .= " ".((float) $this->vatrate).",";
$sql .= " '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."',";
+ $sql .= " ".((float) price2num($this->localtax1_tx)).",";
+ $sql .= " ".((float) price2num($this->localtax2_tx)).",";
+ $sql .= " '".$this->db->escape($this->localtax1_type)."',";
+ $sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= " '".$this->db->escape($this->comments)."',";
$sql .= " ".((float) $this->qty).",";
$sql .= " ".((float) $this->value_unit).",";
$sql .= " ".((float) price2num($this->total_ht)).",";
$sql .= " ".((float) price2num($this->total_tva)).",";
$sql .= " ".((float) price2num($this->total_ttc)).",";
+ $sql .= " ".((float) price2num($this->total_localtax1)).",";
+ $sql .= " ".((float) price2num($this->total_localtax2)).",";
$sql .= " '".$this->db->idate($this->date)."',";
$sql .= " ".(empty($this->rule_warning_message) ? 'null' : "'".$this->db->escape($this->rule_warning_message)."'").",";
$sql .= " ".((int) $this->fk_c_exp_tax_cat).",";
@@ -2814,11 +2842,17 @@ class ExpenseReportLine
$sql .= ", value_unit = ".((float) $this->value_unit);
$sql .= ", qty=".((float) $this->qty);
$sql .= ", date='".$this->db->idate($this->date)."'";
- $sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT'))."";
- $sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT'))."";
- $sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT'))."";
+ $sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT'));
+ $sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT'));
+ $sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT'));
+ $sql .= ", total_localtax1=".((float) price2num($this->total_localtax1, 'MT'));
+ $sql .= ", total_localtax2=".((float) price2num($this->total_localtax2, 'MT'));
$sql .= ", tva_tx=".((float) $this->vatrate);
$sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'";
+ $sql .= ", localtax1_tx=".((float) $this->localtax1_tx);
+ $sql .= ", localtax2_tx=".((float) $this->localtax2_tx);
+ $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
+ $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
$sql .= ", rule_warning_message='".$this->db->escape($this->rule_warning_message)."'";
$sql .= ", fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat);
$sql .= ", fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null');
diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php
index 358a2fe06ca..da2312bdcb1 100644
--- a/htdocs/expensereport/class/expensereport_ik.class.php
+++ b/htdocs/expensereport/class/expensereport_ik.class.php
@@ -87,8 +87,6 @@ class ExpenseReportIk extends CoreObject
*/
public function __construct(DoliDB &$db)
{
- global $conf;
-
parent::__construct($db);
parent::init();
@@ -102,29 +100,28 @@ class ExpenseReportIk extends CoreObject
* @param int $mode 1=only active; 2=only inactive; other value return all
* @return array of category
*/
- public static function getTaxCategories($mode = 1)
+ public function getTaxCategories($mode = 1)
{
- global $db;
-
$categories = array();
$sql = 'SELECT rowid, label, entity, active';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat';
- $sql .= ' WHERE entity IN ('.getEntity('c_exp_tax_cat').')';
+ $sql .= ' WHERE entity IN (0, '.getEntity($this->element).')';
if ($mode == 1) {
$sql .= ' AND active = 1';
} elseif ($mode == 2) {
$sql .= 'AND active = 0';
}
- dol_syslog(get_called_class().'::getTaxCategories sql='.$sql, LOG_DEBUG);
- $resql = $db->query($sql);
+ dol_syslog(get_called_class().'::getTaxCategories', LOG_DEBUG);
+
+ $resql = $this->db->query($sql);
if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
+ while ($obj = $this->db->fetch_object($resql)) {
$categories[$obj->rowid] = $obj;
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $categories;
@@ -137,10 +134,10 @@ class ExpenseReportIk extends CoreObject
* @param int $fk_c_exp_tax_cat category
* @return boolean|array
*/
- public static function getRangeByUser(User $userauthor, int $fk_c_exp_tax_cat)
+ public function getRangeByUser(User $userauthor, int $fk_c_exp_tax_cat)
{
$default_range = (int) $userauthor->default_range; // if not defined, then 0
- $ranges = self::getRangesByCategory($fk_c_exp_tax_cat);
+ $ranges = $this->getRangesByCategory($fk_c_exp_tax_cat);
// substract 1 because array start from 0
if (empty($ranges) || !isset($ranges[$default_range - 1])) {
@@ -157,10 +154,8 @@ class ExpenseReportIk extends CoreObject
* @param int $active active
* @return array
*/
- public static function getRangesByCategory(int $fk_c_exp_tax_cat, $active = 1)
+ public function getRangesByCategory(int $fk_c_exp_tax_cat, $active = 1)
{
- global $db;
-
$ranges = array();
dol_syslog(get_called_class().'::getRangesByCategory for fk_c_exp_tax_cat='.$fk_c_exp_tax_cat, LOG_DEBUG);
@@ -170,24 +165,25 @@ class ExpenseReportIk extends CoreObject
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
}
$sql .= ' WHERE r.fk_c_exp_tax_cat = '.((int) $fk_c_exp_tax_cat);
+ $sql .= " AND entity IN(0, ".getEntity($this->element).")";
if ($active) {
$sql .= ' AND r.active = 1 AND c.active = 1';
}
$sql .= ' ORDER BY r.range_ik';
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
if ($num > 0) {
- while ($obj = $db->fetch_object($resql)) {
- $object = new ExpenseReportIk($db);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $object = new ExpenseReportIk($this->db);
$object->fetch($obj->rowid);
$ranges[] = $object;
}
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $ranges;
@@ -198,24 +194,23 @@ class ExpenseReportIk extends CoreObject
*
* @return array
*/
- public static function getAllRanges()
+ public function getAllRanges()
{
- global $db;
-
$ranges = array();
$sql = ' SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, c.label, i.rowid as fk_expense_ik, r.active as range_active, c.active as cat_active';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)';
- $sql .= ' WHERE r.entity IN (0, '.getEntity('').')';
+ $sql .= ' WHERE r.entity IN (0, '.getEntity($this->element).')';
$sql .= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik';
- dol_syslog(get_called_class().'::getAllRanges sql='.$sql, LOG_DEBUG);
- $resql = $db->query($sql);
+ dol_syslog(get_called_class().'::getAllRanges', LOG_DEBUG);
+
+ $resql = $this->db->query($sql);
if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
- $ik = new ExpenseReportIk($db);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $ik = new ExpenseReportIk($this->db);
if ($obj->fk_expense_ik > 0) {
$ik->fetch($obj->fk_expense_ik);
}
@@ -227,7 +222,7 @@ class ExpenseReportIk extends CoreObject
$ranges[$obj->fk_c_exp_tax_cat]['ranges'][] = $obj;
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $ranges;
@@ -236,30 +231,28 @@ class ExpenseReportIk extends CoreObject
/**
* Return the max number of range by a category
*
- * @param int $default_c_exp_tax_cat id
- * @return int
+ * @param int $default_c_exp_tax_cat id Default c_exp_tax_cat
+ * @return int Max nb
*/
- public static function getMaxRangeNumber($default_c_exp_tax_cat = 0)
+ public function getMaxRangeNumber($default_c_exp_tax_cat = 0)
{
- global $db, $conf;
-
$sql = 'SELECT MAX(counted) as nbRange FROM (';
$sql .= ' SELECT COUNT(*) as counted';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
- $sql .= ' WHERE r.entity IN (0, '.$conf->entity.')';
+ $sql .= ' WHERE r.entity IN (0, '.getEntity($this->element).')';
if ($default_c_exp_tax_cat > 0) {
$sql .= ' AND r.fk_c_exp_tax_cat = '.((int) $default_c_exp_tax_cat);
}
$sql .= ' GROUP BY r.fk_c_exp_tax_cat';
$sql .= ') as counts';
- dol_syslog(get_called_class().'::getMaxRangeNumber sql='.$sql, LOG_DEBUG);
- $resql = $db->query($sql);
+ dol_syslog(get_called_class().'::getMaxRangeNumber', LOG_DEBUG);
+ $resql = $this->db->query($sql);
if ($resql) {
- $obj = $db->fetch_object($resql);
+ $obj = $this->db->fetch_object($resql);
return $obj->nbRange;
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return 0;
diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php
index 6299dd7c5bd..ae89b4b0f51 100644
--- a/htdocs/expensereport/class/expensereport_rule.class.php
+++ b/htdocs/expensereport/class/expensereport_rule.class.php
@@ -148,20 +148,19 @@ class ExpenseReportRule extends CoreObject
* @param int $fk_user user of expense
* @return array Array with ExpenseReportRule
*/
- public static function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '')
+ public function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '')
{
- global $db;
-
$rules = array();
+
$sql = 'SELECT er.rowid';
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er';
- $sql .= ' WHERE er.entity IN (0,'.getEntity('').')';
+ $sql .= ' WHERE er.entity IN (0,'.getEntity($this->element).')';
if (!empty($fk_c_type_fees)) {
$sql .= ' AND er.fk_c_type_fees IN (-1, '.((int) $fk_c_type_fees).')';
}
if (!empty($date)) {
- $sql .= " AND er.dates <= '".dol_print_date($date, '%Y-%m-%d')."'";
- $sql .= " AND er.datee >= '".dol_print_date($date, '%Y-%m-%d')."'";
+ $sql .= " AND er.dates <= '".$this->db->idate($date)."'";
+ $sql .= " AND er.datee >= '".$this->db->idate($date)."'";
}
if ($fk_user > 0) {
$sql .= ' AND (er.is_for_all = 1';
@@ -172,18 +171,18 @@ class ExpenseReportRule extends CoreObject
dol_syslog("ExpenseReportRule::getAllRule");
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
- $rule = new ExpenseReportRule($db);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $rule = new ExpenseReportRule($this->db);
if ($rule->fetch($obj->rowid) > 0) {
$rules[$rule->id] = $rule;
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
}
} else {
- dol_print_error($db);
+ dol_print_error($this->db);
}
return $rules;
@@ -201,7 +200,7 @@ class ExpenseReportRule extends CoreObject
if ($this->fk_usergroup > 0) {
$group = new UserGroup($this->db);
if ($group->fetch($this->fk_usergroup) > 0) {
- return $group->nom;
+ return $group->name;
} else {
$this->error = $group->error;
$this->errors[] = $this->error;
diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php
index 44eb3734378..d74e0a5c5e8 100644
--- a/htdocs/fichinter/card-rec.php
+++ b/htdocs/fichinter/card-rec.php
@@ -587,7 +587,7 @@ if ($action == 'create') {
print $langs->trans('Frequency');
print '';
if ($action != 'editfrequency' && $user->rights->ficheinter->creer) {
- print '';
+ print ' ';
print img_edit($langs->trans('Edit'), 1).' ';
}
print '';
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 9bf43a60378..6613ea0ed9d 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -1146,7 +1146,7 @@ if ($action == 'create') {
$morehtmlref .= ' ';
$morehtmlref .= ' ';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
- $morehtmlref .= ' ';
+ $morehtmlref .= ' ';
$morehtmlref .= '';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
@@ -1350,21 +1350,21 @@ if ($action == 'create') {
// Icon to edit and delete
if ($object->statut == 0 && $user->rights->ficheinter->creer) {
print '';
- print 'id.'&action=editline&line_id='.$objp->rowid.'#'.$objp->rowid.'">';
+ print ' id.'&action=editline&token='.newToken().'&line_id='.$objp->rowid.'#'.$objp->rowid.'">';
print img_edit();
print ' ';
- print 'id.'&action=ask_deleteline&line_id='.$objp->rowid.'">';
+ print ' id.'&action=ask_deleteline&token='.newToken().'&line_id='.$objp->rowid.'">';
print img_delete();
print ' ';
print '';
if ($num > 1) {
if ($i > 0) {
- print 'id.'&action=up&line_id='.$objp->rowid.'">';
+ print ' id.'&action=up&token='.newToken().'&line_id='.$objp->rowid.'">';
print img_up();
print ' ';
}
if ($i < $num - 1) {
- print 'id.'&action=down&line_id='.$objp->rowid.'">';
+ print ' id.'&action=down&token='.newToken().'&line_id='.$objp->rowid.'">';
print img_down();
print ' ';
}
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 12b7b09cf53..9cfb2fe475f 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -261,7 +261,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditions');
print ' ';
if (($action != 'editconditions') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -279,7 +279,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode');
print ' ';
if (($action != 'editmode') && $user->rights->societe->creer) {
- print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index e579c07ac14..ae6c271fec8 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1975,7 +1975,7 @@ if ($action == 'create') {
}
if (empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) || $action != 'edit_thirdparty') {
if (!empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $object->statut == CommandeFournisseur::STATUS_DRAFT) {
- $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).' ';
+ $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).' ';
}
$morehtmlref .= ' : '.$object->thirdparty->getNomUrl(1, 'supplier');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
@@ -2075,7 +2075,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditions');
print ' ';
if ($action != 'editconditions') {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -2094,7 +2094,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode') {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -2114,7 +2114,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -2134,7 +2134,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -2162,7 +2162,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $usercancreate) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
@@ -2187,7 +2187,7 @@ if ($action == 'create') {
print $langs->trans('DateDeliveryPlanned');
print ' ';
if ($action != 'editdate_livraison') {
- print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).' ';
}
print '';
print '';
@@ -2221,7 +2221,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index afd99951aa4..16d4b1f25f3 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -1294,13 +1294,13 @@ if ($id > 0 || !empty($ref)) {
if ($action != 'editline' || $lineid != $objp->dispatchlineid) {
if (empty($reception->id) || ($reception->statut == Reception::STATUS_DRAFT)) { // only allow edit on draft reception
print ' ';
- print 'id.'&action=editline&lineid='.$objp->dispatchlineid.'#line_'.$objp->dispatchlineid.'">';
+ print ' id.'&action=editline&token='.newToken().'&lineid='.$objp->dispatchlineid.'#line_'.$objp->dispatchlineid.'">';
print img_edit();
print ' ';
print ' ';
print '';
- print 'id.'&action=ask_deleteline&lineid='.$objp->dispatchlineid.'#dispatch_received_products">';
+ print ' id.'&action=ask_deleteline&token='.newToken().'&lineid='.$objp->dispatchlineid.'#dispatch_received_products">';
print img_delete();
print ' ';
print ' ';
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 88c37aaaf22..21d6e73eb39 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -423,9 +423,9 @@ if (empty($reshook)) {
dol_print_error($db);
}
} elseif ($action == 'setdatef' && $usercancreate) {
- $newdate = dol_mktime(0, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']);
- if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE) ? 0 : $conf->global->INVOICE_MAX_OFFSET_IN_FUTURE))) {
- if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) {
+ $newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver');
+ 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');
@@ -449,7 +449,7 @@ if (empty($reshook)) {
}
} elseif ($action == 'setdate_lim_reglement' && $usercancreate) {
$object->fetch($id);
- $object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']);
+ $object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int'));
if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
$object->date_echeance = $object->date;
setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
@@ -695,6 +695,7 @@ if (empty($reshook)) {
if ($socid > 0) {
$object->socid = GETPOST('socid', 'int');
}
+ $selectedLines = GETPOST('toselect', 'array');
$db->begin();
@@ -706,8 +707,12 @@ if (empty($reshook)) {
$error++;
}
- $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
- $datedue = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'));
+ $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
+ $datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver');
+ /*var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour'));
+ var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour'));
+ var_dump($db->idate($dateinvoice));
+ exit;*/
// Replacement invoice
if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) {
@@ -716,7 +721,7 @@ if (empty($reshook)) {
$action = 'create';
$_GET['socid'] = $_POST['socid'];
$error++;
- } 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';
@@ -780,7 +785,7 @@ if (empty($reshook)) {
$action = 'create';
$_GET['socid'] = $_POST['socid'];
$error++;
- } 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';
@@ -889,7 +894,7 @@ if (empty($reshook)) {
$action = 'create';
$_GET['socid'] = $_POST['socid'];
$error++;
- } 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';
@@ -1127,6 +1132,10 @@ if (empty($reshook)) {
$num = count($lines);
for ($i = 0; $i < $num; $i++) { // TODO handle subprice < 0
+ if (!in_array($lines[$i]->id, $selectedLines)) {
+ continue; // Skip unselected lines
+ }
+
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
@@ -2359,9 +2368,6 @@ if ($action == 'create') {
print $form->buttonsSaveCancel("CreateDraft");
- print "\n";
-
-
// Show origin lines
if (is_object($objectsrc)) {
print ' ';
@@ -2375,6 +2381,8 @@ if ($action == 'create') {
print '';
}
+
+ print "\n";
} else {
if ($id > 0 || !empty($ref)) {
//
@@ -2771,7 +2779,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditions');
print '';
if ($action != 'editconditions' && $form_permission) {
- print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '';
print '';
@@ -2800,7 +2808,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode');
print ' ';
if ($action != 'editmode' && $form_permission2) {
- print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '';
print '';
@@ -2820,7 +2828,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -2839,7 +2847,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' ';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
+ print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' ';
}
print '';
print '';
@@ -2867,7 +2875,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount');
print ' ';
if ($action != 'editbankaccount' && $usercancreate) {
- print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
+ print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '';
print '';
@@ -2887,7 +2895,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel');
print ' ';
if ($usercancreate) {
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
} else {
print ' ';
}
@@ -2910,7 +2918,7 @@ if ($action == 'create') {
print $langs->trans('IntracommReportTransportMode');
print ' ';
if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
- print 'id.'">'.img_edit().' ';
+ print 'id.'">'.img_edit().' ';
}
print '';
print '';
@@ -3398,7 +3406,7 @@ if ($action == 'create') {
$ventilExportCompta = $object->getVentilExportCompta(); // Should be 0 since the sum of payments are zero. But we keep the protection.
if ($ventilExportCompta == 0) {
- print ''.$langs->trans('Modify').' ';
+ print ''.$langs->trans('Modify').' ';
} else {
print ''.$langs->trans('Modify').' ';
}
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 6a23cdbdd91..56f98139052 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -441,7 +441,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
-if (!empty($search_categ_sup)) {
+if (!empty($search_categ_sup) && $search_categ_supplier != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
}
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 65c3521bf20..9948b64e460 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -338,25 +338,25 @@ if (empty($reshook)) {
// If no start date
if (empty($_POST['date_debut_'])) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatedebut');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=nodatedebut');
exit;
}
// If no end date
if (empty($_POST['date_fin_'])) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatefin');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=nodatefin');
exit;
}
// If start date after end date
if ($date_debut > $date_fin) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=datefin');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=datefin');
exit;
}
// If no validator designated
if ($approverid < 1) {
- header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=Valideur');
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'&error=Valideur');
exit;
}
@@ -1339,7 +1339,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
}
$include_users = $object->fetch_users_approver_holiday();
if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) {
- print 'id.'&action=editvalidator">'.img_edit($langs->trans("Edit")).' ';
+ print 'id.'&action=editvalidator&token='.newToken().'">'.img_edit($langs->trans("Edit")).' ';
}
print '';
print '';
@@ -1451,11 +1451,11 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print '';
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) {
- print '
id.'&action=edit" class="butAction">'.$langs->trans("EditCP").' ';
+ print '
id.'&action=edit&token='.newToken().'" class="butAction">'.$langs->trans("EditCP").' ';
}
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { // If draft
- print '
id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").' ';
+ print '
id.'&action=sendToValidate&token='.newToken().'" class="butAction">'.$langs->trans("Validate").' ';
}
if ($object->statut == Holiday::STATUS_VALIDATED) { // If validated
diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php
index 9daf1d768b8..0ce7d793003 100644
--- a/htdocs/hrm/establishment/card.php
+++ b/htdocs/hrm/establishment/card.php
@@ -419,7 +419,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
* Action bar
*/
print '
';
}
diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php
index 68bcd78636b..ec7ba9b74e3 100644
--- a/htdocs/hrm/index.php
+++ b/htdocs/hrm/index.php
@@ -96,7 +96,7 @@ print load_fiche_titre($langs->trans("HRMArea"), '', 'hrm');
if (!empty($setupcompanynotcomplete)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
- print '
';
+ print '
';
llxFooter();
exit;
diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql
index 07a09724ed2..7af5d28df8c 100644
--- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql
+++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql
@@ -356,3 +356,16 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1306','S
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1307','Société en participation');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1308','Groupe de sociétés');
+-- Sweden (id country=20)
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse');
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index 63f20198658..e6578a1bc66 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -425,14 +425,21 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project;
+
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_actioncomm, email);
+
+-- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee;
+-- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
create table llx_eventorganization_conferenceorboothattendee_extrafields
(
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 51610ee8557..03bb7631dda 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
@@ -35,10 +35,31 @@
-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL;
-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
+
+-- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee;
+-- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee;
+
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
+
+
-- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_actioncomm integer NULL;
-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL;
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
+
UPDATE llx_extrafields SET elementtype = 'salary' WHERE elementtype = 'payment_salary';
ALTER TABLE llx_payment_salary_extrafields RENAME TO llx_salary_extrafields;
@@ -57,6 +78,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;
@@ -113,3 +135,17 @@ ALTER TABLE llx_product_lot ADD COLUMN fk_barcode_type integer DEFAULT NULL;
ALTER TABLE llx_projet ADD COLUMN max_attendees integer DEFAULT 0;
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN cost_price double(24,8) DEFAULT 0;
+
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening');
+INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse');
+
diff --git a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql
index 9489cca9652..a693fb19c41 100644
--- a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql
+++ b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql
@@ -13,7 +13,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
-create table llx_categorie_knowledgemanagement
+create table llx_categorie_knowledgemanagement(
fk_categorie integer NOT NULL,
fk_knowledgemanagement integer NOT NULL,
import_key varchar(14)
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.key.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql
index 0633e3cc2a2..9e1bbcde191 100644
--- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql
+++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql
@@ -18,15 +18,11 @@
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_project (fk_project);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
-- END MODULEBUILDER INDEXES
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_project, fk_actioncomm, email);
-
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
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..80e3f90b828 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,8 @@ create table llx_product
desiredstock float DEFAULT 0,
fk_unit integer DEFAULT NULL,
price_autogen tinyint DEFAULT 0,
- 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
+ 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
)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 '
'.$langs->trans("ErrorFailedToConnectToDatabase", $conf->db->name).' '.$langs->trans('Error').' ';
dolibarr_install_syslog('upgrade2: failed to connect to database :'.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR);
@@ -182,6 +177,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
}
+ // Create the global $hookmanager object
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager = new HookManager($db);
+ $hookmanager->initHooks(array('upgrade'));
+
/***************************************************************************************
*
diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php
index 99aaabe7744..8af0431f361 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_card.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_card.php
@@ -404,12 +404,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd);
}
if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $permissiontovalidate) {
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
}
// Validate
if ($object->status == $object::STATUS_DRAFT) {
if ((empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) && $permissiontovalidate) {
- print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&token='.newToken().'&confirm=yes', '', $permissiontoadd);
} else {
$langs->load("errors");
//print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0);
@@ -418,7 +418,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
- print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
/*
if ($permissiontoadd) {
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index e9fa70e53d2..75aa11cf771 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -371,13 +371,13 @@ $param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
- 'validate'=>$langs->trans("Validate"),
- //'generate_doc'=>$langs->trans("ReGeneratePDF"),
- //'builddoc'=>$langs->trans("PDFMerge"),
- //'presend'=>$langs->trans("SendByMail"),
+ 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
+ //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
+ //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
+ //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($permissiontodelete) {
- $arrayofmassactions['predelete'] = '
'.$langs->trans("Delete");
+ $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
diff --git a/htdocs/langs/am_ET/mrp.lang b/htdocs/langs/am_ET/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/am_ET/mrp.lang
+++ b/htdocs/langs/am_ET/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/ar_IQ/mrp.lang b/htdocs/langs/ar_IQ/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/ar_IQ/mrp.lang
+++ b/htdocs/langs/ar_IQ/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/ar_SA/mrp.lang b/htdocs/langs/ar_SA/mrp.lang
index 97c6e6378bb..fe2c1a87769 100644
--- a/htdocs/langs/ar_SA/mrp.lang
+++ b/htdocs/langs/ar_SA/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=أوامر التصنيع
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/az_AZ/mrp.lang b/htdocs/langs/az_AZ/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/az_AZ/mrp.lang
+++ b/htdocs/langs/az_AZ/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/bg_BG/mrp.lang b/htdocs/langs/bg_BG/mrp.lang
index 0c39bca3291..933315a64d4 100644
--- a/htdocs/langs/bg_BG/mrp.lang
+++ b/htdocs/langs/bg_BG/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Стойност 0,95 означава сре
DeleteBillOfMaterials=Изтриване на списък с материали
DeleteMo=Изтриване на поръчка за производство
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Поръчки за производство
NewMO=Нова поръчка за производство
QtyToProduce=Кол. за производство
diff --git a/htdocs/langs/bn_BD/mrp.lang b/htdocs/langs/bn_BD/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/bn_BD/mrp.lang
+++ b/htdocs/langs/bn_BD/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/bn_IN/mrp.lang b/htdocs/langs/bn_IN/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/bn_IN/mrp.lang
+++ b/htdocs/langs/bn_IN/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/bs_BA/mrp.lang b/htdocs/langs/bs_BA/mrp.lang
index 16ab0c8ac49..999a6ec67b8 100644
--- a/htdocs/langs/bs_BA/mrp.lang
+++ b/htdocs/langs/bs_BA/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/cs_CZ/mrp.lang b/htdocs/langs/cs_CZ/mrp.lang
index 948205b3887..13d519a79b7 100644
--- a/htdocs/langs/cs_CZ/mrp.lang
+++ b/htdocs/langs/cs_CZ/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Hodnota 0,95 znamená průměrně ztrátu vyr
DeleteBillOfMaterials=Odstranit kusovník
DeleteMo=Smazat výrobní zakázku
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Výrobní zakázky
NewMO=Nová výrobní objednávka
QtyToProduce=Množství k výrobě
diff --git a/htdocs/langs/de_DE/mrp.lang b/htdocs/langs/de_DE/mrp.lang
index 0c90379fd43..323bbe74d59 100644
--- a/htdocs/langs/de_DE/mrp.lang
+++ b/htdocs/langs/de_DE/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Ein Wert von 0,95 bedeutet im Durchschnitt 5%
DeleteBillOfMaterials=Stückliste löschen
DeleteMo=Fertigungsauftrag löschen
ConfirmDeleteBillOfMaterials=Möchten Sie diese Stückliste wirklich löschen?
-ConfirmDeleteMo=Möchten Sie diese Stückliste wirklich löschen?
+ConfirmDeleteMo=Möchten Sie diese Fertigungsauftrag wirklich löschen?
MenuMRP=Fertigungsaufträge
NewMO=Neuer Fertigungsauftrag
QtyToProduce=Produktionsmenge
diff --git a/htdocs/langs/el_GR/mrp.lang b/htdocs/langs/el_GR/mrp.lang
index 3d622d1de8b..f70ffcd3117 100644
--- a/htdocs/langs/el_GR/mrp.lang
+++ b/htdocs/langs/el_GR/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Η τιμή 0,95 σημαίνει κατά μ
DeleteBillOfMaterials=Διαγραφή λογαριασμού υλικών
DeleteMo=Διαγραφή Παραγγελίας Παραγωγής
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Παραγγελίες Παραγωγής
NewMO=Νέα Παραγγελία Παραγωγής
QtyToProduce=Ποσότητα για παραγωγή
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index fc4b86a2cdb..c20e0a339f6 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -37,8 +37,8 @@ OtherInfo=Other information
DeleteCptCategory=Remove accounting account from group
ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group?
JournalizationInLedgerStatus=Status of journalization
-AlreadyInGeneralLedger=Already transferred in accounting journals and ledger
-NotYetInGeneralLedger=Not yet transferred in accouting journals and ledger
+AlreadyInGeneralLedger=Already transferred to accounting journals and ledger
+NotYetInGeneralLedger=Not yet transferred to accouting journals and ledger
GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group
DetailByAccount=Show detail by account
AccountWithNonZeroValues=Accounts with non-zero values
@@ -298,7 +298,7 @@ NoNewRecordSaved=No more record to journalize
ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account
ChangeBinding=Change the binding
Accounted=Accounted in ledger
-NotYetAccounted=Not yet accounted in the ledger
+NotYetAccounted=Not yet transferred to accounting
ShowTutorial=Show Tutorial
NotReconciled=Not reconciled
WarningRecordWithoutSubledgerAreExcluded=Warning, all operations without subledger account defined are filtered and excluded from this view
@@ -329,8 +329,8 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc
ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting)
## Export
-NotifiedExportDate=Notified export date (modification of the entries will not be possible)
-NotifiedValidationDate=Validation of the entries (modification or deletion of the entries will not be possible)
+NotifiedExportDate=Flag exported lines as exported (modification of the lines will not be possible)
+NotifiedValidationDate=Validate the exported entries (modification or deletion of the lines will not be possible)
ConfirmExportFile=Confirmation of the generation of the accounting export file ?
ExportDraftJournal=Export draft journal
Modelcsv=Model of export
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index a73f06e1201..53355dd15ce 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -898,6 +898,11 @@ Permission1002=Create/modify warehouses
Permission1003=Delete warehouses
Permission1004=Read stock movements
Permission1005=Create/modify stock movements
+Permission1011=View inventories
+Permission1012=Create new inventory
+Permission1014=Validate inventory
+Permission1015=Allow to change PMP value for a product
+Permission1016=Delete inventory
Permission1101=Read delivery receipts
Permission1102=Create/modify delivery receipts
Permission1104=Validate delivery receipts
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index cbe238ad2a4..bc9c7dab537 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -64,6 +64,7 @@ ShipmentClassifyClosedInDolibarr=Shipment %s classified billed
ShipmentUnClassifyCloseddInDolibarr=Shipment %s classified re-open
ShipmentBackToDraftInDolibarr=Shipment %s go back to draft status
ShipmentDeletedInDolibarr=Shipment %s deleted
+ShipmentCanceledInDolibarr=Shipment %s canceled
ReceptionValidatedInDolibarr=Reception %s validated
OrderCreatedInDolibarr=Order %s created
OrderValidatedInDolibarr=Order %s validated
diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang
index bc18bed4a29..494a6c55164 100644
--- a/htdocs/langs/en_US/ecm.lang
+++ b/htdocs/langs/en_US/ecm.lang
@@ -45,3 +45,5 @@ GenerateImgWebp=Duplicate all images with another version with .webp format
ConfirmGenerateImgWebp=If you confirm, you will generate an image in .webp format for all images currently into this folder (subfolders are not included)...
ConfirmImgWebpCreation=Confirm all images duplication
SucessConvertImgWebp=Images successfully duplicated
+ECMDirName=Dir name
+ECMParentDirectory=Parent directory
diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang
index 52b00c7e592..5da6be656e5 100644
--- a/htdocs/langs/en_US/eventorganization.lang
+++ b/htdocs/langs/en_US/eventorganization.lang
@@ -19,7 +19,7 @@
#
ModuleEventOrganizationName = Event Organization
EventOrganizationDescription = Event Organization through Module Project
-EventOrganizationDescriptionLong= Manage the organization of an event (conferences, attendees, speakers, with public suggestion, vote or registration pages)
+EventOrganizationDescriptionLong= Manage the organization of an event (show, conferences, attendees or speakers, with public pages for suggestion, vote or registration)
#
# Menu
#
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 47d1fbe889f..10e81316ee4 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -32,7 +32,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
@@ -104,4 +104,4 @@ HumanMachine=Human / Machine
WorkstationArea=Workstation area
Machines=Machines
THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item
-MOAndLines=Manufacturing Orders and lines
\ No newline at end of file
+MOAndLines=Manufacturing Orders and lines
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 294e2afbc03..128eb120e0b 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -401,5 +401,11 @@ DeleteLinkedProduct=Delete the child product linked to the combination
AmountUsedToUpdateWAP=Amount to use to update the Weighted Average Price
PMPValue=Weighted average price
PMPValueShort=WAP
+
+mandatoryperiod=Mandatory periods
+mandatoryPeriodNeedTobeSet=Attention periods not entered and mandatory
+mandatoryPeriodNeedTobeSetMsgValidate=A service requires a start and end period
+mandatoryHelper=Message to the user on the need to enter a start date and an end date on a service when creating / validating an invoice, commercial proposal, sales order.
This action is not blocking in the process of confirmation
DefaultBOM=Default BOM
-DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'.
\ No newline at end of file
+DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'.
+
diff --git a/htdocs/langs/et_EE/mrp.lang b/htdocs/langs/et_EE/mrp.lang
index c7146c45dfe..32e99e6e6b7 100644
--- a/htdocs/langs/et_EE/mrp.lang
+++ b/htdocs/langs/et_EE/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/eu_ES/mrp.lang b/htdocs/langs/eu_ES/mrp.lang
index acf5a23db9b..a6e57a1168a 100644
--- a/htdocs/langs/eu_ES/mrp.lang
+++ b/htdocs/langs/eu_ES/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/fa_IR/mrp.lang b/htdocs/langs/fa_IR/mrp.lang
index c00afb9dd3a..d536b6b661c 100644
--- a/htdocs/langs/fa_IR/mrp.lang
+++ b/htdocs/langs/fa_IR/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/fi_FI/mrp.lang b/htdocs/langs/fi_FI/mrp.lang
index 2eafe6926bb..14f2af7e1fe 100644
--- a/htdocs/langs/fi_FI/mrp.lang
+++ b/htdocs/langs/fi_FI/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Valmistustilaukset
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/fr_FR/ecm.lang b/htdocs/langs/fr_FR/ecm.lang
index 605cc97625d..c5867cbc7ed 100644
--- a/htdocs/langs/fr_FR/ecm.lang
+++ b/htdocs/langs/fr_FR/ecm.lang
@@ -45,3 +45,5 @@ GenerateImgWebp=Dupliquer toutes les images avec une autre version au format .we
ConfirmGenerateImgWebp=Si vous confirmez, vous générerez une image au format .webp pour toutes les images actuellement dans ce dossier (les sous-dossiers ne sont pas inclus)...
ConfirmImgWebpCreation=Confirmer la duplication de toutes les images
SucessConvertImgWebp=Images dupliquées avec succès
+ECMDirName=Nom du dossier
+ECMParentDirectory=Dossier parent
diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang
index 013d75d2ec0..83514bd95ff 100644
--- a/htdocs/langs/fr_FR/products.lang
+++ b/htdocs/langs/fr_FR/products.lang
@@ -399,3 +399,7 @@ ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur)
DeleteLinkedProduct=Supprimer le produit enfant lié à la combinaison
PMPValue=Prix moyen pondéré (PMP)
PMPValueShort=PMP
+mandatoryperiod=Périodes obligatoires
+mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires
+mandatoryPeriodNeedTobeSetMsgValidate=Un service nécessite une période de début et de fin
+mandatoryHelper=Message à l'utilisateur sur la necessité de saisir une date de début et une date de fin sur un service lors de la création/validation de facture, proposition commerciale , commande client.
Cette action n'est pas bloquante dans le processus de validation
diff --git a/htdocs/langs/he_IL/mrp.lang b/htdocs/langs/he_IL/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/he_IL/mrp.lang
+++ b/htdocs/langs/he_IL/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/hi_IN/mrp.lang b/htdocs/langs/hi_IN/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/hi_IN/mrp.lang
+++ b/htdocs/langs/hi_IN/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/hr_HR/mrp.lang b/htdocs/langs/hr_HR/mrp.lang
index dd2c40eda6c..00710061f2a 100644
--- a/htdocs/langs/hr_HR/mrp.lang
+++ b/htdocs/langs/hr_HR/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Proizvodni nalozi
NewMO=Novi proizvodni nalog
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/hu_HU/mrp.lang b/htdocs/langs/hu_HU/mrp.lang
index 350817adedb..0623b3a8447 100644
--- a/htdocs/langs/hu_HU/mrp.lang
+++ b/htdocs/langs/hu_HU/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Gyártási rendelések
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/id_ID/mrp.lang b/htdocs/langs/id_ID/mrp.lang
index 76290ed5ea9..6f0d5c87b0a 100644
--- a/htdocs/langs/id_ID/mrp.lang
+++ b/htdocs/langs/id_ID/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Nilai 0,95 berarti rata-rata 5%% dari kehilan
DeleteBillOfMaterials=Hapus Bill Of Material
DeleteMo=Hapus Pesanan Pembuatan
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Pesanan Manufaktur
NewMO=Pesanan Manufaktur Baru
QtyToProduce=Jumlah yang akan diproduksi
diff --git a/htdocs/langs/is_IS/mrp.lang b/htdocs/langs/is_IS/mrp.lang
index 8fe3fd8f4c1..ca52ce21b60 100644
--- a/htdocs/langs/is_IS/mrp.lang
+++ b/htdocs/langs/is_IS/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/it_IT/mrp.lang b/htdocs/langs/it_IT/mrp.lang
index 1e6247f3799..6d54470bf3f 100644
--- a/htdocs/langs/it_IT/mrp.lang
+++ b/htdocs/langs/it_IT/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Il valore di 0,95 indica una media di 5%% di
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Elimina Ordine di Produzione
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Ordini di produzione
NewMO=Nuovo ordine di produzione
QtyToProduce=Qtà da produrre
diff --git a/htdocs/langs/ka_GE/mrp.lang b/htdocs/langs/ka_GE/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/ka_GE/mrp.lang
+++ b/htdocs/langs/ka_GE/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/kk_KZ/mrp.lang b/htdocs/langs/kk_KZ/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/kk_KZ/mrp.lang
+++ b/htdocs/langs/kk_KZ/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/km_KH/mrp.lang b/htdocs/langs/km_KH/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/km_KH/mrp.lang
+++ b/htdocs/langs/km_KH/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/kn_IN/mrp.lang b/htdocs/langs/kn_IN/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/kn_IN/mrp.lang
+++ b/htdocs/langs/kn_IN/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/ko_KR/mrp.lang b/htdocs/langs/ko_KR/mrp.lang
index 131e1f376ac..9ea63ea0c0c 100644
--- a/htdocs/langs/ko_KR/mrp.lang
+++ b/htdocs/langs/ko_KR/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/lo_LA/mrp.lang b/htdocs/langs/lo_LA/mrp.lang
index 00db7f202ec..daffab535ba 100644
--- a/htdocs/langs/lo_LA/mrp.lang
+++ b/htdocs/langs/lo_LA/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/lt_LT/mrp.lang b/htdocs/langs/lt_LT/mrp.lang
index 9760b1babbe..a88ffc2687d 100644
--- a/htdocs/langs/lt_LT/mrp.lang
+++ b/htdocs/langs/lt_LT/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/mk_MK/mrp.lang b/htdocs/langs/mk_MK/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/mk_MK/mrp.lang
+++ b/htdocs/langs/mk_MK/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/mn_MN/mrp.lang b/htdocs/langs/mn_MN/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/mn_MN/mrp.lang
+++ b/htdocs/langs/mn_MN/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/ne_NP/mrp.lang b/htdocs/langs/ne_NP/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/ne_NP/mrp.lang
+++ b/htdocs/langs/ne_NP/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/nl_NL/mrp.lang b/htdocs/langs/nl_NL/mrp.lang
index d94344175c0..143e3cb4d55 100644
--- a/htdocs/langs/nl_NL/mrp.lang
+++ b/htdocs/langs/nl_NL/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Waarde van 0,95 betekent een gemiddelde van 5
DeleteBillOfMaterials=Stuklijst verwijderen
DeleteMo=Productieorder verwijderen
ConfirmDeleteBillOfMaterials=Weet u zeker dat u deze stuklijst wilt verwijderen?
-ConfirmDeleteMo=Weet u zeker dat u deze stuklijst wilt verwijderen?
+ConfirmDeleteMo=Weet u zeker dat u deze Productieorder wilt verwijderen?
MenuMRP=Productieorders
NewMO=Nieuwe productieorder
QtyToProduce=Te produceren aantal
diff --git a/htdocs/langs/pt_PT/mrp.lang b/htdocs/langs/pt_PT/mrp.lang
index 025f164f94e..39982e5bd35 100644
--- a/htdocs/langs/pt_PT/mrp.lang
+++ b/htdocs/langs/pt_PT/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Eliminar Faturas de Materiais
DeleteMo=Eliminar Encomenda de Manufaturação
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Encomendas de Manufatura
NewMO=Nova Encomenda de Manufatura
QtyToProduce=Qt. a produzir
diff --git a/htdocs/langs/sk_SK/mrp.lang b/htdocs/langs/sk_SK/mrp.lang
index d620b7e31e3..9917552ba94 100644
--- a/htdocs/langs/sk_SK/mrp.lang
+++ b/htdocs/langs/sk_SK/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/sl_SI/mrp.lang b/htdocs/langs/sl_SI/mrp.lang
index 30bf0ca0238..b700927dd12 100644
--- a/htdocs/langs/sl_SI/mrp.lang
+++ b/htdocs/langs/sl_SI/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/sq_AL/mrp.lang b/htdocs/langs/sq_AL/mrp.lang
index 29554c164a3..20a6d7238de 100644
--- a/htdocs/langs/sq_AL/mrp.lang
+++ b/htdocs/langs/sq_AL/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/sr_RS/mrp.lang b/htdocs/langs/sr_RS/mrp.lang
index 16ab0c8ac49..999a6ec67b8 100644
--- a/htdocs/langs/sr_RS/mrp.lang
+++ b/htdocs/langs/sr_RS/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/sw_SW/mrp.lang b/htdocs/langs/sw_SW/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/sw_SW/mrp.lang
+++ b/htdocs/langs/sw_SW/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/tg_TJ/mrp.lang b/htdocs/langs/tg_TJ/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/tg_TJ/mrp.lang
+++ b/htdocs/langs/tg_TJ/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/th_TH/mrp.lang b/htdocs/langs/th_TH/mrp.lang
index d5d061b855b..229690f76fd 100644
--- a/htdocs/langs/th_TH/mrp.lang
+++ b/htdocs/langs/th_TH/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/tr_TR/mrp.lang b/htdocs/langs/tr_TR/mrp.lang
index 574ddefd491..b9c69a56364 100644
--- a/htdocs/langs/tr_TR/mrp.lang
+++ b/htdocs/langs/tr_TR/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Üretim Emri Sil
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Üretim Emirleri
NewMO=Yeni Üretim Emiri
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/uk_UA/mrp.lang b/htdocs/langs/uk_UA/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/uk_UA/mrp.lang
+++ b/htdocs/langs/uk_UA/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/vi_VN/mrp.lang b/htdocs/langs/vi_VN/mrp.lang
index f708bed87af..d24ddfe3b48 100644
--- a/htdocs/langs/vi_VN/mrp.lang
+++ b/htdocs/langs/vi_VN/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Xóa hóa đơn vật liệu
DeleteMo=Xóa đơn hàng sản xuất
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Đơn đặt hàng sản xuất
NewMO=Thêm Đơn hàng sản xuất
QtyToProduce=Số lượng để sản xuất
diff --git a/htdocs/langs/zh_CN/mrp.lang b/htdocs/langs/zh_CN/mrp.lang
index 86170bd9d91..e9f0381124a 100644
--- a/htdocs/langs/zh_CN/mrp.lang
+++ b/htdocs/langs/zh_CN/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/langs/zh_HK/mrp.lang b/htdocs/langs/zh_HK/mrp.lang
index 2414a92cefb..5d226c0f77b 100644
--- a/htdocs/langs/zh_HK/mrp.lang
+++ b/htdocs/langs/zh_HK/mrp.lang
@@ -31,7 +31,7 @@ ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Materials?
-ConfirmDeleteMo=Are you sure you want to delete this Bill Of Materials?
+ConfirmDeleteMo=Are you sure you want to delete this Manufacturing Order?
MenuMRP=Manufacturing Orders
NewMO=New Manufacturing Order
QtyToProduce=Qty to produce
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index df24e022d90..a15f6c926a6 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -717,12 +717,12 @@ if ($id > 0) {
// Edit
if (($object->paid == 0 || $object->paid == 2) && $user->rights->loan->write) {
- print '
';
+ print '
';
}
// Emit payment
if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) {
- print '
';
+ print '
';
}
// Classify 'paid'
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 1567df55a56..6f6d74c0cda 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -450,10 +450,12 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) {
$_SESSION['token'] = $_SESSION['newtoken'];
}
- // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
- $token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
- $_SESSION['newtoken'] = $token;
- dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG);
+ if (!isset($_SESSION['newtoken']) || getDolGlobalInt('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL')) {
+ // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
+ $token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
+ $_SESSION['newtoken'] = $token;
+ dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG);
+ }
}
}
@@ -504,7 +506,11 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt(
} else {
dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"])?'':$_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (POST method or GET with a sensible value for 'action' parameter) in main.inc.php. Token not provided.", LOG_WARNING);
print "Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n";
- print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0 into setup).\n";
+ print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0";
+ if (! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
+ print " instead of ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN;
+ }
+ print " into setup).\n";
}
die;
}
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index db8bc85816e..4a3f9fd6e25 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1999,15 +1999,15 @@ if ($module == 'initmodule') {
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print '';
print '
'.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print '';
print '
'.$langs->trans("ChangeLog").' : '.$pathtochangelog.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print '';
print '';
@@ -2177,8 +2177,8 @@ if ($module == 'initmodule') {
$pathtofile = 'langs/'.$langfile['relativename'];
}
print '
'.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
}
print '';
@@ -2226,7 +2226,7 @@ if ($module == 'initmodule') {
print ' ';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
if (is_array($dicts) && !empty($dicts)) {
print ' '.$langs->trans("LanguageFile").' : ';
@@ -2502,13 +2502,13 @@ if ($module == 'initmodule') {
print '';
print '
'.$langs->trans("ClassFile").' :
'.($realpathtoclass ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).($realpathtoclass ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("ApiClassFile").' :
'.($realpathtoapi ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).($realpathtoapi ? '' : ' ').' ';
if (dol_is_file($realpathtoapi)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
if (empty($conf->global->$const_name)) { // If module is not activated
print '
'.$langs->trans("GoToApiExplorer").' ';
@@ -2517,99 +2517,99 @@ if ($module == 'initmodule') {
}
} else {
//print '
'.$langs->trans("FileNotYetGenerated").' ';
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
// PHPUnit
print '
';
print '
'.$langs->trans("TestClassFile").' :
'.($realpathtophpunit ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).($realpathtophpunit ? '' : ' ').' ';
if (dol_is_file($realpathtophpunit)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
//print '
'.$langs->trans("FileNotYetGenerated").' ';
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
print '
';
print '
';
print '
'.$langs->trans("PageForLib").' :
'.($realpathtolib ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolib).($realpathtolib ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("PageForObjLib").' :
'.($realpathtoobjlib ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).($realpathtoobjlib ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("Image").' :
'.($realpathtopicto ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).($realpathtopicto ? '' : ' ').' ';
- //print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ //print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
print '
'.$langs->trans("SqlFile").' :
'.($realpathtosql ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).($realpathtosql ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
- print '
'.$langs->trans("DropTableIfEmpty").' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.$langs->trans("DropTableIfEmpty").' ';
//print '
'.$langs->trans("RunSql").' ';
print '
';
print '
'.$langs->trans("SqlFileKey").' :
'.($realpathtosqlkey ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlkey).($realpathtosqlkey ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
//print '
'.$langs->trans("RunSql").' ';
print '
';
print '
'.$langs->trans("SqlFileExtraFields").' :
'.($realpathtosqlextra ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).($realpathtosqlextra ? '' : ' ').' ';
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
print ' ';
- print '
'.$langs->trans("DropTableIfEmpty").' ';
+ print '
'.$langs->trans("DropTableIfEmpty").' ';
} else {
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
//print '
'.$langs->trans("RunSql").' ';
print '
';
print '
'.$langs->trans("SqlFileKeyExtraFields").' :
'.($realpathtosqlextrakey ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).($realpathtosqlextrakey ? '' : ' ').' ';
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
print '
';
print '
';
print '';
print '
'.$langs->trans("PageForList").' :
'.($realpathtolist ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtolist).($realpathtolist ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("PageForCreateEditView").' :
'.($realpathtocard ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocard).($realpathtocard ? '' : ' ').'?action=create ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
'.$langs->trans("PageForContactTab").' :
'.($realpathtocontact ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtocontact).($realpathtocontact ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtocontact)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
'.$langs->trans("PageForDocumentTab").' :
'.($realpathtodocument ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtodocument).($realpathtodocument ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtodocument)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
'.$langs->trans("PageForNoteTab").' :
'.($realpathtonote ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtonote).($realpathtonote ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtonote)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
'.$langs->trans("PageForAgendaTab").' :
'.($realpathtoagenda ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoagenda).($realpathtoagenda ? '' : ' ').' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
if (dol_is_file($realpathtoagenda)) {
print ' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
}
print '
';
print '
';
@@ -2928,7 +2928,7 @@ if ($module == 'initmodule') {
$format = 'markdown';
}
print '
'.$langs->trans("SpecificationFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
}
} else {
@@ -3020,7 +3020,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
@@ -3153,7 +3153,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
@@ -3243,7 +3243,7 @@ if ($module == 'initmodule') {
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
print ' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
print '
';
@@ -3252,7 +3252,7 @@ if ($module == 'initmodule') {
if (dol_is_file($dirins.'/'.$pathtohook)) {
print ''.$pathtohook.' ';
print ' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ''.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
print ''.$langs->trans("FileNotYetGenerated").' ';
@@ -3302,7 +3302,7 @@ if ($module == 'initmodule') {
print '';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
print ' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ' ';
if (!empty($triggers)) {
@@ -3311,7 +3311,7 @@ if ($module == 'initmodule') {
print '
';
print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
@@ -3407,11 +3407,11 @@ if ($module == 'initmodule') {
print '
'.$langs->trans("JSFile").' : ';
if (dol_is_file($dirins.'/'.$pathtohook)) {
print '
'.$pathtohook.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
- print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Delete"), 'delete').' ';
} else {
print '
'.$langs->trans("FileNotYetGenerated").' ';
- print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print '
'.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
}
print '
';
} else {
@@ -3455,13 +3455,13 @@ if ($module == 'initmodule') {
$pathtofile = $widget['relpath'];
print '
'.$langs->trans("WidgetFile").' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
} else {
print '
'.$langs->trans("WidgetFile").' : '.$langs->trans("NoWidget").' ';
- print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
print '';
}
print '';
@@ -3502,7 +3502,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
} else {
$fullpathoffile = dol_buildpath($file, 0);
@@ -3572,13 +3572,13 @@ if ($module == 'initmodule') {
$pathtofile = $clifile['relpath'];
print '
'.$langs->trans("CLIFile").' : '.$pathtofile.' ';
- print ''.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
} else {
print '
'.$langs->trans("CLIFile").' : '.$langs->trans("FileNotYetGenerated");' ';
- print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
print '';
}
print '';
@@ -3618,7 +3618,7 @@ if ($module == 'initmodule') {
print '
';
print '
'.$langs->trans("DescriptorFile").' :
'.$pathtofile.' ';
- print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
print '
';
@@ -3746,14 +3746,14 @@ if ($module == 'initmodule') {
}
print '
';
print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.' ';
- print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' ';
print '';
}
} else {
print '
';
print ' '.$langs->trans("SpecificationFile").' : '.$langs->trans("FileNotYetGenerated").' ';
- print ' '.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
+ print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
print '';
}
print '';
diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php
index d0d4a404dcf..7c6c6b2c04e 100644
--- a/htdocs/modulebuilder/template/admin/setup.php
+++ b/htdocs/modulebuilder/template/admin/setup.php
@@ -389,7 +389,7 @@ if ($action == 'edit') {
print '';
print '
';
} else {
print '
'.$langs->trans("NothingToSetup");
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index 51f35bbc33d..136952662cc 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -609,7 +609,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Modify
if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) {
- print '
id.'&action=edit">'.$langs->trans("Modify").' '."\n";
+ print '
id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").' '."\n";
} else {
print '
'.$langs->trans('Modify').' '."\n";
}
diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php
index a811a396811..5e145dbd8a6 100644
--- a/htdocs/multicurrency/class/multicurrency.class.php
+++ b/htdocs/multicurrency/class/multicurrency.class.php
@@ -432,7 +432,7 @@ class MultiCurrency extends CommonObject
*/
public function addRateFromDolibarr($code, $rate)
{
- global $db, $user;
+ global $user;
$currency = new MultiCurrency($this->db);
$currency->code = $code;
@@ -441,8 +441,8 @@ class MultiCurrency extends CommonObject
$sql = 'SELECT label FROM '.MAIN_DB_PREFIX."c_currencies WHERE code_iso = '".$this->db->escape($code)."'";
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql && ($line = $db->fetch_object($resql))) {
+ $resql = $this->db->query($sql);
+ if ($resql && ($line = $this->db->fetch_object($resql))) {
$currency->name = $line->label;
}
@@ -521,7 +521,7 @@ class MultiCurrency extends CommonObject
* @param integer $date_document Date from document (propal, order, invoice, ...)
*
* @return array [0] => id currency
- * [1] => rate
+ * [1] => rate
*/
public static function getIdAndTxFromCode($db, $code, $date_document = '')
{
@@ -687,12 +687,10 @@ class MultiCurrency extends CommonObject
* @param string $code current code to search
* @return boolean True if exists, false if not exists
*/
- public static function checkCodeAlreadyExists($code)
+ public function checkCodeAlreadyExists($code)
{
- global $db;
-
- $currency = new MultiCurrency($db);
- if ($currency->fetch('', $code) > 0) {
+ $currencytmp = new MultiCurrency($this->db);
+ if ($currencytmp->fetch('', $code) > 0) {
return true;
} else {
return false;
diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php
index db637136cad..2a281931046 100644
--- a/htdocs/partnership/partnership_card.php
+++ b/htdocs/partnership/partnership_card.php
@@ -556,7 +556,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
if ($object->status == $object::STATUS_DRAFT) {
diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php
index 77acafbbd55..9ba8d9cec09 100644
--- a/htdocs/product/ajax/products.php
+++ b/htdocs/product/ajax/products.php
@@ -91,7 +91,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) {
$outtype = $object->type;
$outqty = 1;
$outdiscount = 0;
-
+ $mandatory_period = $object->mandatory_period;
$found = false;
$price_level = 1;
@@ -203,6 +203,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) {
'tva_tx' => $outtva_tx,
'qty' => $outqty,
'discount' => $outdiscount,
+ 'mandatory_period' => $mandatory_period,
'array_options'=>$object->array_options);
}
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index b6820bddddd..80378bd1b2a 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -105,6 +105,7 @@ $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha');
$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha');
+$checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha');
// by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html
$label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml';
@@ -131,7 +132,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
-
+ if ($result < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ }
if (!empty($conf->product->enabled)) {
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
} elseif (!empty($conf->service->enabled)) {
@@ -298,7 +301,7 @@ if (empty($reshook)) {
$object->ref = $ref;
$object->label = GETPOST('label', $label_security_check);
$object->price_base_type = GETPOST('price_base_type', 'aZ09');
-
+ $object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0;
if ($object->price_base_type == 'TTC') {
$object->price_ttc = GETPOST('price');
} else {
@@ -599,7 +602,7 @@ if (empty($reshook)) {
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha');
$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha');
-
+ $checkmandatory = GETPOST('mandatoryperiod', 'alpha');
if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
$object->accountancy_code_sell = '';
} else {
@@ -630,6 +633,11 @@ if (empty($reshook)) {
} else {
$object->accountancy_code_buy_export = $accountancy_code_buy_export;
}
+ if ($object->isService()) {
+ $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ;
+ }
+
+
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@@ -1254,7 +1262,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '
'.$langs->trans("DefaultWarehouse").' ';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse', 'int'), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'minwidth300 widthcentpercentminusxx maxwidth500');
- print ' ';
+ print ' ';
print ' ';
print ' ';
print ' ';
@@ -1284,6 +1292,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ''.$langs->trans("Duration").' ';
print ' ';
print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOSTISSET('duration_value', 'alpha') : 'h'), 0, 1);
+
+ // Mandatory period
+ print ' ';
+ print ' mandatory_period == 1 ? ' checked="checked"' : '').'>';
+ print '';
+ $htmltooltip = $langs->trans("mandatoryHelper");
+ print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0);
+ print ' ';
+
print ' ';
}
@@ -1423,6 +1440,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$defaultva = get_default_tva($mysoc, $mysoc);
print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1);
print '';
+
print '';
print '
';
@@ -1820,6 +1838,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '
'.$langs->trans("Duration").' ';
print ' ';
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
+
+ // Mandatory period
+ print ' ';
+ print ' mandatory_period == 1 ? ' checked="checked"' : '').'>';
+ print '';
+ $htmltooltip = $langs->trans("mandatoryHelper");
+ print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0);
+ print ' ';
+
print ' ';
} else {
if (empty($conf->global->PRODUCT_DISABLE_NATURE)) {
@@ -2301,13 +2328,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($object->isService()) {
// Duration
- print '
'.$langs->trans("Duration").' '.$object->duration_value.' ';
+ print ' '.$langs->trans("Duration").' ';
+ print $object->duration_value;
if ($object->duration_value > 1) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
} elseif ($object->duration_value > 0) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
}
- print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
+ print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : '');
+
+ // Mandatory period
+ if ($object->duration_value > 0) {
+ print ' ';
+ }
+ $htmltooltip = $langs->trans("mandatoryHelper");
+ print ' mandatory_period == 1 ? ' checked="checked"' : '').' disabled>';
+ print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0);
print ' ';
} else {
@@ -2507,14 +2543,14 @@ if ($action != 'create' && $action != 'edit') {
if (empty($reshook)) {
if ($usercancreate) {
if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) {
- print '
id.'">'.$langs->trans("Modify").' ';
+ print '
id.'">'.$langs->trans("Modify").' ';
}
if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) {
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
print '
'.$langs->trans('ToClone').' '."\n";
} else {
- print '
id.'">'.$langs->trans("ToClone").' ';
+ print '
id.'">'.$langs->trans("ToClone").' ';
}
}
}
@@ -2538,8 +2574,9 @@ if ($action != 'create' && $action != 'edit') {
print "\n
\n";
}
+
/*
- * All the "Add to" areas
+ * All the "Add to" areas if PRODUCT_ADD_FORM_ADD_TO is set
*/
if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == '' || $action == 'view') && $object->status) {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index b799113af29..fd5d8ecf1db 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -434,6 +434,13 @@ class Product extends CommonObject
public $is_object_used;
+ /**
+ *
+ *
+ *
+ */
+ public $mandatory_period;
+
/**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
@@ -484,6 +491,8 @@ class Product extends CommonObject
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
//'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
//'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
+ 'mandatory_period' =>array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000),
+
);
/**
@@ -635,7 +644,7 @@ class Product extends CommonObject
// Barcode value
$this->barcode = trim($this->barcode);
-
+ $this->mandatory_period = empty($this->mandatory_period) ? 0 : $this->mandatory_period;
// Check parameters
if (empty($this->label)) {
$this->error = 'ErrorMandatoryParametersNotProvided';
@@ -717,6 +726,7 @@ class Product extends CommonObject
$sql .= ", tobatch";
$sql .= ", batch_mask";
$sql .= ", fk_unit";
+ $sql .= ", mandatory_period";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", ".((int) $conf->entity);
@@ -745,6 +755,7 @@ class Product extends CommonObject
$sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : ((int) $this->status_batch));
$sql .= ", '".$this->db->escape($this->batch_mask)."'";
$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
+ $sql .= ", '".$this->db->escape($this->mandatory_period)."'";
$sql .= ")";
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
@@ -1016,7 +1027,6 @@ class Product extends CommonObject
$this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export);
-
$this->db->begin();
$result = 0;
@@ -1150,7 +1160,7 @@ class Product extends CommonObject
$sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1);
$sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL');
$sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
-
+ $sql .= ", mandatory_period = ".($this->mandatory_period );
// stock field is not here because it is a denormalized value from product_stock.
$sql .= " WHERE rowid = ".((int) $id);
@@ -2253,7 +2263,7 @@ class Product extends CommonObject
$sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,";
$sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,";
$sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,";
- $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom,";
+ $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,";
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
} else {
@@ -2428,6 +2438,8 @@ class Product extends CommonObject
$this->price_autogen = $obj->price_autogen;
$this->model_pdf = $obj->model_pdf;
+ $this->mandatory_period = $obj->mandatory_period;
+
$this->db->free($resql);
// fetch optionals attributes and labels
@@ -5643,6 +5655,16 @@ class Product extends CommonObject
return ($this->type == Product::TYPE_SERVICE ? true : false);
}
+
+ /**
+ * Return if object have a constraint on mandatory_period
+ *
+ * @return boolean True if mandatory_period setted to 1
+ */
+ public function isMandatoryPeriod()
+ {
+ return ($this->mandatory_period == 1 ? true : false);
+ }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get a barcode from the module to generate barcode values.
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index f7f604b5399..9bd361858ba 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -437,6 +437,7 @@ class Productbatch extends CommonObject
public static function findAll($db, $fk_product_stock, $with_qty = 0, $fk_product = 0)
{
global $langs, $conf;
+
$ret = array();
$sql = "SELECT";
diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php
index 784be41dfe9..893cc654f89 100644
--- a/htdocs/product/dynamic_price/editor.php
+++ b/htdocs/product/dynamic_price/editor.php
@@ -204,7 +204,7 @@ print '