function remove($module) { global $db; $error = false; // load and remove all modules $method_dir = DIR_FS_ADMIN . 'modules/' . $module . '/methods/'; $methods = array(); if ($dir = @dir($method_dir)) { while ($choice = $dir->read()) { if (file_exists($method_dir . $choice . '/' . $choice . '.php') && $choice != '.' && $choice != '..') { $methods[] = $choice; } } $dir->close(); foreach ($methods as $method) { require_once DIR_FS_ADMIN . 'modules/' . $module . '/methods/' . $method . '/' . $method . '.php'; $properties = new $method(); remove_configure('MODULE_' . strtoupper($module) . '_' . strtoupper($method) . '_STATUS'); foreach ($properties->keys() as $key) { remove_configure($key['key']); } if (method_exists($properties, 'remove')) { $properties->remove(); } } } if (db_field_exists(TABLE_CURRENT_STATUS, 'next_shipment_num')) { $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_shipment_num"); } if (db_field_exists(TABLE_CURRENT_STATUS, 'next_shipment_desc')) { $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_shipment_desc"); } return $error; }
function remove($module) { $error = false; // load and remove all modules $method_dir = DIR_FS_ADMIN . 'modules/' . $module . '/methods/'; $methods = array(); if ($dir = @dir($method_dir)) { while ($choice = $dir->read()) { if (file_exists($method_dir . $choice . '/' . $choice . '.php') && $choice != '.' && $choice != '..') { $methods[] = $choice; } } $dir->close(); foreach ($methods as $method) { require_once DIR_FS_ADMIN . 'modules/' . $module . '/methods/' . $method . '/' . $method . '.php'; $properties = new $method(); remove_configure('MODULE_' . strtoupper($module) . '_' . strtoupper($method) . '_STATUS'); foreach ($properties->keys() as $key) { remove_configure($key['key']); } if (method_exists($properties, 'remove')) { $properties->remove(); } } } return $error; }
// handle special case install, db, files, etc gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); break; case 'remove': validate_security($security_level, 4); require_once $method_dir . $method . '/' . $method . '.php'; $properties = new $method(); if (method_exists($properties, 'remove')) { $properties->remove(); } // handle special case removal, db, files, etc foreach ($properties->keys() as $key) { // remove all of the keys from the configuration table $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key = '" . $key['key'] . "'"); } remove_configure('MODULE_PAYMENT_' . strtoupper($method) . '_STATUS'); gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); break; case 'save': validate_security($security_level, 3); // foreach method if enabled, save info if (sizeof($methods) > 0) { foreach ($methods as $shipper) { require_once $method_dir . $shipper . '/' . $shipper . '.php'; if (defined('MODULE_PAYMENT_' . strtoupper($shipper) . '_STATUS')) { $properties = new $shipper(); $properties->update(); } } } // save general tab
// handle special case install, db, files, etc gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); break; case 'remove': validate_security($security_level, 4); require_once $method_dir . $method . '/' . $method . '.php'; $properties = new $method(); if (method_exists($properties, 'remove')) { $properties->remove(); } // handle special case removal, db, files, etc foreach ($properties->keys() as $key) { // remove all of the keys from the configuration table $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key = '" . $key['key'] . "'"); } remove_configure('MODULE_SHIPPING_' . strtoupper($method) . '_STATUS'); gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); break; case 'save': validate_security($security_level, 3); // foreach method if enabled, save info if (sizeof($methods) > 0) { foreach ($methods as $shipper) { if (defined('MODULE_SHIPPING_' . strtoupper($shipper) . '_STATUS')) { require_once $method_dir . $shipper . '/' . $shipper . '.php'; $properties = new $shipper(); $properties->update(); } } } // save general tab
function update($module) { global $db, $messageStack; $error = false; if (MODULE_PHREEPOS_STATUS < 3.2) { if (!defined('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE')) { write_configure('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE', ''); } if (!defined('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE')) { write_configure('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE', ''); } } if (MODULE_PHREEPOS_STATUS < 3.3) { if (!defined('PHREEPOS_RECEIPT_PRINTER_OPEN_DRAWER')) { write_configure('PHREEPOS_RECEIPT_PRINTER_OPEN_DRAWER', ''); } if (!defined('PHREEPOS_DISPLAY_WITH_TAX')) { write_configure('PHREEPOS_DISPLAY_WITH_TAX', '1'); } if (!defined('PHREEPOS_DISCOUNT_OF')) { write_configure('PHREEPOS_DISCOUNT_OF', '0'); } if (!defined('PHREEPOS_ROUNDING')) { write_configure('PHREEPOS_ROUNDING', '0'); } } if (!db_table_exists(TABLE_PHREEPOS_TILLS)) { foreach ($this->tables as $table => $sql) { if ($table == TABLE_PHREEPOS_TILLS) { admin_install_tables(array($table => $sql)); } foreach (gen_get_store_ids() as $store) { $sql_data_array = array('store_id' => $store['id'], 'gl_acct_id' => AR_SALES_RECEIPTS_ACCOUNT, 'description' => $store['text'], 'rounding_gl_acct_id' => AR_SALES_RECEIPTS_ACCOUNT, 'dif_gl_acct_id' => AR_SALES_RECEIPTS_ACCOUNT, 'printer_name' => PHREEPOS_RECEIPT_PRINTER_NAME, 'printer_starting_line' => PHREEPOS_RECEIPT_PRINTER_STARTING_LINE, 'printer_closing_line' => PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE, 'printer_open_drawer' => ''); db_perform(TABLE_PHREEPOS_TILLS, $sql_data_array); } if (defined('PHREEPOS_RECEIPT_PRINTER_NAME')) { remove_configure('PHREEPOS_RECEIPT_PRINTER_NAME'); } if (defined('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE')) { remove_configure('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE'); } if (defined('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE')) { remove_configure('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE'); } } } foreach ($this->tables as $table => $sql) { if ($table == TABLE_PHREEPOS_OTHER_TRANSACTIONS) { admin_install_tables(array($table => $sql)); } } if (!defined('PHREEPOS_ENABLE_DIRECT_PRINTING')) { write_configure('PHREEPOS_ENABLE_DIRECT_PRINTING', 0); } if (!db_field_exists(TABLE_PHREEPOS_TILLS, 'tax_id')) { $db->Execute("ALTER TABLE " . TABLE_PHREEPOS_TILLS . " ADD tax_id INT(11) default '-1' AFTER max_discount"); } if (!$error) { write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION')); $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success'); } return $error; }