From b7a6a71dff921c7bca72fcca7c964fd7b2c0b7a5 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 15 Dec 2016 17:20:46 +0100 Subject: [PATCH] move file to core --- .../inventory.php} | 26 +-- ...ntory.class.php => modInventory.class.php} | 4 +- htdocs/inventory/lib/inventory.lib.php | 161 +----------------- 3 files changed, 15 insertions(+), 176 deletions(-) rename htdocs/{inventory/admin/inventory_setup.php => admin/inventory.php} (84%) rename htdocs/core/modules/{modinventory.class.php => modInventory.class.php} (99%) diff --git a/htdocs/inventory/admin/inventory_setup.php b/htdocs/admin/inventory.php similarity index 84% rename from htdocs/inventory/admin/inventory_setup.php rename to htdocs/admin/inventory.php index f55bc092517..2548494fc79 100644 --- a/htdocs/inventory/admin/inventory_setup.php +++ b/htdocs/admin/inventory.php @@ -23,17 +23,16 @@ * Put some comments here */ // Dolibarr environment -$res = @include("../../main.inc.php"); // From htdocs directory -if (! $res) { - $res = @include("../../../main.inc.php"); // From "custom" directory -} +require '../main.inc.php'; + // Libraries require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once '../lib/inventory.lib.php'; +require_once DOL_DOCUMENT_ROOT .'/inventory/lib/inventory.lib.php'; // Translations -$langs->load("inventory@inventory"); +$langs->load("stock"); +$langs->load("inventory"); // Access control if (! $user->admin) { @@ -104,21 +103,6 @@ print ''.$langs->trans("Parameters").''."\n"; print ' '; print ''.$langs->trans("Value").''."\n"; - -// Example with a yes / no select -$var=!$var; -print ''; -print ''.$langs->trans("INVENTORY_GEN_PDF").''; -print ' '; -print ''; -print '
'; -print ''; -print ''; -print $form->selectyesno("INVENTORY_GEN_PDF",$conf->global->INVENTORY_GEN_PDF,1); -print ''; -print '
'; -print ''; - // Example with a yes / no select $var=!$var; print ''; diff --git a/htdocs/core/modules/modinventory.class.php b/htdocs/core/modules/modInventory.class.php similarity index 99% rename from htdocs/core/modules/modinventory.class.php rename to htdocs/core/modules/modInventory.class.php index 10fb1cc477e..31170375752 100644 --- a/htdocs/core/modules/modinventory.class.php +++ b/htdocs/core/modules/modInventory.class.php @@ -94,7 +94,7 @@ class modinventory extends DolibarrModules $this->dirs = array(); // Config pages. Put here list of php page, stored into inventory/admin directory, to use to setup module. - $this->config_page_url = array("inventory_setup.php@inventory"); + $this->config_page_url = array("inventory.php"); // Dependencies $this->hidden = false; // A condition to hide module @@ -103,7 +103,7 @@ class modinventory extends DolibarrModules $this->conflictwith = array(); // List of modules id this module is in conflict with $this->phpmin = array(5,0); // Minimum version of PHP required by module $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module - $this->langfiles = array("inventory@inventory"); + $this->langfiles = array("inventory"); // Constants // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) diff --git a/htdocs/inventory/lib/inventory.lib.php b/htdocs/inventory/lib/inventory.lib.php index fd60d631a58..3cbf03a67c7 100644 --- a/htdocs/inventory/lib/inventory.lib.php +++ b/htdocs/inventory/lib/inventory.lib.php @@ -32,14 +32,11 @@ function inventoryAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/inventory/admin/inventory_setup.php", 1); + $head[$h][0] = dol_buildpath("/admin/inventory.php", 1); $head[$h][1] = $langs->trans("Parameters"); $head[$h][2] = 'settings'; $h++; - $head[$h][0] = dol_buildpath("/inventory/admin/inventory_about.php", 1); - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line @@ -54,10 +51,12 @@ function inventoryAdminPrepareHead() return $head; } -function inventoryPrepareHead(&$inventory, $title='Inventaire', $get='') +function inventoryPrepareHead(&$inventory, $title='Inventory', $get='') { + global $langs; + return array( - array(dol_buildpath('/inventory/inventory.php?id='.$inventory->id.$get, 1), $title,'inventaire') + array(dol_buildpath('/inventory/inventory.php?id='.$inventory->id.$get, 1), $langs->trans($title),'inventory') ); } @@ -65,7 +64,7 @@ function inventoryPrepareHead(&$inventory, $title='Inventaire', $get='') function inventorySelectProducts(&$inventory) { - global $conf,$db; + global $conf,$db,$langs; $except_product_id = array(); @@ -78,7 +77,6 @@ function inventorySelectProducts(&$inventory) $form = new Form($db); $form->select_produits(-1, 'fk_product'); - // Il nous faut impérativement une liste custom car il ne faut que les entrepôts de la famille de celui qu'on inventorie $TChildWarehouses = array($inventory->fk_warehouse); $e = new Entrepot($db); $e->fetch($inventory->fk_warehouse); @@ -93,153 +91,10 @@ function inventorySelectProducts(&$inventory) $Tab[$res->rowid] = $res->label; } print '   '; - print 'Entrepôt : '.$form::selectarray('fk_warehouse', $Tab); + print $langs->trans('Warehouse').' : '.$form::selectarray('fk_warehouse', $Tab); $select_html = ob_get_clean(); return $select_html; } -function ajaxAutocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) -{ - if (empty($minLength)) $minLength=1; - - $script = ''; - - $script.= ''; - - return $script; -}