<tr> <td><?php echo $currency->label; ?> </td> <td><?php if ($currency->isMain) { \pi18n("Main", PLUGIN_NAME); } else { echo $currency->rate; } ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME, 'currency_edit', array("id" => $currency->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"><?php \Pasteque\form_delete("currency", $currency->id, \Pasteque\get_template_url() . 'img/delete.png'); ?> </form> </td> </tr> <?php } ?> </tbody> </table>
?> <tr class="row-<?php echo $par ? 'par' : 'odd'; ?> "> <td><img class="thumbnail" src="?<?php echo $imgSrc; ?> " /> <td><?php echo $composition->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME, 'composition_edit', array("productId" => $composition->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"><?php \Pasteque\form_delete("comp", $composition->id, \Pasteque\get_template_url() . 'img/delete.png'); ?> </form> </td> </tr> <?php } } ?> </tbody>
function printprovider($printprovider, $level, &$par) { $par = !$par; if ($printprovider->hasImage) { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=provider&id=" . $printprovider->id; } else { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=provider"; } ?> <tr class="row-<?php echo $par ? 'par' : 'odd'; ?> "> <td> <?php for ($i = 0; $i < $level; $i++) { echo " "; } ?> <img class="thumbnail" src="?<?php echo $imgSrc; ?> " /> <td><?php echo $printprovider->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME, 'provider_edit', array("id" => $printprovider->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"><?php \Pasteque\form_delete("prov", $printprovider->id, \Pasteque\get_template_url() . 'img/delete.png'); ?> </form> </td> </tr> <?php }
if (isset($_POST['delete-profile'])) { if ($srv->delete($_POST['delete-profile'])) { $message = \i18n("Changes saved"); } else { $error = \i18n("Unable to save changes"); } } $profiles = $srv->getAll(); ?> <h1><?php \pi18n("Discount profiles", PLUGIN_NAME); ?> </h1> <?php \Pasteque\tpl_btn('btn', \Pasteque\get_module_url_action(PLUGIN_NAME, "discountprofile_edit"), \i18n('New discount profile', PLUGIN_NAME), 'img/btn_add.png'); ?> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th><?php \pi18n("DiscountProfile.label"); ?> </th> <th><?php \pi18n("DiscountProfile.rate"); ?> </th> <th></th> </tr>
$database = \Pasteque\get_db_name($user_id); $dbport = \Pasteque\get_db_port($user_id); // Looking for an existing file (we do only allow one dump per day) // Filename scheme is pasteque-[date]-[database]-[randomstring].sql.gz // randomstring is for security, to make URL unfindable // Tip: create a firewall rule to ban bruteforce on this randomstring $dir = opendir("cache"); while (($f = readdir($dir)) != false) { if (preg_match("/pasteque-[0-9]{8}-" . $database . "-.[a-z0-9]*.sql.gz/", $f) == 1) { // old file's name (old date, old random string) $filename = "cache/" . $f; if (time() - filemtime($filename) > 86400) { $cmd = "rm " . $filename; exec($cmd); // new file's name (new date, new random string) $filename = "cache/pasteque-" . date("Ymd") . "-" . $database . "-" . md5(time() . rand(0, getrandmax())) . ".sql.gz"; $cmd = "mysqldump -u " . $dbuser . " --password="******" " . $database . " --port=" . $dbport . "|gzip -c > " . $filename; exec($cmd); } break; } } // We didn’t find a file, we generate one if ($filename == "") { $filename = "cache/pasteque-" . date("Ymd") . "-" . $database . "-" . md5(time() . rand(0, getrandmax())) . ".sql.gz"; $cmd = "mysqldump -u " . $dbuser . " --password="******" " . $database . " --port=" . $dbport . "|gzip -c > " . $filename; exec($cmd); } if (file_exists($filename)) { \Pasteque\tpl_btn('btn bt_export ', $filename, \i18n('Download backup', PLUGIN_NAME), 'img/btn_add.png'); }
\pi18n("Resource.label"); ?> </th> <th></th> </tr> </thead> <tbody> <ul class="resources-list"> <?php foreach ($resources as $res) { ?> <tr> <td><?php echo $res->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(PLUGIN_NAME, 'resource_edit', array("id" => $res->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-resource=" . $res->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } ?> </tbody> </table> <?php
?> " /> <td><?php echo $product->reference; ?> </td> <td><?php echo $product->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(PLUGIN_NAME, 'product_edit', array("id" => $product->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-product=" . $product->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } else { $archive = true; $archivesCat[$category->id][] = $product; } } ?> </tbody> </table> <?php } }
$error = \i18n("Unable to delete location. A location cannot be deleted when stock is assigned to it.", PLUGIN_NAME); } } $locations = $srv->getAll(); ?> <h1><?php \pi18n("Locations", PLUGIN_NAME); ?> </h1> <?php \Pasteque\tpl_msg_box($message, $error); ?> <?php \Pasteque\tpl_btn('btn', \Pasteque\get_module_url_action(PLUGIN_NAME, "location_edit"), \i18n('New location', PLUGIN_NAME), 'img/btn_add.png'); ?> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th><?php \pi18n("Location.label"); ?> </th> <th></th> </tr> </thead> <tbody> <?php foreach ($locations as $location) {
$prdLevel = array(); foreach ($levels as $level) { $prdLevel[$level->productId] = $level; } ?> <h1><?php \pi18n("Inventory", PLUGIN_NAME); ?> </h1> <?php \Pasteque\tpl_msg_box($message, $error); ?> <?php \Pasteque\tpl_btn('btn-export ', \Pasteque\get_report_url(PLUGIN_NAME, "inventory"), \i18n('Export inventory', PLUGIN_NAME), 'img/btn_add.png'); ?> <?php if ($multilocations) { // Location picker ?> <form class="edit" action="<?php echo \Pasteque\get_current_url(); ?> " method="post"> <div class="row"> <?php \Pasteque\form_select("location", \i18n("Location"), $locIds, $locNames, $currLocation); ?> </div>
</th> <th></th> </tr> </thead> <tbody> <?php foreach ($attributes as $attr) { ?> <tr> <td><?php echo $attr->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME, 'attribute_edit', array("id" => $attr->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"><?php \Pasteque\form_delete("attribute", $attr->id, \Pasteque\get_template_url() . 'img/delete.png'); ?> </form> </td> </tr> <?php } ?> </tbody> </table>
function printCategory($printCategory, $level, &$par) { $par = !$par; if ($printCategory->hasImage) { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category&id=" . $printCategory->id; } else { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category"; } ?> <tr class="row-<?php echo $par ? 'par' : 'odd'; ?> "> <td> <?php for ($i = 0; $i < $level; $i++) { echo " "; } ?> <img class="thumbnail" src="?<?php echo $imgSrc; ?> " /> <td><?php echo $printCategory->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME, 'category_edit', array("id" => $printCategory->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"><?php \Pasteque\form_delete("cat", $printCategory->id, \Pasteque\get_template_url() . 'img/delete.png'); ?> </form> </td> </tr> <?php $categories = \Pasteque\CategoriesService::getChildren($printCategory->id); $level++; foreach ($categories as $childCategory) { printCategory($childCategory, $level, $par); } }
<?php foreach ($customers as $cust) { ?> <tr> <td><?php echo $cust->number; ?> </td> <td><?php echo $cust->key; ?> </td> <td><?php echo $cust->dispName; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(PLUGIN_NAME, 'customer_edit', array("id" => $cust->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-customer=" . $cust->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } ?> </tbody> </table> <?php
<th><?php \pi18n("CashRegister.label"); ?> </th> <th></th> </tr> </thead> <tbody> <?php foreach ($cashRegs as $cashReg) { ?> <tr> <td><?php echo $cashReg->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(PLUGIN_NAME, 'cashregister_edit', array("id" => $cashReg->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-cashreg=" . $cashReg->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } ?> </tbody> </table> <?php