From aa08e3276140499836516baf59feb7ac172cef5b Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 04:48:59 +0100 Subject: [PATCH 1/4] Add links and related documents for a stock movement @eldy you can clone in movement_card.php if you prefer this structure --- htdocs/product/stock/movement_list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 68ad4d9678970..ce77f120db486 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -403,12 +403,12 @@ /* * Build document */ -/* The builddoc action for object of a movement must be on the movement card +// The builddoc action for object of a movement must be on the movement card // Actions to build doc -$upload_dir = $conf->stock->dir_output; +$upload_dir = $conf->stock->dir_output . "movement/"; $permissioncreate = $user->rights->stock->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; -*/ + if (empty($reshook) && $action != 'remove_file') { @@ -416,7 +416,7 @@ $objectlabel='Movements'; $permtoread = $user->rights->stock->lire; $permtodelete = $user->rights->stock->supprimer; - $uploaddir = $conf->stock->dir_output; + $uploaddir = $conf->stock->dir_output . "/movement/"; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -1145,8 +1145,8 @@ /* * Documents generes */ -/* Area for doc and last events of warehouse are stored on the main card of warehouse -$modulepart='mouvement'; +//Area for doc and last events of warehouse are stored on the main card of warehouse +$modulepart='movement'; if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) { @@ -1183,11 +1183,11 @@ // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product + $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product print ''; } -*/ + // End of page llxFooter(); From 49ccdb96027960ad4f583ddf10cc403c35ba9b13 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 05:06:02 +0100 Subject: [PATCH 2/4] Update movement_list.php For it to work you have to create this script htdocs\core\modules\stock\doc\pdf_stdmouvement.modules.php instead htdocs\core\modules\stock\doc\pdf_stdmovement.modules.php this mixture of fr/en confused me and I'm sure you better control the structure to make it work properly it tested & works but with htdocs\core\modules\stock\doc\pdf_stdmouvement.modules.php thx --- htdocs/product/stock/movement_list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ce77f120db486..4435ea98f42c9 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1160,14 +1160,14 @@ if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; if($search_type_mouvement) $objectref.="_".$search_type_mouvement; $relativepath = $comref . '/' . $objectref . '.pdf'; - $filedir = $conf->stock->dir_output . '/movement/' . $objectref; + $filedir = $conf->stock->dir_output . '/' . $modulepart .'/' . $objectref; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement"; $genallowed=$usercanread; $delallowed=$usercancreate; - $genallowed=$user->rights->stock->mouvement->lire; - $delallowed=$user->rights->stock->mouvement->creer; + $genallowed=$user->rights->stock->lire; + $delallowed=$user->rights->stock->creer; print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); $somethingshown=$formfile->numoffiles; @@ -1183,7 +1183,7 @@ // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product + $somethingshown = $formactions->showactions($object, $modulepart, 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product print ''; } From 8546c801a568b73021fa182baf5536b62151845e Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 05:17:09 +0100 Subject: [PATCH 3/4] to make it work with movement_card.php --- htdocs/product/stock/movement_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 4435ea98f42c9..b790226cc613d 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1031,7 +1031,7 @@ { // Inventory code print ''.'rights->stock->creer; -include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - - -if (empty($reshook) && $action != 'remove_file') -{ - $objectclass='MouvementStock'; - $objectlabel='Movements'; - $permtoread = $user->rights->stock->lire; - $permtodelete = $user->rights->stock->supprimer; - $uploaddir = $conf->stock->dir_output . "/movement/"; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; -} - - - /* * View */ @@ -1141,54 +1119,6 @@ } - -/* - * Documents generes - */ -//Area for doc and last events of warehouse are stored on the main card of warehouse -$modulepart='movement'; - -if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) -{ - print '
'; - print '
'; - print ''; // ancre - - // Documents - $objectref = dol_sanitizeFileName($object->ref); - // Add inventorycode & type_mouvement to filename of the pdf - if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; - if($search_type_mouvement) $objectref.="_".$search_type_mouvement; - $relativepath = $comref . '/' . $objectref . '.pdf'; - $filedir = $conf->stock->dir_output . '/' . $modulepart .'/' . $objectref; - - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement"; - $genallowed=$usercanread; - $delallowed=$usercancreate; - - $genallowed=$user->rights->stock->lire; - $delallowed=$user->rights->stock->creer; - - print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); - $somethingshown=$formfile->numoffiles; - - print '
'; - - $MAXEVENT = 10; - - $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $modulepart, 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product - - print '
'; -} - - // End of page llxFooter(); $db->close();