예제 #1
0
 public function deleteCSV()
 {
     if (DpdPolandCSV::deleteAllData()) {
         DpdPoland::addFlashMessage($this->l('Price rules deleted successfully'));
     } else {
         DpdPoland::addFlashError($this->l('Price rules could not be deleted'));
     }
     Tools::redirectAdmin($this->module_instance->module_url . '&menu=csv');
 }
예제 #2
0
        unset($cookie->dpdpoland_printout_format);
        $cookie->write();
        $package = new DpdPolandPackage((int) $package_id);
        $pdf_file_contents = $package->generateLabels('PDF', $printout_format);
        ob_end_clean();
        header('Content-type: application/pdf');
        header('Content-Disposition: attachment; filename="package_labels_' . (int) Tools::getValue('id_package_ws') . '.pdf"');
        echo $pdf_file_contents;
        exit;
    }
    $package = new DpdPolandPackage((int) Tools::getValue('id_package_ws'));
    if ($pdf_file_contents = $package->generateLabels()) {
        $cookie->dpdpoland_package_id = (int) Tools::getValue('id_package_ws');
        $printout_format = Tools::getValue('printout_format');
        if (!in_array($printout_format, array(DpdPolandConfiguration::PRINTOUT_FORMAT_A4, DpdPolandConfiguration::PRINTOUT_FORMAT_LABEL))) {
            $printout_format = DpdPolandConfiguration::PRINTOUT_FORMAT_A4;
        }
        $cookie->dpdpoland_printout_format = $printout_format;
        Tools::redirectAdmin(Tools::getValue('returnOnErrorTo') . '&scrollToShipment');
        exit;
    } else {
        DpdPoland::addFlashError(reset(DpdPolandPackageWS::$errors));
        Tools::redirectAdmin(Tools::getValue('returnOnErrorTo') . '&scrollToShipment');
        exit;
    }
}
if (Tools::isSubmit('downloadModuleCSVSettings')) {
    include_once _DPDPOLAND_CONTROLLERS_DIR_ . 'csv.controller.php';
    $controller = new DpdPolandCSVController();
    $controller->generateCSV();
}
 public function saveSettings()
 {
     if (DpdPolandConfiguration::saveConfiguration()) {
         if (!DpdPolandConfiguration::saveZonesForCarriers()) {
             DpdPoland::addFlashError($this->l('Settings saved successfully but could not assign zones for carriers'));
         } else {
             DpdPoland::addFlashMessage($this->l('Settings saved successfully'));
             Tools::redirectAdmin($this->module_instance->module_url . '&menu=configuration');
         }
     } else {
         DpdPoland::addFlashError($this->l('Could not save settings'));
     }
 }