public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; $this->P->cb_subnav = 'admin'; $this->P->cb_customcontenttemplate = 'textcatadmin'; $return = ''; if (!isset($_REQUEST["action"]) || $_REQUEST["action"] == '') { $aData = $this->textcats->getCompleteTextcatForCurrentLang(); $aListSetting = [['title' => HardcodedText::get('textcatadmin_list_title_key'), 'key' => 'tc_key', 'width' => '20%', 'linked' => false], ['title' => HardcodedText::get('textcatadmin_list_title_text'), 'key' => 'tcl_text', 'width' => '80%', 'linked' => false, 'escapehtmlspecialchars' => true], ['title' => HardcodedText::get('textcatadmin_list_title_edit'), 'key' => 'tc_id', 'width' => 35, 'linked' => true, 'ltarget' => '/_admin/textcatadmin.html', 'lkeyname' => 'id', 'lgetvars' => ['action' => 'edit']]]; $return .= Tools::makeListtable($aListSetting, $aData, $this->serviceManager->get('twig')); } elseif ($_GET["action"] == 'edit' || $_GET["action"] == 'delete') { if ($_GET["action"] == 'delete' && isset($_POST["delete"]) && $_POST["delete"] == 'do') { $this->textcats->deleteText($_GET["id"]); $this->P->cb_customdata["deleted"] = true; } else { $this->P->cb_customdata["edit"] = true; $this->textcats->initTextIfVoid($_GET["id"]); // if post:edit is set, update if (isset($_POST["edit"]) && $_POST["edit"] == 'do') { if (HelperConfig::$core['textcat_enable_purifier']) { $this->textcats->purifier = \HaaseIT\HCSF\Helper::getPurifier('textcat'); } else { $this->textcats->purifier = false; } $this->textcats->saveText($_POST["lid"], $_POST["text"]); $this->P->cb_customdata["updated"] = true; } $aData = $this->textcats->getSingleTextByID($_GET["id"]); $this->P->cb_customdata["editform"] = ['id' => $aData["tc_id"], 'lid' => $aData["tcl_id"], 'key' => $aData["tc_key"], 'lang' => $aData["tcl_lang"], 'text' => $aData["tcl_text"]]; // show archived versions of this textcat /** @var \PDOStatement $hResult */ $hResult = $this->serviceManager->get('db')->query('SELECT * FROM textcat_lang_archive WHERE tcl_id = ' . $aData["tcl_id"] . " AND tcl_lang = '" . HelperConfig::$lang . "' ORDER BY tcla_timestamp DESC"); $iArchivedRows = $hResult->rowCount(); if ($iArchivedRows > 0) { $aListSetting = [['title' => 'tcla_timestamp', 'key' => 'tcla_timestamp', 'width' => '15%', 'linked' => false], ['title' => 'tcl_text', 'key' => 'tcl_text', 'width' => '85%', 'linked' => false, 'escapehtmlspecialchars' => true]]; $aData = $hResult->fetchAll(); $this->P->cb_customdata['archived_list'] = Tools::makeListtable($aListSetting, $aData, $this->serviceManager->get('twig')); } } } elseif ($_GET["action"] == 'add') { $this->P->cb_customdata["add"] = true; if (isset($_POST["add"]) && $_POST["add"] == 'do') { $this->P->cb_customdata["err"] = $this->textcats->verifyAddTextKey($_POST["key"]); if (count($this->P->cb_customdata["err"]) == 0) { $this->P->cb_customdata["addform"] = ['key' => $_POST["key"], 'id' => $this->textcats->addTextKey($_POST["key"])]; } } } $this->P->oPayload->cl_html = $return; }
/** * */ public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; $this->P->cb_subnav = 'admin'; $this->P->cb_customcontenttemplate = 'pageadmin'; // adding language to page here if (isset($_REQUEST["action"]) && $_REQUEST["action"] == 'insert_lang') { $Ptoinsertlang = new UserPage($this->serviceManager, $_REQUEST["page_key"], true); if ($Ptoinsertlang->cb_id != NULL && $Ptoinsertlang->oPayload->cl_id == NULL) { $Ptoinsertlang->oPayload->insert($Ptoinsertlang->cb_id); header('Location: /_admin/pageadmin.html?page_key=' . $Ptoinsertlang->cb_key . '&action=edit'); die; } else { die(HardcodedText::get('pageadmin_exception_couldnotinsertlang')); } } if (!isset($this->get["action"])) { $this->P->cb_customdata["pageselect"] = $this->showPageselect(); } elseif (($this->get["action"] == 'edit' || $this->get["action"] == 'delete') && isset($_REQUEST["page_key"]) && $_REQUEST["page_key"] != '') { if ($this->get["action"] == 'delete' && isset($this->post["delete"]) && $this->post["delete"] == 'do') { // delete and put message in customdata $Ptodelete = new UserPage($this->serviceManager, $this->get["page_key"], true); if ($Ptodelete->cb_id != NULL) { $Ptodelete->remove(); } else { die(HardcodedText::get('pageadmin_exception_pagetodeletenotfound')); } $this->P->cb_customdata["deleted"] = true; } else { // edit or update page if (isset($_REQUEST["page_key"]) && ($Ptoedit = new UserPage($this->serviceManager, $_REQUEST["page_key"], true))) { if (isset($_REQUEST["action_a"]) && $_REQUEST["action_a"] == 'true') { if (HelperConfig::$core['pagetext_enable_purifier']) { $purifier = \HaaseIT\HCSF\Helper::getPurifier('page'); } else { $purifier = false; } $Ptoedit->cb_pagetype = $this->post['page_type']; $Ptoedit->cb_group = $this->post['page_group']; $Ptoedit->cb_pageconfig = $this->post['page_config']; $Ptoedit->cb_subnav = $this->post['page_subnav']; $Ptoedit->purifier = $purifier; $Ptoedit->write(); if ($Ptoedit->oPayload->cl_id != NULL) { $Ptoedit->oPayload->cl_html = $this->post['page_html']; $Ptoedit->oPayload->cl_title = $this->post['page_title']; $Ptoedit->oPayload->cl_description = $this->post['page_description']; $Ptoedit->oPayload->cl_keywords = $this->post['page_keywords']; $Ptoedit->oPayload->purifier = $purifier; $Ptoedit->oPayload->write(); } $Ptoedit = new UserPage($this->serviceManager, $_REQUEST["page_key"], true); $this->P->cb_customdata["updated"] = true; } $this->P->cb_customdata["page"] = $Ptoedit; $this->P->cb_customdata["admin_page_types"] = HelperConfig::$core["admin_page_types"]; $this->P->cb_customdata["admin_page_groups"] = HelperConfig::$core["admin_page_groups"]; $aOptions = ['']; foreach (HelperConfig::$navigation as $sKey => $aValue) { if ($sKey == 'admin') { continue; } $aOptions[] = $sKey; } $this->P->cb_customdata["subnavarea_options"] = $aOptions; unset($aOptions); // show archived versions of this page if ($Ptoedit->oPayload->cl_id != NULL) { /** @var \PDOStatement $hResult */ $hResult = $this->serviceManager->get('db')->query('SELECT * FROM content_lang_archive WHERE cl_id = ' . $Ptoedit->oPayload->cl_id . " AND cl_lang = '" . HelperConfig::$lang . "' ORDER BY cla_timestamp DESC"); $iArchivedRows = $hResult->rowCount(); if ($iArchivedRows > 0) { $aListSetting = [['title' => 'cla_timestamp', 'key' => 'cla_timestamp', 'width' => '15%', 'linked' => false], ['title' => 'cl_html', 'key' => 'cl_html', 'width' => '40%', 'linked' => false, 'escapehtmlspecialchars' => true], ['title' => 'cl_keywords', 'key' => 'cl_keywords', 'width' => '15%', 'linked' => false, 'escapehtmlspecialchars' => true], ['title' => 'cl_description', 'key' => 'cl_description', 'width' => '15%', 'linked' => false, 'escapehtmlspecialchars' => true], ['title' => 'cl_title', 'key' => 'cl_title', 'width' => '15%', 'linked' => false, 'escapehtmlspecialchars' => true]]; $aData = $hResult->fetchAll(); $this->P->cb_customdata['archived_list'] = \HaaseIT\Tools::makeListtable($aListSetting, $aData, $this->serviceManager->get('twig')); } } } else { die(HardcodedText::get('pageadmin_exception_pagenotfound')); } } } elseif ($this->get["action"] == 'addpage') { $aErr = []; if (isset($this->post["addpage"]) && $this->post["addpage"] == 'do') { $sPagekeytoadd = \trim(\filter_input(INPUT_POST, 'pagekey', FILTER_SANITIZE_SPECIAL_CHARS)); if (mb_substr($sPagekeytoadd, 0, 2) == '/_') { $aErr["reservedpath"] = true; } elseif (strlen($sPagekeytoadd) < 4) { $aErr["keytooshort"] = true; } else { $Ptoadd = new UserPage($this->serviceManager, $sPagekeytoadd, true); if ($Ptoadd->cb_id == NULL) { if ($Ptoadd->insert($sPagekeytoadd)) { header('Location: /_admin/pageadmin.html?page_key=' . $sPagekeytoadd . '&action=edit'); die; } else { die(HardcodedText::get('pageadmin_exception_couldnotinsertpage')); } } else { $aErr["keyalreadyinuse"] = true; } } $this->P->cb_customdata["err"] = $aErr; unset($aErr); } $this->P->cb_customdata["showaddform"] = true; } }
/** * @param $CUA * @param $twig * @return mixed */ private function handleCustomerAdmin($CUA, $twig) { $sType = 'all'; if (isset($_REQUEST["type"])) { if ($_REQUEST["type"] == 'active') { $sType = 'active'; } elseif ($_REQUEST["type"] == 'inactive') { $sType = 'inactive'; } } $return = ''; if (!isset($_GET["action"])) { $sql = 'SELECT ' . DB_ADDRESSFIELDS . ' FROM customer'; if ($sType == 'active') { $sql .= ' WHERE cust_active = \'y\''; } elseif ($sType == 'inactive') { $sql .= ' WHERE cust_active = \'n\''; } $sql .= ' ORDER BY cust_no ASC'; $hResult = $this->db->query($sql); if ($hResult->rowCount() != 0) { $aData = $hResult->fetchAll(); $return .= \HaaseIT\Tools::makeListtable($CUA, $aData, $twig); } else { $aInfo["nodatafound"] = true; } } elseif (isset($_GET["action"]) && $_GET["action"] == 'edit') { $iId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); $aErr = []; if (isset($_POST["doEdit"]) && $_POST["doEdit"] == 'yes') { $sCustno = filter_var(trim($_POST["custno"]), FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); if (strlen($sCustno) < HelperConfig::$customer["minimum_length_custno"]) { $aErr["custnoinvalid"] = true; } else { $sql = 'SELECT ' . DB_ADDRESSFIELDS . ' FROM customer WHERE cust_id != :id AND cust_no = :custno'; $hResult = $this->db->prepare($sql); $hResult->bindValue(':id', $iId); $hResult->bindValue(':custno', $sCustno); $hResult->execute(); $iRows = $hResult->rowCount(); if ($iRows == 1) { $aErr["custnoalreadytaken"] = true; } $sql = 'SELECT ' . DB_ADDRESSFIELDS . ' FROM customer WHERE cust_id != :id AND cust_email = :email'; $hResult = $this->db->prepare($sql); $hResult->bindValue(':id', $iId); $hResult->bindValue(':email', filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL)); $hResult->execute(); $iRows = $hResult->rowCount(); if ($iRows == 1) { $aErr["emailalreadytaken"] = true; } $aErr = CHelper::validateCustomerForm(HelperConfig::$lang, $aErr, true); if (count($aErr) == 0) { $aData = ['cust_no' => $sCustno, 'cust_email' => trim(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL)), 'cust_corp' => trim(filter_input(INPUT_POST, 'corpname', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_name' => trim(filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_street' => trim(filter_input(INPUT_POST, 'street', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_zip' => trim(filter_input(INPUT_POST, 'zip', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_town' => trim(filter_input(INPUT_POST, 'town', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_phone' => trim(filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_cellphone' => trim(filter_input(INPUT_POST, 'cellphone', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_fax' => trim(filter_input(INPUT_POST, 'fax', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_country' => trim(filter_input(INPUT_POST, 'country', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_group' => trim(filter_input(INPUT_POST, 'custgroup', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW)), 'cust_emailverified' => isset($_POST["emailverified"]) && $_POST["emailverified"] == 'y' ? 'y' : 'n', 'cust_active' => isset($_POST["active"]) && $_POST["active"] == 'y' ? 'y' : 'n', 'cust_id' => $iId]; if (isset($_POST["pwd"]) && $_POST["pwd"] != '') { $aData['cust_password'] = password_hash($_POST["pwd"], PASSWORD_DEFAULT); $aInfo["passwordchanged"] = true; } $sql = \HaaseIT\DBTools::buildPSUpdateQuery($aData, 'customer', 'cust_id'); $hResult = $this->db->prepare($sql); foreach ($aData as $sKey => $sValue) { $hResult->bindValue(':' . $sKey, $sValue); } $hResult->execute(); $aInfo["changeswritten"] = true; } } } $sql = 'SELECT ' . DB_ADDRESSFIELDS . ' FROM customer WHERE cust_id = :id'; $hResult = $this->db->prepare($sql); $hResult->bindValue(':id', $iId); $hResult->execute(); if ($hResult->rowCount() == 1) { $aUser = $hResult->fetch(); $aPData["customerform"] = CHelper::buildCustomerForm(HelperConfig::$lang, 'admin', $aErr, $aUser); } else { $aInfo["nosuchuserfound"] = true; } } $aPData["customeradmin"]["text"] = $return; $aPData["customeradmin"]["type"] = $sType; if (isset($aInfo)) { $aPData["customeradmin"]["info"] = $aInfo; } return $aPData; }
/** * @param $aItemlist * @return array */ private function admin_prepareItemlist($aItemlist) { $aList = [['title' => HardcodedText::get('itemadmin_list_itemno'), 'key' => 'itemno', 'width' => 100, 'linked' => false], ['title' => HardcodedText::get('itemadmin_list_name'), 'key' => 'name', 'width' => 350, 'linked' => false], ['title' => HardcodedText::get('itemadmin_list_edit'), 'key' => 'itemno', 'width' => 30, 'linked' => true, 'ltarget' => '/_admin/itemadmin.html', 'lkeyname' => 'itemno', 'lgetvars' => ['action' => 'showitem']]]; $aData = []; foreach ($aItemlist["data"] as $aValue) { $aData[] = ['itemno' => $aValue['itm_no'], 'name' => $aValue['itm_name']]; } $aLData = ['numrows' => $aItemlist["numrows"], 'listtable' => Tools::makeListtable($aList, $aData, $this->serviceManager->get('twig'))]; return $aLData; }
/** * @param $aGroups * @return bool|mixed */ private function admin_showItemgroups($aGroups) { $aList = [['title' => HardcodedText::get('itemgroupadmin_list_no'), 'key' => 'gno', 'width' => 80, 'linked' => false, 'style-data' => 'padding: 5px 0;'], ['title' => HardcodedText::get('itemgroupadmin_list_name'), 'key' => 'gname', 'width' => 350, 'linked' => false, 'style-data' => 'padding: 5px 0;'], ['title' => HardcodedText::get('itemgroupadmin_list_edit'), 'key' => 'gid', 'width' => 30, 'linked' => true, 'ltarget' => '/_admin/itemgroupadmin.html', 'lkeyname' => 'gid', 'lgetvars' => ['action' => 'editgroup'], 'style-data' => 'padding: 5px 0;']]; if (count($aGroups) > 0) { $aData = []; foreach ($aGroups as $aValue) { $aData[] = ['gid' => $aValue['itmg_id'], 'gno' => $aValue['itmg_no'], 'gname' => $aValue['itmg_name']]; } return Tools::makeListtable($aList, $aData, $this->serviceManager->get('twig')); } else { return false; } }
/** * @param $CSA * @return array */ private function handleShopAdmin($CSA) { $aSData = []; $aData = []; if (!isset($_GET["action"])) { $bIgnoreStorno = false; $sql = 'SELECT * FROM orders WHERE '; if (!isset($_REQUEST["type"]) or $_REQUEST["type"] == 'openinwork') { $sql .= "(o_ordercompleted = 'n' OR o_ordercompleted = 'i') "; } elseif ($_REQUEST["type"] == 'closed') { $sql .= "o_ordercompleted = 'y' "; } elseif ($_REQUEST["type"] == 'open') { $sql .= "o_ordercompleted = 'n' "; } elseif ($_REQUEST["type"] == 'inwork') { $sql .= "o_ordercompleted = 'i' "; } elseif ($_REQUEST["type"] == 'storno') { $sql .= "o_ordercompleted = 's' "; } elseif ($_REQUEST["type"] == 'deleted') { $sql .= "o_ordercompleted = 'd' "; } elseif ($_REQUEST["type"] == 'all') { $sql .= "o_ordercompleted != 'd' "; $bIgnoreStorno = true; } else { die(HardcodedText::get('shopadmin_error_invalidrequest')); } $bFromTo = false; $sFrom = null; $sTo = null; if (isset($_REQUEST["type"]) && ($_REQUEST["type"] == 'deleted' or $_REQUEST["type"] == 'all' or $_REQUEST["type"] == 'closed')) { $sql .= "AND "; $sFrom = \filter_var($_REQUEST["fromyear"], FILTER_SANITIZE_NUMBER_INT) . '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["frommonth"], FILTER_SANITIZE_NUMBER_INT)); $sFrom .= '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["fromday"], FILTER_SANITIZE_NUMBER_INT)); $sTo = \filter_var($_REQUEST["toyear"], FILTER_SANITIZE_NUMBER_INT) . '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["tomonth"], FILTER_SANITIZE_NUMBER_INT)); $sTo .= '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["today"], FILTER_SANITIZE_NUMBER_INT)); $sql .= "o_orderdate >= :from "; $sql .= "AND o_orderdate <= :to "; $bFromTo = true; } $sql .= "ORDER BY o_ordertimestamp DESC"; $hResult = $this->db->prepare($sql); if ($bFromTo) { $hResult->bindValue(':from', $sFrom); $hResult->bindValue(':to', $sTo); } $hResult->execute(); if ($hResult->rowCount() != 0) { $i = 0; $j = 0; $k = 0; $fGesamtnetto = 0.0; while ($aRow = $hResult->fetch()) { if ($aRow["o_ordercompleted"] == 'y') { $sStatus = '<span style="color: green; font-weight: bold;">' . HardcodedText::get('shopadmin_orderstatus_completed') . '</span>'; } elseif ($aRow["o_ordercompleted"] == 'n') { $sStatus = '<span style="color: orange; font-weight: bold;">' . HardcodedText::get('shopadmin_orderstatus_open') . '</span>'; } elseif ($aRow["o_ordercompleted"] == 'i') { $sStatus = '<span style="color: orange;">' . HardcodedText::get('shopadmin_orderstatus_inwork') . '</span>'; } elseif ($aRow["o_ordercompleted"] == 's') { $sStatus = '<span style="color: red; font-weight: bold;">' . HardcodedText::get('shopadmin_orderstatus_canceled') . '</span>'; } elseif ($aRow["o_ordercompleted"] == 'd') { $sStatus = HardcodedText::get('shopadmin_orderstatus_deleted'); } else { $sStatus = ''; } if ($aRow["o_paymentcompleted"] == 'y') { $sZahlungsmethode = '<span style="color: green;">'; } else { $sZahlungsmethode = '<span style="color: red;">'; } $mZahlungsmethode = $this->serviceManager->get('textcats')->T("order_paymentmethod_" . $aRow["o_paymentmethod"], true); if ($mZahlungsmethode) { $sZahlungsmethode .= $mZahlungsmethode; } else { $sZahlungsmethode .= ucwords($aRow["o_paymentmethod"]); } $sZahlungsmethode .= '</span>'; if (trim($aRow["o_corpname"]) == '') { $sName = $aRow["o_name"]; } else { $sName = $aRow["o_corpname"]; } $aData[] = ['o_id' => $aRow["o_id"], 'o_account_no' => $aRow["o_custno"], 'o_email' => $aRow["o_email"], 'o_cust' => $sName . '<br>' . $aRow["o_zip"] . ' ' . $aRow["o_town"], 'o_authed' => $aRow["o_authed"], 'o_sumnettoall' => number_format($aRow["o_sumnettoall"], HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . ' ' . HelperConfig::$shop["waehrungssymbol"] . ($aRow["o_mindermenge"] != 0 && $aRow["o_mindermenge"] != '' ? '<br>+' . number_format($aRow["o_mindermenge"], HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . ' ' . HelperConfig::$shop["waehrungssymbol"] : ''), 'o_order_status' => $sStatus . (trim($aRow["o_lastedit_user"]) != '' ? '<br>' . $aRow["o_lastedit_user"] : ''), 'o_ordertime_number' => date(HelperConfig::$core['locale_format_date_time'], $aRow["o_ordertimestamp"]) . (trim($aRow["o_transaction_no"]) != '' ? '<br>' . $aRow["o_transaction_no"] : ''), 'o_order_host_payment' => $sZahlungsmethode . '<br>' . $aRow["o_srv_hostname"]]; if (!($aRow["o_ordercompleted"] == 's' && $bIgnoreStorno)) { $fGesamtnetto += $aRow["o_sumnettoall"]; $j++; } else { $k++; } $i++; } $aSData['listtable_orders'] = Tools::makeListtable($CSA["list_orders"], $aData, $this->serviceManager->get('twig')); $aSData['listtable_i'] = $i; $aSData['listtable_j'] = $j; $aSData['listtable_k'] = $k; $aSData['listtable_gesamtnetto'] = $fGesamtnetto; } else { $aSData['nomatchingordersfound'] = true; } } elseif (isset($_GET["action"]) && $_GET["action"] == 'edit') { $iId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); $sql = 'SELECT * FROM orders WHERE o_id = :id'; /** @var \PDOStatement $hResult */ $hResult = $this->db->prepare($sql); $hResult->bindValue(':id', $iId); $hResult->execute(); if ($hResult->rowCount() == 1) { $aSData["orderdata"] = $hResult->fetch(); $sql = 'SELECT * FROM orders_items WHERE oi_o_id = :id'; $hResult = $this->db->prepare($sql); $hResult->bindValue(':id', $iId); $hResult->execute(); $aItems = $hResult->fetchAll(); $aUserdata = ['cust_no' => $aSData["orderdata"]["o_custno"], 'cust_email' => $aSData["orderdata"]["o_email"], 'cust_corp' => $aSData["orderdata"]["o_corpname"], 'cust_name' => $aSData["orderdata"]["o_name"], 'cust_street' => $aSData["orderdata"]["o_street"], 'cust_zip' => $aSData["orderdata"]["o_zip"], 'cust_town' => $aSData["orderdata"]["o_town"], 'cust_phone' => $aSData["orderdata"]["o_phone"], 'cust_cellphone' => $aSData["orderdata"]["o_cellphone"], 'cust_fax' => $aSData["orderdata"]["o_fax"], 'cust_country' => $aSData["orderdata"]["o_country"], 'cust_group' => $aSData["orderdata"]["o_group"]]; $aSData["customerform"] = \HaaseIT\HCSF\Customer\Helper::buildCustomerForm(HelperConfig::$lang, 'shopadmin', '', $aUserdata); $aSData["orderdata"]["options_shippingservices"] = ['']; foreach (HelperConfig::$shop["shipping_services"] as $sValue) { $aSData["orderdata"]["options_shippingservices"][] = $sValue; } $aItemsCarttable = []; foreach ($aItems as $aValue) { $aPrice = ['netto_list' => $aValue["oi_price_netto_list"], 'netto_sale' => $aValue["oi_price_netto_sale"], 'netto_rebated' => $aValue["oi_price_netto_rebated"], 'netto_use' => $aValue["oi_price_netto_use"], 'brutto_use' => $aValue["oi_price_brutto_use"]]; //$aPrice = $oItem->calcPrice($aValue["oi_price_netto"], HelperConfig::$shop["vat"][$aValue["oi_vat_id"]], '', true); $aItemsCarttable[$aValue["oi_cartkey"]] = ['amount' => $aValue["oi_amount"], 'price' => $aPrice, 'vat' => $aValue["oi_vat"], 'rg' => $aValue["oi_rg"], 'rg_rebate' => $aValue["oi_rg_rebate"], 'name' => $aValue["oi_itemname"], 'img' => $aValue["oi_img"]]; } $aSData = array_merge(\HaaseIT\HCSF\Shop\Helper::buildShoppingCartTable($aItemsCarttable, true, $aSData["orderdata"]["o_group"], '', $aSData["orderdata"]["o_vatfull"], $aSData["orderdata"]["o_vatreduced"]), $aSData); } else { $aSData['ordernotfound'] = true; } } return $aSData; }
private function showMyOrders($COList) { $return = ''; $sql = 'SELECT * FROM orders WHERE o_custno = :custno ORDER BY o_ordertimestamp DESC'; $hResult = $this->db->prepare($sql); $hResult->bindValue(':custno', CHelper::getUserData('cust_no')); $hResult->execute(); if ($hResult->rowCount() >= 1) { $aData = []; while ($aRow = $hResult->fetch()) { $sStatus = SHelper::showOrderStatusText($this->textcats, $aRow["o_ordercompleted"]); if ($aRow["o_paymentmethod"] == 'prepay') { $sPaymentmethod = $this->textcats->T("order_paymentmethod_prepay"); } elseif ($aRow["o_paymentmethod"] == 'paypal') { $sPaymentmethod = $this->textcats->T("order_paymentmethod_paypal"); } elseif ($aRow["o_paymentmethod"] == 'debit') { $sPaymentmethod = $this->textcats->T("order_paymentmethod_debit"); } elseif ($aRow["o_paymentmethod"] == 'invoice') { $sPaymentmethod = $this->textcats->T("order_paymentmethod_invoice"); } else { $sPaymentmethod = ucwords($aRow["o_paymentmethod"]); } if ($aRow["o_paymentcompleted"] == 'y') { $sPaymentstatus = ucwords($this->textcats->T("misc_yes")); } else { $sPaymentstatus = ucwords($this->textcats->T("misc_no")); } $aData[] = ['o_id' => $aRow["o_id"], 'o_order_status' => $sStatus, 'o_ordertime' => date(HelperConfig::$customer['locale_format_date_time'], $aRow["o_ordertimestamp"]), 'o_paymentmethod' => $sPaymentmethod, 'o_paymentcompleted' => $sPaymentstatus, 'o_shipping_service' => $aRow["o_shipping_service"], 'o_shipping_trackingno' => $aRow["o_shipping_trackingno"]]; } $return .= \HaaseIT\Tools::makeListtable($COList, $aData, $this->serviceManager->get('twig')); } else { $return .= $this->textcats->T("myorders_no_orders_to_display"); } return $return; }
/** * */ private function handleOrderItems() { if (isset($_GET['clearorphanedorderitems'])) { $this->db->exec('DELETE FROM orders_items WHERE oi_o_id NOT IN (SELECT o_id FROM orders)'); } /** @var \PDOStatement $hResult */ $hResult = $this->db->query('SELECT * FROM orders_items WHERE oi_o_id NOT IN (SELECT o_id FROM orders)'); $this->P->cb_customdata['rows_orders_items'] = $hResult->rowCount(); if ($this->P->cb_customdata['rows_orders_items'] > 0) { $aListSetting = [['title' => 'oi_id', 'key' => 'oi_id', 'width' => '8%', 'linked' => false], ['title' => 'oi_o_id', 'key' => 'oi_o_id', 'width' => '9%', 'linked' => false], ['title' => 'oi_cartkey', 'key' => 'oi_cartkey', 'width' => '13%', 'linked' => false], ['title' => 'oi_amount', 'key' => 'oi_amount', 'width' => '9%', 'linked' => false], ['title' => 'oi_vat', 'key' => 'oi_vat', 'width' => '8%', 'linked' => false], ['title' => 'oi_rg', 'key' => 'oi_rg', 'width' => '8%', 'linked' => false], ['title' => 'oi_rg_rebate', 'key' => 'oi_rg_rebate', 'width' => '9%', 'linked' => false], ['title' => 'oi_price_netto_list', 'key' => 'oi_price_netto_list', 'width' => '9%', 'linked' => false], ['title' => 'oi_price_netto_sale', 'key' => 'oi_price_netto_sale', 'width' => '9%', 'linked' => false], ['title' => 'oi_price_netto_rebated', 'key' => 'oi_price_netto_rebated', 'width' => '9%', 'linked' => false], ['title' => 'oi_price_brutto_use', 'key' => 'oi_price_brutto_use', 'width' => '9%', 'linked' => false]]; $aData = $hResult->fetchAll(); $this->P->cb_customdata['rows_orders_items_list'] = Tools::makeListtable($aListSetting, $aData, $this->twig); } }