function plugin_init_racks() { global $PLUGIN_HOOKS, $CFG_GLPI; $PLUGIN_HOOKS['csrf_compliant']['racks'] = true; $PLUGIN_HOOKS['change_profile']['racks'] = array('PluginRacksProfile', 'changeProfile'); if (class_exists('PluginRacksRack')) { // only if plugin activated $PLUGIN_HOOKS['pre_item_purge']['racks'] = array('Profile' => array('PluginRacksProfile', 'purgeProfiles')); } Plugin::registerClass('PluginRacksRack', array('document_types' => true, 'unicity_types' => true, 'linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'infocom_types' => true)); Plugin::registerClass('PluginRacksProfile', array('addtabon' => 'Profile')); if (class_exists('PluginAppliancesAppliance')) { PluginAppliancesAppliance::registerType('PluginRacksRack'); } if (class_exists('PluginManufacturersimportsConfig')) { PluginManufacturersimportsConfig::registerType('PluginRacksRack'); } if (class_exists('PluginTreeviewConfig')) { PluginTreeviewConfig::registerType('PluginRacksRack'); $PLUGIN_HOOKS['treeview']['PluginRacksRack'] = '../racks/pics/racks.png'; } if (class_exists('PluginPositionsPosition')) { PluginPositionsPosition::registerType('PluginRacksRack'); } if (Session::getLoginUserID()) { // Display a menu entry ? if (plugin_racks_haveRight("racks", "r")) { $PLUGIN_HOOKS['menu_entry']['racks'] = 'front/rack.php'; $PLUGIN_HOOKS['submenu_entry']['racks']['search'] = 'front/rack.php'; $PLUGIN_HOOKS['submenu_entry']['racks']['add'] = 'front/setup.templates.php?add=1'; } if (plugin_racks_haveRight("model", "r")) { $PLUGIN_HOOKS['submenu_entry']['racks']['template'] = 'front/setup.templates.php?add=0'; $PLUGIN_HOOKS['submenu_entry']['racks']["<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' title=\"" . __('Equipments models specifications', 'racks') . "\" alt=\"" . __('Equipments models specifications', 'racks') . "\">"] = 'front/itemspecification.php'; } if (plugin_racks_haveRight("racks", "r")) { $PLUGIN_HOOKS['submenu_entry']['racks']['config'] = 'front/config.form.php'; $PLUGIN_HOOKS['use_massive_action']['racks'] = 1; } // Config page if (plugin_racks_haveRight("racks", "w") || Session::haveRight("config", "w")) { $PLUGIN_HOOKS['config_page']['racks'] = 'front/config.form.php'; } // Add specific files to add to the header : javascript or css //$PLUGIN_HOOKS['add_javascript']['example']="example.js"; $PLUGIN_HOOKS['add_css']['racks'] = "racks.css"; $PLUGIN_HOOKS['post_init']['racks'] = 'plugin_racks_postinit'; $PLUGIN_HOOKS['reports']['racks'] = array('front/report.php' => __("Report - Bays management", "racks")); } }
static function getMenuContent() { $plugin_page = "/plugins/manufacturersimports/front/import.php"; $menu = array(); //Menu entry in tools $menu['title'] = self::getMenuName(); $menu['page'] = $plugin_page; $menu['links']['search'] = $plugin_page; if (Session::haveRight(static::$rightname, UPDATE) || Session::haveRight("config", UPDATE)) { //Entry icon in breadcrumb $menu['links']['config'] = PluginManufacturersimportsConfig::getSearchURL(false); //Link to config page in admin plugins list $menu['config_page'] = PluginManufacturersimportsConfig::getSearchURL(false); //Add a fourth level in breadcrumb for configuration page $menu['options']['config']['title'] = __('Setup'); $menu['options']['config']['page'] = PluginManufacturersimportsConfig::getSearchURL(false); $menu['options']['config']['links']['search'] = PluginManufacturersimportsConfig::getSearchURL(false); $menu['options']['config']['links']['add'] = PluginManufacturersimportsConfig::getFormURL(false); } return $menu; }
/** * Prints display post import * * @param $type the type of device * @param $ID the ID of device * @param $fromsupplier selection on pre import * @param $fromwarranty selection on pre import * @param $configID ID of supplier plugin config * @return results of data import * */ static function seePostImport($type, $ID, $fromsupplier, $fromwarranty, $configID) { global $DB, $CFG_GLPI; $config = new PluginManufacturersimportsConfig(); $config->GetFromDB($configID); $manufacturerId = $config->fields["manufacturers_id"]; if ($fromsupplier) { $supplierId = $fromsupplier; } else { $supplierId = $config->fields["suppliers_id"]; } $suppliername = $config->fields["name"]; $adddoc = $config->fields["document_adding"]; $rubrique = $config->fields["documentcategories_id"]; $addcomments = $config->fields["comment_adding"]; if ($fromwarranty) { $warranty = $fromwarranty; } else { $warranty = $config->fields["warranty_duration"]; } $itemtable = getTableForItemType($type); $query = "SELECT `" . $itemtable . "`.`id`,\n `" . $itemtable . "`.`name`,\n `" . $itemtable . "`.`entities_id`,\n `" . $itemtable . "`.`serial`\n FROM `" . $itemtable . "`, `glpi_manufacturers`\n WHERE `" . $itemtable . "`.`manufacturers_id` = `glpi_manufacturers`.`id`\n AND `" . $itemtable . "`.`is_deleted` = '0'\n AND `" . $itemtable . "`.`is_template` = '0'\n AND `glpi_manufacturers`.`id` = '" . $manufacturerId . "'\n AND `" . $itemtable . "`.`serial` != ''\n AND `" . $itemtable . "`.`id` = '" . $ID . "' "; $query .= " ORDER BY `" . $itemtable . "`.`name`"; $result = $DB->query($query); while ($line = $DB->fetch_array($result)) { $compSerial = $line['serial']; $ID = $line['id']; echo "<tr class='tab_bg_1' ><td>"; $link = Toolbox::getItemTypeFormURL($type); $dID = ""; $model = new PluginManufacturersimportsModel(); $otherSerial = $model->checkIfModelNeeds($type, $ID); if ($_SESSION["glpiis_ids_visible"] || empty($line["name"])) { $dID .= " (" . $line["id"] . ")"; } echo "<a href='" . $link . "?id=" . $ID . "'>" . $line["name"] . $dID . "</a><br>" . $otherSerial . "</td>"; $url = PluginManufacturersimportsPreImport::selectSupplier($suppliername, $compSerial, $otherSerial); //On complete l url du support du fournisseur avec le serial echo "<td>" . $compSerial . "</td>"; echo "<td>"; echo "<a href='" . $url . "' target='_blank'>" . _n('Manufacturer', 'Manufacturers', 1) . "</a>"; echo "</td>"; $contents = ""; $msgerr = ""; $options = array("url" => $url, "download" => false, "file" => false, "suppliername" => $suppliername); $contents = self::cURLData($options); // On extrait la date de garantie de la variable contents. $field = self::selectSupplierfield($suppliername); if ($suppliername == "Dell" || $suppliername != "Dell" && !stristr($contents, $field) === FALSE) { if ($suppliername != "Dell") { $finduhtml = stristr($contents, $field); } else { $finduhtml = $compSerial; $contents = $compSerial; } $maDate = self::importDate($suppliername, $finduhtml); $warranty = self::importWarranty($suppliername, $maDate, $contents, $warranty); if ($maDate != "0000-00-00") { //warranty for life if ($warranty > 120) { $warranty = -1; } $date = date("Y-m-d"); $options = array("itemtype" => $type, "ID" => $ID, "date" => $date, "supplierId" => $supplierId, "warranty" => $warranty, "suppliername" => $suppliername, "addcomments" => $addcomments, "maDate" => $maDate); self::saveInfocoms($options); // on cree un doc dans GLPI qu'on va lier au materiel if ($adddoc != 0 && $suppliername != "Dell") { $options = array("itemtype" => $type, "ID" => $ID, "url" => $url, "entities_id" => $line["entities_id"], "rubrique" => $rubrique, "suppliername" => $suppliername); $values["documents_id"] = self::addDocument($options); } //insert base locale $values["import_status"] = 1; $values["items_id"] = $ID; $values["itemtype"] = $type; $values["date_import"] = $date; $log = new PluginManufacturersimportsLog(); $log->add($values); $_SESSION["glpi_plugin_manufacturersimports_total"] += 1; } else { // Failed check date self::isInError($type, $ID, $contents); } } else { // Failed checj contents self::isInError($type, $ID); } echo "</tr>\n"; } }
GLPI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: Julien Dombre // Purpose of file: // ---------------------------------------------------------------------- if (strpos($_SERVER['PHP_SELF'], "dropdownSuppliers.php")) { include '../../../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); } if (!defined('GLPI_ROOT')) { die("Can not acces directly to this file"); } $config = new PluginManufacturersimportsConfig(); if ($_POST['supplier'] != -1) { echo " <a href='" . $config->getFormURL() . "?preconfig=" . $_POST['supplier'] . "'>" . _sx('button', 'Update') . "</a>"; }
/** * Prints the model add form (into devices) * * @param $device the device ID * @param $type the device type * @return nothing (print out a table) * */ static function showForm($itemtype, $items_id) { global $DB, $CFG_GLPI; $canedit = Session::haveRight(static::$rightname, UPDATE); $query = "SELECT *\n FROM `glpi_plugin_manufacturersimports_models`\n WHERE `itemtype` = '" . $itemtype . "'\n AND `items_id` = '" . $items_id . "'"; $result = $DB->query($query); $number = $DB->numrows($result); $config_url = PluginManufacturersimportsConfig::getFormUrl(true); echo "<form method='post' action='" . $config_url . "'>"; echo "<div align='center'><table class='tab_cadre_fixe' cellspacing='2' cellpadding='2'>"; echo "<tr>"; echo "<th>" . PluginManufacturersimportsPreImport::getTypeName(2) . "</th>"; echo "<th>" . __('Model Number', 'manufacturersimports') . "</th>"; echo "</tr>"; if ($number == 1) { while ($line = $DB->fetch_array($result)) { $ID = $line["id"]; echo "<tr class='tab_bg_2'>"; echo "<td class='left'>"; echo "<input type='text' name='model_name' size='30' value='" . $line["model_name"] . "'>"; echo "</td>"; if ($canedit) { echo "<td class='center' class='tab_bg_2'>"; Html::showSimpleForm($config_url, 'delete_model', _x('button', 'Delete permanently'), array('id' => $ID)); echo "</td>"; } else { echo "<td>"; echo "</td>"; } echo "</tr>"; } } else { if ($canedit) { echo "<tr>"; echo "<th colspan='2'>"; echo "<input type='text' name='model_name' size='30'>"; echo Html::hidden('items_id', array('value' => $items_id)); echo Html::hidden('itemtype', array('value' => $itemtype)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update_model')); echo "</th></tr>"; } } echo "</table></div>"; Html::closeForm(); }
/** * Prints the url to manufacturer informations on items * * @param $device the device ID * @param $type the device type * @return nothing (print out a table) * */ static function showInformationsForm($itemtype, $items_id) { global $DB, $CFG_GLPI; $item = new $itemtype(); if ($item->getFromDB($items_id)) { $suppliername = PluginManufacturersimportsConfig::checkManufacturerName($itemtype, $items_id); $model = new PluginManufacturersimportsModel(); $otherserial = $model->checkIfModelNeeds($itemtype, $items_id); $url = PluginManufacturersimportsPreImport::selectSupplier($suppliername, $item->fields['serial'], $otherserial); echo "<div align=\"center\"><table class=\"tab_cadre_fixe\" cellspacing=\"2\" cellpadding=\"2\">"; echo "<tr>"; echo "<th colspan='2'>" . PluginManufacturersimportsPreImport::getTypeName(2) . "</th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo _n('Link', 'Links', 1); echo "</td>"; echo "<td>"; echo "<a href='" . $url . "' target='_blank'>" . __('Manufacturer information', 'manufacturersimports') . "</a>"; echo "</td></tr>"; echo "</table></div>"; } }
function plugin_manufacturersimports_MassiveActions($type) { if (in_array($type, PluginManufacturersimportsConfig::getTypes(true))) { return array('PluginManufacturersimportsModel' . MassiveAction::CLASS_ACTION_SEPARATOR . "add_model" => __('Add new material brand number', 'manufacturersimports')); } return array(); }
/** * Prints display pre import * * @param $type the type of device * @param $configID the ID of the supplier config * @param $start for pager display * @param $complete to see all device (already imported and not) * @return nothing (print out a table) * */ static function seePreImport($params) { global $DB, $CFG_GLPI; // Default values of parameters $p['link'] = array(); $p['field'] = array(); $p['contains'] = array(); $p['searchtype'] = array(); $p['sort'] = '1'; $p['order'] = 'ASC'; $p['start'] = 0; $p['export_all'] = 0; $p['link2'] = ''; $p['contains2'] = ''; $p['field2'] = ''; $p['itemtype2'] = ''; $p['searchtype2'] = ''; $p['itemtype'] = ''; $p['manufacturers_id'] = ''; $p['imported'] = ''; foreach ($params as $key => $val) { $p[$key] = $val; } $globallinkto = self::getArrayUrlLink("field", $p['field']) . self::getArrayUrlLink("link", $p['link']) . self::getArrayUrlLink("contains", $p['contains']) . self::getArrayUrlLink("searchtype", $p['searchtype']) . self::getArrayUrlLink("field2", $p['field2']) . self::getArrayUrlLink("contains2", $p['contains2']) . self::getArrayUrlLink("searchtype2", $p['searchtype2']) . self::getArrayUrlLink("itemtype2", $p['itemtype2']) . self::getArrayUrlLink("link2", $p['link2']); $modeltable = ""; $target = $CFG_GLPI["root_doc"] . "/plugins/manufacturersimports/front/import.php"; if ($p['itemtype'] && $p['manufacturers_id']) { $config = new PluginManufacturersimportsConfig(); $config->getFromDB($p['manufacturers_id']); $suppliername = $config->fields["name"]; $supplierclass = "PluginManufacturersimports" . $suppliername; $supplier = new $supplierclass(); $infocom = new Infocom(); $canedit = Session::haveRight(static::$rightname, UPDATE) && $infocom->canUpdate(); if (!$p['start']) { $p['start'] = 0; } $modeltable = getTableForItemType($p['itemtype'] . "Model"); $modelfield = getForeignKeyFieldForTable(getTableForItemType($p['itemtype'] . "Model")); $item = new $p['itemtype'](); $itemtable = getTableForItemType($p['itemtype']); $query = "SELECT `" . $itemtable . "`.`id`,\n `" . $itemtable . "`.`name`, \n `" . $itemtable . "`.`serial`,\n `" . $itemtable . "`.`entities_id`,\n `glpi_plugin_manufacturersimports_logs`.`import_status`,\n `glpi_plugin_manufacturersimports_logs`.`items_id`,\n `glpi_plugin_manufacturersimports_logs`.`itemtype`, \n `glpi_plugin_manufacturersimports_logs`.`documents_id`,\n `glpi_plugin_manufacturersimports_logs`.`date_import`, \n '" . $p['itemtype'] . "' AS type,\n `{$modeltable}`.`name` AS model_name\n FROM `" . $itemtable . "` "; //model device left join $query .= "LEFT JOIN `{$modeltable}` ON (`{$modeltable}`.`id` = `" . $itemtable . "`.`" . $modelfield . "`) "; $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `" . $itemtable . "`.`entities_id`)"; $query .= " LEFT JOIN `glpi_plugin_manufacturersimports_configs` \n ON (`glpi_plugin_manufacturersimports_configs`.`manufacturers_id` = `" . $itemtable . "`.`manufacturers_id`)"; $query .= " LEFT JOIN `glpi_plugin_manufacturersimports_logs` \n ON (`glpi_plugin_manufacturersimports_logs`.`items_id` = `" . $itemtable . "`.`id` \n AND `glpi_plugin_manufacturersimports_logs`.`itemtype` = '" . $p['itemtype'] . "')"; $query .= " LEFT JOIN `glpi_plugin_manufacturersimports_models` \n ON (`glpi_plugin_manufacturersimports_models`.`items_id` = `" . $itemtable . "`.`id` \n AND `glpi_plugin_manufacturersimports_models`.`itemtype` = '" . $p['itemtype'] . "')"; //serial must be not empty $query .= " WHERE `" . $itemtable . "`.`is_deleted` = '0'\n AND `" . $itemtable . "`.`is_template` = '0'\n AND `glpi_plugin_manufacturersimports_configs`.`id` = '" . $p['manufacturers_id'] . "'\n AND `" . $itemtable . "`.`serial` != '' "; //already imported if ($p['imported'] == self::IMPORTED) { $query .= " AND `import_status` != " . self::IMPORTED . ""; //not imported } else { if ($p['imported'] == self::NOT_IMPORTED) { $query .= " AND (`date_import` IS NULL OR `import_status` = " . self::IMPORTED . " "; $query .= ") "; } } $entities = ""; if ($config->isRecursive()) { $entities = getSonsOf('glpi_entities', $config->getEntityID()); } else { $entities = $config->getEntityID(); } $query .= "" . getEntitiesRestrictRequest(" AND", $itemtable, '', '', $item->maybeRecursive()); //// 4 - ORDER $ORDER = " ORDER BY `entities_id`,`" . $itemtable . "`.`name` "; $toview = array("name" => 1); foreach ($toview as $key => $val) { if ($p['sort'] == $val) { $ORDER = self::addOrderBy($p['itemtype'], $p['sort'], $p['order'], $key); } } $query .= $ORDER; $result = $DB->query($query); $numrows = $DB->numrows($result); if ($p['start'] < $numrows) { // Set display type for export if define $output_type = Search::HTML_OUTPUT; if (isset($_GET["display_type"])) { $output_type = $_GET["display_type"]; } $parameters = "itemtype=" . $p['itemtype'] . "&manufacturers_id=" . $p['manufacturers_id'] . "&imported=" . $p['imported']; $total = 0; if ($output_type == Search::HTML_OUTPUT) { self::printPager($p['start'], $numrows, $target, $parameters, $p['itemtype']); } // Define begin and end var for loop // Search case $begin_display = $p['start']; $end_display = $p['start'] + $_SESSION["glpilist_limit"]; // Export All case if (isset($_GET['export_all'])) { $begin_display = 0; $end_display = $numrows; } if (Session::isMultiEntitiesMode()) { $colsup = 1; } else { $colsup = 0; } //////////////////////HEADER/////////////// if ($output_type == Search::HTML_OUTPUT) { echo "<form method='post' name='massiveaction_form' id='massiveaction_form' action=\"../ajax/massiveaction.php\">"; } //echo Search::displaySearchHeader($output_type,0); //table + div if ($canedit) { $nbcols = 11 + $colsup; } else { $nbcols = 10 + $colsup; } $LIST_LIMIT = $_SESSION['glpilist_limit']; $begin_display = $p['start']; $end_display = $p['start'] + $LIST_LIMIT; foreach ($toview as $key => $val) { $linkto = ''; if (!isset($searchopt["PluginManufacturersimportsPreImport"][$val]['nosort']) || !$searchopt["PluginManufacturersimportsPreImport"][$val]['nosort']) { $linkto = "{$target}?itemtype=" . $p['itemtype'] . "&manufacturers_id=" . $p['manufacturers_id'] . "&imported=" . $p['imported'] . "&sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto; } } echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols); echo Search::showNewLine($output_type); $header_num = 1; echo Search::showHeaderItem($output_type, "", $header_num); echo Search::showHeaderItem($output_type, __('Name'), $header_num, $linkto, $p['sort'] == $val, $p['order']); if (Session::isMultiEntitiesMode()) { echo Search::showHeaderItem($output_type, __('Entity'), $header_num); } echo Search::showHeaderItem($output_type, __('Serial number'), $header_num); echo $supplier->showItemTitle($output_type, $header_num); echo Search::showHeaderItem($output_type, __('Financial and administrative information'), $header_num); echo Search::showHeaderItem($output_type, __('Supplier attached', 'manufacturersimports'), $header_num); echo Search::showHeaderItem($output_type, __('New warranty attached', 'manufacturersimports'), $header_num); echo Search::showHeaderItem($output_type, _n('Link', 'Links', 1), $header_num); echo Search::showHeaderItem($output_type, _n('Status', 'Statuses', 1), $header_num); echo $supplier->showDocTitle($output_type, $header_num); // End Line for column headers echo Search::showEndLine($output_type); $i = $p['start']; if (isset($_GET['export_all'])) { $i = 0; } if ($i > 0) { $DB->data_seek($result, $i); } $row_num = 1; while ($i < $numrows && $i < $end_display) { $i++; $item_num = 1; $line = $DB->fetch_array($result); $compSerial = $line['serial']; $compId = $line['id']; $model = $line["model_name"]; if (!$line["itemtype"]) { $line["itemtype"] = $p['itemtype']; } self::showImport($row_num, $item_num, $line, $output_type, $p['manufacturers_id'], $line["import_status"], $p['imported']); //1.show already imported items && import_status not failed if ($p['imported'] == 1) { $total += 1; } } echo "<tr class='tab_bg_1'><td colspan='" . ($canedit ? 11 + $colsup : 10 + $colsup) . "'>"; echo sprintf(__('Total number of devices to import %s', 'manufacturersimports'), $total); echo "</td></tr>"; // Close Table $title = ""; // Create title if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) { $title .= PluginManufacturersimportsPreImport::getTypeName(2) . " " . $suppliername; } echo Search::showFooter($output_type, $title); //massive action if ($canedit && $output_type == Search::HTML_OUTPUT) { if ($_SESSION['glpilist_limit'] < Toolbox::get_max_input_vars()) { Html::openArrowMassives("massiveaction_form", false); self::dropdownMassiveAction($compId, $p['itemtype'], $p['manufacturers_id'], $p['start'], $p['imported']); Html::closeArrowMassives(array()); } else { echo "<table class='tab_cadre' width='80%'><tr class='tab_bg_1'>" . "<td><span class='b'>"; echo __('Selection too large, massive action disabled.') . "</span>"; if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) { echo "<br>" . __('To increase the limit: change max_input_vars or suhosin.post.max_vars in php configuration.'); } echo "</td></tr></table>"; } Html::closeForm(); } else { echo "</table>"; echo "</div>"; } echo "<br>"; if ($output_type == Search::HTML_OUTPUT) { self::printPager($p['start'], $numrows, $target, $parameters, $p['itemtype']); } } else { echo "<div align='center'><b>" . __('No device finded', 'manufacturersimports') . "</b></div>"; } } }
function plugin_manufacturersimports_MassiveActionsDisplay($options = array()) { if (in_array($options['itemtype'], PluginManufacturersimportsConfig::getTypes(true))) { echo "<input type=\"text\" name=\"model_name\"> "; echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . __s('Post') . "' >"; } return ""; }
(at your option) any later version. Manufacturersimports is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Manufacturersimports. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include '../../../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); $log = new PluginManufacturersimportsLog(); $config = new PluginManufacturersimportsConfig(); Html::header(_n('Suppliers import', 'Suppliers imports', 2, 'manufacturersimports'), $_SERVER['PHP_SELF'], "plugins", "manufacturersimports"); $config->checkGlobal("r"); if (isset($_POST["action"]) && isset($_POST["id"]) && isset($_POST["item"]) && count($_POST["item"])) { switch ($_POST["action"]) { case "import": PluginManufacturersimportsPostImport::massiveimport($_POST); break; case "reinit_once": foreach ($_POST["item"] as $key => $val) { if ($val == 1) { $log->reinitializeImport($_POST["itemtype"], $key); } } Session::addMessageAfterRedirect(__('Operation successful')); Html::redirect($_SERVER['HTTP_REFERER'] . "?itemtype=" . $_POST["itemtype"] . "&manufacturers_id=" . $_POST["manufacturers_id"] . "&start=" . $_POST["start"] . "&imported=" . $_POST["imported"]);
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Manufacturersimports. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include '../../../inc/includes.php'; if (!isset($_GET["id"])) { $_GET["id"] = 0; } if (!isset($_GET["preconfig"])) { $_GET["preconfig"] = -1; } $config = new PluginManufacturersimportsConfig(); $model = new PluginManufacturersimportsModel(); if (isset($_POST["add"])) { Session::checkRight("plugin_manufacturersimports", CREATE); $config->add($_POST); Html::back(); } else { if (isset($_POST["update"])) { Session::checkRight("plugin_manufacturersimports", UPDATE); $config->update($_POST); Html::back(); } else { if (isset($_POST["delete"])) { Session::checkRight("plugin_manufacturersimports", PURGE); $config->delete($_POST, true); Html::redirect("./config.form.php");
(at your option) any later version. Manufacturersimports is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Manufacturersimports. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include '../../../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); $log = new PluginManufacturersimportsLog(); $config = new PluginManufacturersimportsConfig(); Html::header(_n('Suppliers import', 'Suppliers imports', 2, 'manufacturersimports'), $_SERVER['PHP_SELF'], "tools", "pluginmanufacturersimportsmenu"); $config->checkGlobal(UPDATE); if (isset($_POST["action"]) && isset($_POST["id"]) && isset($_POST["item"]) && count($_POST["item"])) { switch ($_POST["action"]) { case "import": PluginManufacturersimportsPostImport::massiveimport($_POST); break; case "reinit_once": foreach ($_POST["item"] as $key => $val) { if ($val == 1) { $log->reinitializeImport($_POST["itemtype"], $key); } } Session::addMessageAfterRedirect(__('Operation successful')); Html::redirect($_SERVER['HTTP_REFERER'] . "?itemtype=" . $_POST["itemtype"] . "&manufacturers_id=" . $_POST["manufacturers_id"] . "&start=" . $_POST["start"] . "&imported=" . $_POST["imported"]);
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Manufacturersimports. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include '../../../inc/includes.php'; if (!isset($_GET["id"])) { $_GET["id"] = 0; } if (!isset($_GET["preconfig"])) { $_GET["preconfig"] = -1; } $config = new PluginManufacturersimportsConfig(); $model = new PluginManufacturersimportsModel(); if (isset($_POST["add"])) { Session::checkRight("config", "w"); $newID = $config->add($_POST); Html::back(); } else { if (isset($_POST["update"])) { Session::checkRight("config", "w"); $config->update($_POST); Html::back(); } else { if (isset($_POST["delete"])) { Session::checkRight("config", "w"); $config->delete($_POST, 1); Html::redirect("./config.form.php");