';
if ($module == 'medias') {
print $langs->trans("RootOfMedias");
} else {
diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php
index f5140cf296a..4cf557acde6 100644
--- a/htdocs/ecm/dir_add_card.php
+++ b/htdocs/ecm/dir_add_card.php
@@ -23,6 +23,8 @@
* \brief Main page for ECM section area
*/
+if (! defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1);
+
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/htmlecm.form.class.php';
@@ -124,7 +126,7 @@ if ($action == 'add' && $permtoadd) {
}
$ref = (string) GETPOST("ref", 'alpha');
- $label = (string) GETPOST("label", 'alpha');
+ $label = dol_sanitizeFileName(GETPOST("label", 'alpha'));
$desc = (string) GETPOST("desc", 'alpha');
$catParent = GETPOST("catParent", 'alpha'); // Can be an int (with ECM) or a string (with generic filemanager)
if ($catParent == '-1') {
@@ -153,8 +155,7 @@ if ($action == 'add' && $permtoadd) {
setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
$action = 'create';
}
- } else // For example $module == 'medias'
- {
+ } else { // For example $module == 'medias'
$dirfornewdir = '';
if ($module == 'medias') {
$dirfornewdir = $conf->medias->multidir_output[$conf->entity];
@@ -168,6 +169,7 @@ if ($action == 'add' && $permtoadd) {
$fullpathofdir = $dirfornewdir.'/'.($catParent ? $catParent.'/' : '').$label;
$result = dol_mkdir($fullpathofdir, DOL_DATA_ROOT);
if ($result < 0) {
+ $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateDir', $label), null, 'errors');
$error++;
} else {
diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
index b1be94524cf..17c185426c0 100644
--- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
+++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
@@ -62,7 +62,7 @@ $(document).ready(function() {
id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx)
rel=elem.attr('rel')
console.log("We click on a dir, we call the ajaxdirtree.php with modulepart=, param=");
- console.log("We also save dir name or id into _section_... with name section_... id="+id+" rel="+rel);
+ console.log("We also save id and dir name into _section_id|dir (vars into form to attach new file in filemanager.tpl.php) with id="+id+" and rel="+rel);
jQuery("#_section_dir").val(rel);
jQuery("#_section_id").val(id);
jQuery("#section_dir").val(rel);
diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang
index c4ea8018111..bc18bed4a29 100644
--- a/htdocs/langs/en_US/ecm.lang
+++ b/htdocs/langs/en_US/ecm.lang
@@ -42,6 +42,6 @@ ExtraFieldsEcmFiles=Extrafields Ecm Files
ExtraFieldsEcmDirectories=Extrafields Ecm Directories
ECMSetup=ECM Setup
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 and its subfolder...
+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
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index de0ab6a15d9..b6d2e4c4ef8 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1131,3 +1131,4 @@ ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected
CategTypeNotFound=No tag type found for type of records
CopiedToClipboard=Copied to clipboard
InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration.
+ConfirmCancel=Are you sure you want to cancel
\ No newline at end of file
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 0e13a072a39..4231160b64f 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1579,7 +1579,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print ''."\n";
}
// Chart
- if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'chart') {
+ if ((empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'chart') && !defined('DISABLE_JS_GRAPH')) {
print ''."\n";
}
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index dda16746398..6a29a414ed7 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -398,35 +398,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
- print 'id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').''."\n";
+ print '
id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle">'.$langs->trans('SendMail').''."\n";
}
// Back to draft
if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) {
- print '
'.$langs->trans("SetToDraft").'';
+ print '
'.$langs->trans("SetToDraft").'';
}
}
// Back to validate
if ($object->status == $object::STATUS_RECORDED) {
if ($permissiontoadd) {
- print '
'.$langs->trans("ReOpen").'';
+ print '
'.$langs->trans("ReOpen").'';
}
}
// 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";
}
}
// Validate
- if ($object->status == $object::STATUS_DRAFT) {
+ if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_CANCELED) {
if ($permissiontoadd) {
- print '
'.$langs->trans("Validate").' ('.$langs->trans("Start").')';
+ print '
'.$langs->trans("Validate").' ('.$langs->trans("Start").')';
}
}
@@ -438,7 +438,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Delete (need delete permission, or if draft, just need create/modify permission)
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) {
- print '
id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
+ print '
id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
} else {
print '
'.$langs->trans('Delete').''."\n";
}
diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php
index 064be57091a..126fff5b96b 100644
--- a/htdocs/product/inventory/class/inventory.class.php
+++ b/htdocs/product/inventory/class/inventory.class.php
@@ -619,7 +619,12 @@ class Inventory extends CommonObject
$labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled');
$labelStatusShort[self::STATUS_RECORDED] = $langs->trans('Closed');
- return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', 'status'.$status, $mode);
+ $statusType = 'status'.$status;
+ if ($status == self::STATUS_RECORDED) {
+ $statusType = 'status5';
+ }
+
+ return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index bc927a06c50..ecad54a4a73 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -160,27 +160,55 @@ if ($action == 'update' && $user->rights->stock->mouvement->creer) {
}
}
-if ($action =='updateinventorylines' && $permissiontoadd) {
+if (($action == 'record' || $action =='updateinventorylines') && $permissiontoadd) {
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.$object->id;
+ $db->begin();
+
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$totalarray = array();
+ $inventoryline = new InventoryLine($db);
+
while ($i < $num) {
$line = $db->fetch_object($resql);
$lineid = $line->rowid;
- $inventoryline = new InventoryLine($db);
- $inventoryline->fetch($lineid);
- $inventoryline->qty_view = GETPOST("id_".$inventoryline->id);
- $inventoryline->update($user);
+
+ if (GETPOST("id_".$lineid, 'alpha') != '') { // If a value was set ('0' or something else)
+ $qtytoupdate = price2num(GETPOST("id_".$lineid, 'alpha'), 'MS');
+
+ $result = $inventoryline->fetch($lineid);
+ if ($result > 0) {
+ $inventoryline->qty_view = $qtytoupdate;
+ $resultupdate = $inventoryline->update($user);
+ }
+ } else {
+ // Delete record
+ $result = $inventoryline->fetch($lineid);
+ if ($result > 0) {
+ $inventoryline->qty_view = null;
+ $resultupdate = $inventoryline->update($user);
+ }
+ }
+
+ if ($result < 0 || $resultupdate < 0) {
+ $error++;
+ }
+
$i++;
}
}
+
+ if (!$error) {
+ $db->commit();
+ } else {
+ $db->rollback();
+ }
}
$parameters = array();
@@ -242,6 +270,7 @@ if (empty($reshook)) {
$tmp->fk_product = $fk_product;
$tmp->batch = $batch;
$tmp->datec = $now;
+ $tmp->qty_view = (GETPOST('qtytoadd') != '' ? price2num(GETPOST('qtytoadd', 'MS')) : null);
$result = $tmp->create($user);
if ($result < 0) {
@@ -270,6 +299,23 @@ $help_url = '';
llxHeader('', $langs->trans('Inventory'), $help_url);
+// Disable button Generate movement if data were not saved
+print '';
+
+
// Part to show record
if ($object->id > 0) {
$res = $object->fetch_optionals();
@@ -411,7 +457,7 @@ if ($object->id > 0) {
if (empty($reshook)) {
if ($object->status == Inventory::STATUS_DRAFT) {
if ($permissiontoadd) {
- print '
id.'&action=confirm_validate&confirm=yes">'.$langs->trans("Validate").' ('.$langs->trans("Start").')'."\n";
+ print '
id.'&action=confirm_validate&confirm=yes&token='.newToken().'">'.$langs->trans("Validate").' ('.$langs->trans("Start").')'."\n";
} else {
print '
'.$langs->trans('Validate').' ('.$langs->trans("Start").')'."\n";
}
@@ -419,16 +465,14 @@ if ($object->id > 0) {
// Save
if ($object->status == $object::STATUS_VALIDATED) {
- if ($object->status == Inventory::STATUS_VALIDATED) {
- if ($permissiontoadd) {
- print '
id.'&action=record">'.$langs->trans("MakeMovementsAndClose").''."\n";
- } else {
- print '
'.$langs->trans('MakeMovementsAndClose').''."\n";
- }
+ if ($permissiontoadd) {
+ print '
id.'&action=record&token='.newToken().'">'.$langs->trans("MakeMovementsAndClose").''."\n";
+ } else {
+ print '
'.$langs->trans('MakeMovementsAndClose').''."\n";
}
if ($permissiontoadd) {
- print '
id.'&action=confirm_cancel">'.$langs->trans("Cancel").''."\n";
+ print '
id.'&action=confirm_cancel&token='.newToken().'">'.$langs->trans("Cancel").''."\n";
}
}
}
@@ -458,14 +502,17 @@ if ($object->id > 0) {
print '';
}
@@ -553,11 +600,11 @@ if ($object->id > 0) {
}
print '
| ';
print '
';
- print '';
- //print '';
+ print '';
print ' | ';
// Actions
print '
';
+ print '';
print ' | ';
print '