diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index fe3d238..ff1a259 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -8,6 +8,96 @@ "modules": { "stUserData": { "templates": { + "addressListSuccess.php": { + "type": "-", + "size": 613, + "lmtime": 0, + "modified": false + }, + "_ajaxEditProfile.php": { + "type": "-", + "size": 6086, + "lmtime": 0, + "modified": false + }, + "createFirstUserDataSuccess.php": { + "type": "-", + "size": 18496, + "lmtime": 1750194435516, + "modified": false + }, + "_deliveryCountriesSelect.php": { + "type": "-", + "size": 859, + "lmtime": 0, + "modified": false + }, + "_editProfileForm.php": { + "type": "-", + "size": 12844, + "lmtime": 0, + "modified": false + }, + "_editProfileList.php": { + "type": "-", + "size": 3384, + "lmtime": 0, + "modified": false + }, + "editProfileSuccess.php": { + "type": "-", + "size": 1284, + "lmtime": 0, + "modified": false + }, + "_orderFormBilling.php": { + "type": "-", + "size": 12010, + "lmtime": 1750194457389, + "modified": false + }, + "_orderFormDelivery.php": { + "type": "-", + "size": 9269, + "lmtime": 0, + "modified": false + }, + "_orderForm.php": { + "type": "-", + "size": 26794, + "lmtime": 1750194486390, + "modified": false + }, + "_pager.php": { + "type": "-", + "size": 1228, + "lmtime": 0, + "modified": false + }, + "productListSuccess.php": { + "type": "-", + "size": 7739, + "lmtime": 0, + "modified": false + }, + "_profileList.php": { + "type": "-", + "size": 55, + "lmtime": 0, + "modified": false + }, + "_responsiveUserPanelBreadcrumbs.php": { + "type": "-", + "size": 207, + "lmtime": 0, + "modified": false + }, + "_responsiveUserPanelMenu.php": { + "type": "-", + "size": 512, + "lmtime": 0, + "modified": false + }, "theme": { "default2": { "user_form.html": { @@ -86,11 +176,37 @@ "mojszablon": { "userdata_order_form.html": { "type": "-", - "size": 13527, - "lmtime": 1697623526231, + "size": 14194, + "lmtime": 1750194519328, "modified": false } } + }, + "_user_form.php": { + "type": "-", + "size": 1155, + "lmtime": 0, + "modified": false + }, + "_userPanelMenu.php": { + "type": "-", + "size": 1189, + "lmtime": 0, + "modified": false + }, + "userPanelSuccess.php": { + "type": "-", + "size": 10489, + "lmtime": 0, + "modified": false + } + }, + "actions": { + "actions.class.php": { + "type": "-", + "size": 55099, + "lmtime": 1750193995402, + "modified": false } } }, diff --git a/apps/frontend/modules/stUserData/actions/actions.class.php b/apps/frontend/modules/stUserData/actions/actions.class.php index 61bd05c..347ec86 100644 --- a/apps/frontend/modules/stUserData/actions/actions.class.php +++ b/apps/frontend/modules/stUserData/actions/actions.class.php @@ -1,12 +1,12 @@ * @@ -37,7 +39,7 @@ class stUserDataActions extends stActions $this->show_address_more = $user_config->get('show_address_more'); $change_default_user = $user_config->get('change_default_user'); - + if ($this->getRequest()->getMethod() == sfRequest::POST) { $userDataBilling = $this->getRequestParameter('user_data_billing'); @@ -55,11 +57,11 @@ class stUserDataActions extends stActions } if(!stTheme::is_responsive()){ - $this->redirect('stUser/editAccount'); + $this->redirect('stUser/editAccount'); }else{ $this->redirect('stUserData/userPanel'); } - + } $userDataBilling = $this->getUserDataBillingDefault($this->getUser()->getGuardUser()->getId()); @@ -67,10 +69,10 @@ class stUserDataActions extends stActions $userDataDelivery = $this->getUserDataDeliveryDefault($this->getUser()->getGuardUser()->getId()); $this->userDataDelivery = $userDataDelivery; - + $this->type1_delivery_checker = 1; $this->type2_delivery_checker = 0; - + if($change_default_user!=1) { $this->type1_billing_checker = 1; @@ -79,11 +81,11 @@ class stUserDataActions extends stActions else { $this->type1_billing_checker = 0; - $this->type2_billing_checker = 1; + $this->type2_billing_checker = 1; } - + $this->different_billing = 0; - + } else { @@ -95,22 +97,22 @@ class stUserDataActions extends stActions { if($this->getUser()->isAuthenticated()) { - $userDataBilling = stUser::updateUserData(null,$this->getUser()->getGuardUser()->getId(),1,1); - $this->redirect('stUserData/editProfile?userDataType=billing&userDataId='.$userDataBilling->getId().'&showEditProfileForm=true'); + $userDataBilling = stUser::updateUserData(null,$this->getUser()->getGuardUser()->getId(),1,1); + $this->redirect('stUserData/editProfile?userDataType=billing&userDataId='.$userDataBilling->getId().'&showEditProfileForm=true'); } else { stUser::processAuthentication(); } } - + public function executeCreateFirstUserDataDelivery() { if($this->getUser()->isAuthenticated()) - { + { $userDataDelivery = stUser::updateUserData(null,$this->getUser()->getGuardUser()->getId(),0,1); $this->redirect('stUserData/editProfile?userDataType=delivery&userDataId='.$userDataDelivery->getId().'&showEditProfileForm=true'); - + } else { @@ -193,45 +195,48 @@ class stUserDataActions extends stActions if($this->getUser()->isAuthenticated()) { - + $userDataBilling = $this->getUserDataBillingDefault($this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); $this->userDataBilling = $userDataBilling; $userDataDelivery = $this->getUserDataDeliveryDefault($this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); $this->userDataDelivery = $userDataDelivery; - + if(!stTheme::is_responsive()){ - + if($userDataBilling->getAddress()=="" || $userDataDelivery->getAddress()=="") { $this->redirect('stUserData/createFirstUserData'); } - + } - + $c = new Criteria(); $c->add(OrderPeer::SF_GUARD_USER_ID, $this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); $c->setLimit(10); $orders = OrderPeer::doSelect($c); - + if($orders) { $this->user_order = 1; - $this->orders = $orders; + $this->orders = $orders; } - + $c = new Criteria(); $c->add(OrderPeer::SF_GUARD_USER_ID, $this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); $c->addDescendingOrderByColumn('CREATED_AT'); $lastOrder = OrderPeer::doSelectOne($c); - + if($lastOrder) { - $this->lastOrder = $lastOrder; + $this->lastOrder = $lastOrder; $this->currency = $lastOrder->getOrderCurrency(); + + $this->linkOrder = url_for('@stOrderListShowForUser?id=' . $lastOrder->getId() . '&hash_code=' . $lastOrder->getHashCode()); + } - - + + $c = new Criteria(); $c->add(DiscountUserPeer::SF_GUARD_USER_ID, $this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); $userDiscount = DiscountUserPeer::doSelectOne($c); @@ -255,11 +260,11 @@ class stUserDataActions extends stActions $discount_count = DiscountPeer::doCount($c); if($userDiscount){ - $this->user_discounts = $discount_count > 0 || @$user_discount && $user_discount->getDiscount()->getValue() > 0; + $this->user_discounts = $discount_count > 0 || @$user_discount && $user_discount->getDiscount()->getValue() > 0; }else{ $this->user_discounts = false; } - + } else { @@ -271,16 +276,16 @@ class stUserDataActions extends stActions $newsletterConfig = $newsletterConfig->load(); $this->newsletterConfig = $newsletterConfig; - - + + $pointsConfig = stConfig::getInstance($this->getContext(), 'stPointsBackend'); $pointsConfig = $pointsConfig->load(); - - stPoints::refreshLoginStatusPoints(); - + + stPoints::refreshLoginStatusPoints(); + $this->pointsConfig = $pointsConfig; - + } public function executeTest() @@ -326,40 +331,39 @@ class stUserDataActions extends stActions $userData = $this->getRequestParameter('user_data'); $userDataType = $this->getRequestParameter('userDataType'); $showEditProfileForm = $this->getRequestParameter('showEditProfileForm'); - - // print_r($userData); - // die(); - + + + if($userDataType=="billing") { $isBilling = 1; } - else + else { $isBilling = 0; } - + if($this->hasRequestParameter('user_data_delivery')) { $userData['country'] = $this->getRequestParameter('user_data_delivery[country]'); } - - - // $c = new Criteria(); - // $c->add(UserDataPeer::SF_GUARD_USER_ID, $this->getUser()->getGuardUser()->getId()); - // $c->add(UserDataPeer::IS_BILLING, $isBilling); -// - // if(!UserDataPeer::doSelectOne($c)) - // { - // $userData['isDefault']=1; - // } - - - // if($userData['isDefault']==1){ - // $this->setDefaultUserData($userData['id'], $userData['isBilling']); - // } - - + + + /* $c = new Criteria(); + $c->add(UserDataPeer::SF_GUARD_USER_ID, $this->getUser()->getGuardUser()->getId()); + $c->add(UserDataPeer::IS_BILLING, $isBilling); + + if(!UserDataPeer::doSelectOne($c)) + { + $userData['isDefault']=1; + } + + + if($userData['isDefault']==1){ + $this->setDefaultUserData($userData['id'], $userData['isBilling']); + }*/ + + stUser::updateUserData($userData['id'],$this->getUser()->getGuardUser()->getId(),$userData['isBilling'],$userData['isDefault'],$userData); if(!$showEditProfileForm) @@ -371,7 +375,7 @@ class stUserDataActions extends stActions $this->userDataType = $userDataType; $this->showEditProfileForm = $showEditProfileForm; - $this->redirect('stUserData/editProfile?userDataType='.$userDataType.'&userDataId='.$userDataId.'&showMessage=true'); + $this->redirect('stUserData/addressList'); } else @@ -425,7 +429,7 @@ class stUserDataActions extends stActions $userData = $this->getUserDataDeliveryDefault($this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); } - $this->redirect('stUserData/editProfile?userDataType='.$userDataType.'&userDataId='.$userData->getId()); + $this->redirect('stUserData/addressList'); } else @@ -649,7 +653,7 @@ class stUserDataActions extends stActions $this->userDataBilling = $userDataBilling; $this->userDataDelivery = $userDataDelivery; - + if ($userDataDeliveryFromRequest['customer_type']==2) { $this->type1_delivery_checker = 0; @@ -660,7 +664,7 @@ class stUserDataActions extends stActions $this->type1_delivery_checker = 1; $this->type2_delivery_checker = 0; } - + if ($userDataBillingFromRequest['customer_type']==2) { $this->type1_billing_checker = 0; @@ -684,10 +688,10 @@ class stUserDataActions extends stActions $this->show_region = $user_config->get('show_region'); $this->show_pesel = $user_config->get('show_pesel'); - $this->smarty = new stSmarty($this->getModuleName()); + $this->smarty = new stSmarty($this->getModuleName()); $userDataBillingFromRequest = $this->getRequestParameter('user_data_billing'); - + // if ($userDataBillingFromRequest['customer_billing_type']==2) // { // $this->type1_billing_checker = 0; @@ -698,9 +702,9 @@ class stUserDataActions extends stActions // $this->type1_billing_checker = 1; // $this->type2_billing_checker = 0; // } - + $userDataDeliveryFromRequest = $this->getRequestParameter('user_data_delivery'); - + // if ($userDataDeliveryFromRequest['customer_delivery_type']==2) // { // $this->type1_delivery_checker = 0; @@ -711,167 +715,183 @@ class stUserDataActions extends stActions // $this->type1_delivery_checker = 1; // $this->type2_delivery_checker = 0; // } - - + + $this->userDataBilling = $this->getRequestParameter('user_data_billing'); - + $this->userDataDelivery = $this->getRequestParameter('user_data_delivery'); } public function validateCreateFirstUserData() - { - $error_exists = false; - + { $user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser'); $i18n = $this->getContext()->getI18N(); - $billing = $this->getRequestParameter('user_data_billing', array()); - + $billing = $this->getRequestParameter('user_data_billing', array()); + if ($this->getRequest()->getMethod() == sfRequest::POST) - { + { // if (stConfig::getInstance('stPaczkomatyBackend')->get('enable')) { // $delivery = stDeliveryFrontend::getInstance(stBasket::getInstance($this->getUser()))->getDefaultDelivery(); // if (is_object($delivery) && in_array($delivery->getPaczkomatyType(), array('ALL', 'COD'))) { // $user_config->set('validate_phone', 1); -// +// // if (!$billing['paczkomaty_machine_number']) { // $this->getRequest()->setError('user_data_billing{paczkomaty_machine_number}', true); // $error_exists = true; // } // } // } - + if ($billing['customer_type']==2) { if (!$billing['company']) { $this->getRequest()->setError('user_data_billing{company}', $i18n->__('Brak firmy.')); - $error_exists = true; } - + if (!$billing['vat_number']) { $this->getRequest()->setError('user_data_billing{vat_number}', $i18n->__('Brak nipu.')); - $error_exists = true; - } + } } else { if (!$billing['full_name']) { $this->getRequest()->setError('user_data_billing{full_name}', $i18n->__('Brak imienia i nazwiska.')); - $error_exists = true; - } + } } - + if (!$billing['phone'] && $user_config->get('validate_phone')==1) { $this->getRequest()->setError('user_data_billing{phone}', $i18n->__('Brak telefonu.')); - $error_exists = true; } - + if ($this->hasRequestParameter('different_delivery')) { $delivery = $this->getRequestParameter('user_data_delivery', array()); - + $validator = new sfStringValidator(); $validator->initialize($this->getContext(), array( 'max' => 255, 'max_error' => $i18n->__('Przekroczono dozwoloną liczbę znaków.'), - + )); - - + + if ($delivery['customer_type']==2) { - if (!$delivery['company']) + if (!$delivery['company']) { $this->getRequest()->setError('user_data_delivery{company}', $i18n->__('Brak firmy.')); - $error_exists = true; - } + } + } - else + else { if (!$delivery['full_name']) { $this->getRequest()->setError('user_data_delivery{full_name}', $i18n->__('Brak imienia i nazwiska.')); - $error_exists = true; - } - } + } + } + if (!$delivery['address']) { $this->getRequest()->setError('user_data_delivery{address}', $i18n->__('Brak adresu.')); - $error_exists = true; } - + if (!$delivery['code']) { $this->getRequest()->setError('user_data_delivery{code}', $i18n->__('Brak kodu.')); - $error_exists = true; } - + if (!$delivery['town']) { $this->getRequest()->setError('user_data_delivery{town}', $i18n->__('Brak miasta.')); - $error_exists = true; } - + if (!$delivery['phone'] && $user_config->get('validate_phone')==1) { $this->getRequest()->setError('user_data_delivery{phone}', $i18n->__('Brak telefonu.')); - $error_exists = true; } - + } - + } + - - return !$error_exists; + return !$this->getRequest()->hasErrors(); } public function validateAddBasketUser() { - $user_config = stConfig::getInstance('stUser'); - $invoice_config = stConfig::getInstance('stInvoiceBackend'); - - $error_exists = false; - - $i18n = $this->getContext()->getI18N(); + if ($this->getRequest()->getMethod() != sfRequest::POST) + { + throw new sfUnprocessableEntityException(); + } $user_data_billing = $this->getRequestParameter('user_data_billing'); $user_data_delivery = $this->getRequestParameter('user_data_delivery'); + if (null === $user_data_billing || null === $user_data_delivery) + { + throw new sfUnprocessableEntityException(); + } + + $error_exists = false; + $deliveryErrors = []; + $paymentErrors = []; + $i18n = $this->getContext()->getI18N(); + $user_config = stConfig::getInstance('stUser'); + $invoice_config = stConfig::getInstance('stInvoiceBackend'); + /** + * @var stBasket + */ + $basket = $this->getUser()->getBasket(); + $frontendDelivery = stDeliveryFrontend::getInstance($basket); + $frontendDelivery->setDefaultDeliveryCountry($this->getRequest()->getParameter('delivery_country_id')); + + if (null === $frontendDelivery->getDefaultDeliveryCountry()) + { + return false; + } + + $frontendDelivery->setDefaultDelivery($this->getRequest()->getParameter('delivery_id')); + $delivery = $frontendDelivery->getDefaultDelivery(); + + if (null === $frontendDelivery->getDefaultDelivery()) + { + return false; + } + + $frontendDelivery->getDefaultDelivery()->setDefaultPayment($this->getRequest()->getParameter('payment_id')); + + if (null === $frontendDelivery->getDefaultDelivery()->getDefaultPayment()) + { + return false; + } + + $totalBasketAmount = $basket->getTotalAmount(true); + $orderTotalAmount = $frontendDelivery->getTotalDeliveryCost(true) + $basket->getTotalAmount(true); + + $pickupPoint = stDeliveryTypePickupPoint::createFromJson($this->getRequestParameter('delivery_pickup_point')); + $user_data_billing = array_map('trim', $user_data_billing); $user_data_delivery = array_map('trim', $user_data_delivery); $this->getRequest()->setParameter('user_data_billing', $user_data_billing); $this->getRequest()->setParameter('user_data_delivery', $user_data_delivery); + $isCustomerAccount = isset($user_data_billing['different_delivery']) ? $user_data_delivery['customer_type'] == 1 : $user_data_billing['customer_type'] == 1; - $delivery = stDeliveryFrontend::getInstance($this->getUser()->getBasket())->getDefaultDelivery(); if ($user_data_billing) { - if (stConfig::getInstance('stPaczkomatyBackend')->get('enable')) - { - - if (is_object($delivery) && in_array($delivery->getPaczkomatyType(), array('ALL', 'COD'))) - { - $user_config->set('validate_phone', 1); - - if (!$user_data_billing['paczkomaty_machine_number']) - { - $this->getRequest()->setError('user_data_billing{paczkomaty_machine_number}', true); - $error_exists = true; - } - } - } - if ($this->getUser()->hasVatEu()) { $user_data_billing['customer_type'] = 2; @@ -927,8 +947,7 @@ class stUserDataActions extends stActions { if (stUser::isFullAccount($user_data_billing['email']) && $user_data_billing['create_account'] == 1) { - $this->getRequest()->setError('user_data_billing{email}', $i18n->__('Taki użytkownik już istnieje.')); - $error_exists = true; + $this->getRequest()->setError('user_data_billing{email}', $i18n->__('Taki użytkownik już istnieje.')); } } @@ -937,27 +956,23 @@ class stUserDataActions extends stActions if (!$valid) { $this->getRequest()->setError('user_data_billing{email}', $i18n->__('Niepoprawny adres.')); - $error_exists = true; } } if (!$user_data_billing['full_name'] && ($user_data_billing['customer_type'] == 1 || $user_config->get('require_billing_fullname'))) { $this->getRequest()->setError('user_data_billing{full_name}', $i18n->__('Brak imienia i nazwiska.')); - $error_exists = true; } if (!$user_data_billing['company'] && $user_data_billing['customer_type'] == 2) { $this->getRequest()->setError('user_data_billing{company}', $i18n->__('Brak firmy.')); - $error_exists = true; } if (!$user_data_billing['vat_number'] && $user_data_billing['customer_type'] == 2) { $this->getRequest()->setError('user_data_billing{vat_number}', $this->getUser()->hasVatEu() ? 'Brak numeru VAT UE.' : 'Brak numeru NIP.'); - $error_exists = true; } if (!$this->getUser()->isAuthenticated()) @@ -965,7 +980,6 @@ class stUserDataActions extends stActions if (!isset($user_data_billing['email']) || !$user_data_billing['email']) { $this->getRequest()->setError('user_data_billing{email}', $i18n->__('Brak adresu email.')); - $error_exists = true; } } @@ -976,19 +990,16 @@ class stUserDataActions extends stActions { $this->getRequest()->setError('user_data_billing{password1}', $i18n->__('Hasła nie są takie same.')); $this->getRequest()->setError('user_data_billing{password2}', $i18n->__('Hasła nie są takie same.')); - $error_exists = true; } if (!$user_data_billing['password1']) { $this->getRequest()->setError('user_data_billing{password1}', $i18n->__('Brak hasła.')); - $error_exists = true; } if (!$user_data_billing['password2']) { $this->getRequest()->setError('user_data_billing{password2}', $i18n->__('Brak hasła.')); - $error_exists = true; } if (stTheme::is_responsive()) @@ -997,7 +1008,6 @@ class stUserDataActions extends stActions if ($user_data_billing['privacy'] != 1) { $this->getRequest()->setError('error_privacy', 1); - $error_exists = true; } } } @@ -1005,106 +1015,89 @@ class stUserDataActions extends stActions if (!isset($user_data_billing['address']) || !$user_data_billing['address']) { $this->getRequest()->setError('user_data_billing{address}', $i18n->__('Brak adresu.')); - $error_exists = true; - } - - // address_number - if ( !isset($user_data_billing['address_number']) || !$user_data_billing['address_number']) - { - $this->getRequest()->setError('user_data_billing{address_number}', $i18n->__('Brak numeru domu/mieszkania.')); - $error_exists = true; } if (!isset($user_data_billing['code']) || !$user_data_billing['code']) { $this->getRequest()->setError('user_data_billing{code}', $i18n->__('Brak kodu.')); - $error_exists = true; } if (!isset($user_data_billing['town']) || !$user_data_billing['town']) { $this->getRequest()->setError('user_data_billing{town}', $i18n->__('Brak miasta.')); - $error_exists = true; } if ((!isset($user_data_billing['phone']) || !$user_data_billing['phone']) && $user_config->get('validate_phone') == 1) { $this->getRequest()->setError('user_data_billing{phone}', $i18n->__('Brak telefonu.')); - $error_exists = true; } - if ((isset($user_data_billing['different_delivery']) && $user_data_billing['different_delivery'] == 1 || $this->getUser()->isAuthenticated()) && !$delivery->isType('ppo') && !$delivery->isType('inpostp')) + if (null === $delivery->getService() || !$delivery->getService()->isPickupPoint()) { - if (!$user_data_delivery['company'] && $user_data_delivery['customer_type'] == 2) + if (isset($user_data_billing['different_delivery']) && $user_data_billing['different_delivery'] == 1 || $this->getUser()->isAuthenticated()) { - $this->getRequest()->setError('user_data_delivery{company}', $i18n->__('Brak firmy.')); - $error_exists = true; - } - - if (!$user_data_delivery['full_name'] && $user_data_delivery['customer_type'] == 1) - { - $this->getRequest()->setError('user_data_delivery{full_name}', $i18n->__('Brak imienia i nazwiska.')); - $error_exists = true; - } - - if (!$user_data_delivery['address']) - { - $this->getRequest()->setError('user_data_delivery{address}', $i18n->__('Brak adresu.')); - $error_exists = true; - } - - if (!$user_data_delivery['code']) - { - $this->getRequest()->setError('user_data_delivery{code}', $i18n->__('Brak kodu.')); - $error_exists = true; - } - - if (!$user_data_delivery['town']) - { - $this->getRequest()->setError('user_data_delivery{town}', $i18n->__('Brak miasta.')); - $error_exists = true; - } - - if (!$user_data_delivery['phone'] && $user_config->get('validate_phone') == 1) - { - $this->getRequest()->setError('user_data_delivery{phone}', $i18n->__('Brak telefonu.')); - $error_exists = true; - } - - if ($user_data_delivery['country'] != stDeliveryFrontend::getInstance($this->getUser()->getBasket())->getDefaultDeliveryCountry()->getId()) - { - $this->getRequest()->setError('user_data_delivery{country}', $i18n->__('Wybrany kraj nie może się różnić od kraju dostawy')); - $error_exists = true; - } - - if ($this->getUser()->hasVatEu() && $invoice_config->get('check_vat_eu_delivery_country', true)) - { - $deliveryCountry = CountriesPeer::retrieveById($user_data_delivery['country']); - list($cc) = stTaxVies::parseVatNumber($user_data_billing['vat_number']); - - $ccEuFix = array('EL' => 'GR', 'CHE' => 'CH'); - - if (isset($ccEuFix[$cc])) + if (!$user_data_delivery['company'] && $user_data_delivery['customer_type'] == 2) { - $cc = $ccEuFix[$cc]; + $this->getRequest()->setError('user_data_delivery{company}', $i18n->__('Brak firmy.')); } - if ($deliveryCountry->getIsoA2() != $cc) + if (!$user_data_delivery['full_name'] && $user_data_delivery['customer_type'] == 1) { - $this->getRequest()->setError('user_data_delivery{country}', $i18n->__('Wybrany kraj nie jest zgodny z podanym numerem VAT UE')); - $this->getUser()->setValidVatEu(false); - $error_exists = true; + $this->getRequest()->setError('user_data_delivery{full_name}', $i18n->__('Brak imienia i nazwiska.')); } - else + + if (!$user_data_delivery['address']) { - $this->getUser()->setValidVatEu(true); + $this->getRequest()->setError('user_data_delivery{address}', $i18n->__('Brak adresu.')); + } + + if (!$user_data_delivery['code']) + { + $this->getRequest()->setError('user_data_delivery{code}', $i18n->__('Brak kodu.')); + } + + if (!$user_data_delivery['town']) + { + $this->getRequest()->setError('user_data_delivery{town}', $i18n->__('Brak miasta.')); + } + + if (!$user_data_delivery['phone'] && $user_config->get('validate_phone') == 1) + { + $this->getRequest()->setError('user_data_delivery{phone}', $i18n->__('Brak telefonu.')); + } + + if ($user_data_delivery['country'] != $frontendDelivery->getDefaultDeliveryCountry()->getId()) + { + $this->getRequest()->setError('user_data_delivery{country}', $i18n->__('Wybrany kraj nie może się różnić od kraju dostawy')); + } + + if ($this->getUser()->hasVatEu() && $invoice_config->get('check_vat_eu_delivery_country', true)) + { + $deliveryCountry = CountriesPeer::retrieveById($user_data_delivery['country']); + list($cc) = stTaxVies::parseVatNumber($user_data_billing['vat_number']); + + $ccEuFix = array('EL' => 'GR', 'CHE' => 'CH'); + + if (isset($ccEuFix[$cc])) + { + $cc = $ccEuFix[$cc]; + } + + if ($deliveryCountry->getIsoA2() != $cc) + { + $this->getRequest()->setError('user_data_delivery{country}', $i18n->__('Wybrany kraj nie jest zgodny z podanym numerem VAT UE')); + $this->getUser()->setValidVatEu(false); + } + else + { + $this->getUser()->setValidVatEu(true); + } } } - } - elseif (!$delivery->isType('ppo') && !$delivery->isType('inpostp') && $user_data_billing['country'] != stDeliveryFrontend::getInstance($this->getUser()->getBasket())->getDefaultDeliveryCountry()->getId()) - { - $this->getRequest()->setError('user_data_billing{country}', $i18n->__('Wybrany kraj nie może się różnić od kraju dostawy')); - $error_exists = true; + elseif ($user_data_billing['country'] != $frontendDelivery->getDefaultDeliveryCountry()->getId()) + { + $this->getRequest()->setError('user_data_billing{country}', $i18n->__('Wybrany kraj nie może się różnić od kraju dostawy')); + } } if (!stTheme::is_responsive()) @@ -1120,7 +1113,6 @@ class stUserDataActions extends stActions else { $this->getRequest()->setError('error_privacy', 1); - $error_exists = true; } } } @@ -1128,7 +1120,6 @@ class stUserDataActions extends stActions if (!$this->getUser()->isAuthenticated() && !isset($user_data_billing['terms'])) { $this->getRequest()->setError('error_terms', 1); - $error_exists = true; } else { @@ -1152,7 +1143,7 @@ class stUserDataActions extends stActions if ($recaptcha->score <= 0.5) { - // Bad score + // Bad score $captcha_mod == "standart"; $this->getUser()->setAttribute('badscore', true); } @@ -1174,7 +1165,6 @@ class stUserDataActions extends stActions if (!$validator->execute($captcha, $error) && $this->getUser()->getAttribute('captcha_off') != 1) { $this->getRequest()->setError('captcha', $error); - $error_exists = true; } else { @@ -1191,7 +1181,6 @@ class stUserDataActions extends stActions if (!$user_data_billing['full_name']) { $this->getRequest()->setError('user_data_billing{full_name}', $i18n->__('Brak imienia i nazwiska.')); - $error_exists = true; } } } @@ -1211,26 +1200,30 @@ class stUserDataActions extends stActions $error_exists = true; } - elseif (!$giftCard->isValidOrderAmount($this->getUser()->getBasket()->getTotalAmount(true, true))) + elseif (!$giftCard->isValidOrderAmount($basket->getTotalAmount(true, true))) { $error_exists = true; } } - if (isset($user_data_billing['different_delivery'])) + $basketItemValidator = new stBasketItemValidator($basket); + $basketItemValidator->initialize($this->getContext()); + + foreach ($basket->getItems() as $item) { - $country = $user_data_delivery['customer_type'] == 1 ? CountriesPeer::retrieveById($user_data_delivery['country']) : null; - } - else - { - $country = $user_data_billing['customer_type'] == 1 ? CountriesPeer::retrieveById($user_data_billing['country']) : null; + if (!$basketItemValidator->execute($item, $error)) + { + $this->getRequest()->setError('basket{products}{' . $item->getItemId() . '}', $error); + } } $validator = new stOrderMinAmountValidator(); - $validator->initialize($this->getContext(), array('country' => $country)); - $totalAmount = $this->getUser()->getBasket()->getTotalAmount(true); + $validator->initialize($this->getContext(), [ + 'country' => $frontendDelivery->getDefaultDeliveryCountry(), + 'is_customer' => $isCustomerAccount + ]); - if (!$validator->execute($totalAmount, $error)) + if (!$validator->execute($totalBasketAmount, $error)) { $error_exists = true; $this->setFlash('warning', $error, false); @@ -1253,15 +1246,13 @@ class stUserDataActions extends stActions { $this->getRequest()->setError('user_data_billing{vat_number}', $i18n->__('Podany numer VAT UE nie spełnia wymogów wewnątrzwspólnotowego nabycia towarów', null, 'stUserData')); $this->getUser()->setValidVatEu(false); - $error_exists = true; } elseif ($billingCountry->getIsoA2() != $cc) { $this->getRequest()->setError('user_data_billing{country}', $i18n->__('Wybrany kraj nie jest zgodny z podanym numerem VAT UE')); $this->getUser()->setValidVatEu(false); - $error_exists = true; } - elseif (!$error_exists && !stTaxVies::getInstance()->checkVat($user_data_billing['vat_number'])) + elseif (!$error_exists && !$this->getRequest()->hasErrors() && !stTaxVies::getInstance()->checkVat($user_data_billing['vat_number'])) { if (null !== stTaxVies::getInstance()->getSoapFault()) { @@ -1272,8 +1263,7 @@ class stUserDataActions extends stActions $this->getRequest()->setError('user_data_billing{vat_number}', $i18n->__('Podany numer VAT UE jest nieaktywny lub nieprawidłowy')); } - $this->getUser()->setValidVatEu(false); - $error_exists = true; + $this->getUser()->setValidVatEu(false); } else { @@ -1281,7 +1271,42 @@ class stUserDataActions extends stActions } } - return !$error_exists; + if (null !== $delivery->getDefaultPayment()) + { + $payment = $delivery->getDefaultPayment(); + + if (null !== $delivery->getService()) + { + $valid = $delivery->getService()->validate($delivery->getDelivery(), + $payment->getDeliveryPayment()->getPaymentType(), + $orderTotalAmount, + $user_data_billing, + $user_data_delivery, + $pickupPoint, + $frontendDelivery->getIsWeekendDelivery(), + $frontendDelivery->getIsExpressDelivery(), + $deliveryErrors + ); + + if (!$valid) + { + foreach ($deliveryErrors as $name => $error) + { + $this->getRequest()->setError($name, $i18n->__($error)); + } + } + } + + if (null !== $payment->getPaymentTypeApi() && $payment->getPaymentTypeApi() instanceof stPaymentTypeInterface && !$payment->getPaymentTypeApi()->validate($user_data_billing, $user_data_delivery, $orderTotalAmount, $paymentErrors)) + { + foreach ($paymentErrors as $name => $error) + { + $this->getRequest()->setError($name, $error); + } + } + } + + return !$error_exists && !$this->getRequest()->hasErrors(); } public function validateCheckBasketUser() @@ -1289,26 +1314,26 @@ class stUserDataActions extends stActions $error_exists = false; $i18n = $this->getContext()->getI18N(); - - $billing = $this->getRequestParameter('user_data_billing', array()); - - $delivery = $this->getRequestParameter('user_data_delivery', array()); - + + $billing = $this->getRequestParameter('user_data_billing', array()); + + $delivery = $this->getRequestParameter('user_data_delivery', array()); + if ($billing['company'] || $billing['vatNumber']) { - if (!$billing['company']) + if (!$billing['company']) { $this->getRequest()->setError('user_data_billing{company}', $i18n->__('Brak firmy.')); $error_exists = true; } - + if (!$billing['vatNumber']) { $this->getRequest()->setError('user_data_billing{vatNumber}', $i18n->__('Brak nipu.')); $error_exists = true; } } - + if (!$billing['company'] && !$billing['vatNumber'] && !$billing['full_name']) { $this->getRequest()->setError('user_data_billing{message}', $i18n->__('Musisz podać imię i nazwisko lub dane firmowe.')); @@ -1317,9 +1342,9 @@ class stUserDataActions extends stActions $this->getRequest()->setError('user_data_billing{vatNumber}',''); $error_exists = true; } - - - + + + if (!$delivery['company'] && !$delivery['full_name']) { $this->getRequest()->setError('user_data_delivery{message}', $i18n->__('Musisz podać imię i nazwisko lub nazwę firmy.')); @@ -1330,74 +1355,68 @@ class stUserDataActions extends stActions return !$error_exists; } - + public function validateSaveProfile() { - + $error_exists = false; $i18n = $this->getContext()->getI18N(); $user_data = $this->getRequestParameter('user_data', array()); - + $user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser'); - + if($user_data['isBilling']==1) { - + if($user_data['customer_type']==2) { if (!$user_data['company']) { $this->getRequest()->setError('user_data{company}', $i18n->__('Brak firmy.')); - $error_exists = true; } if (!$user_data['vat_number']) { $this->getRequest()->setError('user_data{vat_number}', $i18n->__('Brak nipu.')); - $error_exists = true; } } - + if($user_data['customer_type']==1) { if (!$user_data['full_name']) { $this->getRequest()->setError('user_data{full_name}', $i18n->__('Brak imienia i nazwiska.')); - $error_exists = true; } } - - + + }else{ if($user_data['customer_type']==2) { if (!$user_data['company']) { $this->getRequest()->setError('user_data{company}', $i18n->__('Brak firmy.')); - $error_exists = true; } } - + if($user_data['customer_type']==1) { if (!$user_data['full_name']) { $this->getRequest()->setError('user_data{full_name}', $i18n->__('Brak imienia i nazwiska.')); - $error_exists = true; } } } - + if (!$user_data['phone'] && $user_config->get('validate_phone')==1) { $this->getRequest()->setError('user_data{phone}', $i18n->__('Brak telefonu.')); - $error_exists = true; } - - - return !$error_exists; + + + return !$this->getRequest()->hasErrors(); } @@ -1408,7 +1427,7 @@ class stUserDataActions extends stActions { if ($this->getRequest()->getMethod() == sfRequest::POST) { - + $this->forward('stOrder', 'confirm'); } } @@ -1434,7 +1453,7 @@ class stUserDataActions extends stActions public function handleErrorAddBasketUser() { $this->updateBasketUserData(); - + return $this->forward('stBasket', 'index'); } @@ -1477,38 +1496,198 @@ class stUserDataActions extends stActions } } - + public function executeAjaxProfileChange() { $id = $this->getRequestParameter('id'); - + $type = $this->getRequestParameter('type'); - + if($type=="billing") { + $this->getUser()->setAttribute('customer_type', null, 'soteshop/stUserData'); stUser::setDefaultUserData($id, 1, $this->getUser()->getGuardUser()->getId()); - $this->responseUpdateElement('user_'.$type.'_form_content', array('module' => 'stUserData', 'component' => 'orderFormBilling', 'params' => array('profile_id' => $id, 'type' => $type))); + $this->responseUpdateElement('user_'.$type.'_form_content', array( + 'module' => 'stUserData', + 'component' => 'orderFormBilling', + 'params' => array( + 'profile_id' => $id, + 'type' => $type, + 'force_default' => true, + ), + )); } - + if($type=="user_edit_profile_billing") { - - $this->responseUpdateElement('user_edit_profile_content', array('module' => 'stUserData', 'component' => 'ajaxEditProfile', 'params' => array('profile_id' => $id, 'type' => $type))); + + $this->responseUpdateElement('user_edit_profile_content', array('module' => 'stUserData', 'component' => 'ajaxEditProfile', 'params' => array('profile_id' => $id, 'type' => $type))); } - - + + if($type=="delivery") { stUser::setDefaultUserData($id, 0, $this->getUser()->getGuardUser()->getId()); - $this->responseUpdateElement('user_'.$type.'_form_content', array('module' => 'stUserData', 'component' => 'orderFormDelivery', 'params' => array('profile_id' => $id, 'type' => $type))); + $this->responseUpdateElement('user_'.$type.'_form_content', array( + 'module' => 'stUserData', + 'component' => 'orderFormDelivery', + 'params' => array( + 'profile_id' => $id, + 'type' => $type, + 'force_default' => true, + ), + )); } - + if($type=="user_edit_profile_delivery") { - $this->responseUpdateElement('user_edit_profile_content', array('module' => 'stUserData', 'component' => 'ajaxEditProfile', 'params' => array('profile_id' => $id, 'type' => $type))); - } - + $this->responseUpdateElement('user_edit_profile_content', array('module' => 'stUserData', 'component' => 'ajaxEditProfile', 'params' => array('profile_id' => $id, 'type' => $type))); + } + return $this->renderResponse(); } + + public function executeAddressList() + { + $this->smarty = new stSmarty($this->getModuleName()); + if($this->getUser()->isAuthenticated()) + { + + stUser::deleteEmptyUserData($this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); + + $userDataBillingDefault = $this->getUser()->getUserData(true, true); + foreach($userDataBillingDefault as $data) + { + $data->url_edit = st_url_for('stUserData/editProfile?userDataType=billing&userDataId=' . $data->getId() . '&showEditProfileForm=true'); + $data->url_delete = st_url_for('stUserData/deleteProfile?userDataType=billing&userDataId='.$data->getId()); + } + + $userDataBilling = $this->getUser()->getUserData(false, true); + foreach($userDataBilling as $data) + { + if(empty($data->getAddress())){ + return false; // Usuń ten obiekt + } + + $data->url_edit = st_url_for('stUserData/editProfile?userDataType=billing&userDataId=' . $data->getId() . '&showEditProfileForm=true'); + $data->url_delete = st_url_for('stUserData/deleteProfile?userDataType=billing&userDataId='.$data->getId()); + } + + + $userDataDeliveryDefault = $this->getUser()->getUserData(true, false); + foreach($userDataDeliveryDefault as $data) + { + $data->url_edit = st_url_for('stUserData/editProfile?userDataType=delivery&userDataId=' . $data->getId() . '&showEditProfileForm=true'); + $data->url_delete = st_url_for('stUserData/deleteProfile?userDataType=delivery&userDataId='.$data->getId()); + } + + $userDataDelivery = $this->getUser()->getUserData(false, false); + foreach($userDataDelivery as $data) + { + if(empty($data->getAddress())){ + return false; // Usuń ten obiekt + } + + $data->url_edit = st_url_for('stUserData/editProfile?userDataType=delivery&userDataId=' . $data->getId() . '&showEditProfileForm=true'); + $data->url_delete = st_url_for('stUserData/deleteProfile?userDataType=delivery&userDataId='.$data->getId()); + } + + /*echo "
";
+ print_r($userDataBilling);*/
+
+ $this->userDataBillingDefault = $userDataBillingDefault;
+ $this->userDataBilling = $userDataBilling;
+ $this->userDataDeliveryDefault = $userDataDeliveryDefault;
+ $this->userDataDelivery = $userDataDelivery;
+
+
+ }
+ else
+ {
+ stUser::processAuthentication();
+ }
+ }
+
+ public function executeProductList()
+ {
+ $this->smarty = new stSmarty($this->getModuleName());
+ $type = $this->getFilteredRequestParameter('type', sfDataFilterPlainTextType::class);
+ $this->type = $type;
+
+ $allowed = ['last', 'observe'];
+ if (!in_array($type, $allowed, true)) {
+ throw new sfException(sprintf(
+ 'Bad type "%s". Allowed types are: %s.',
+ $type,
+ implode(', ', $allowed)
+ ));
+ }
+
+ stProductFilter::disable();
+
+ $ids = array();
+
+ $this->is_authenticated = $this->getUser()->isAuthenticated();
+
+ if($type == "last")
+ {
+ $this->tab = 8;
+
+ $utd_cookie = stUserTrackerLevelInterface::getUTDCookie();
+
+ if(isset($utd_cookie['product_view_recently']) && !empty($utd_cookie['product_view_recently']))
+ {
+ $ids = $utd_cookie['product_view_recently'];
+ $ids = array_reverse($ids);
+ }
+ }
+
+ if($type == "observe")
+ {
+ $this->tab = 9;
+
+ $utd_cookie = stUserTrackerLevelInterface::getUTDCookie();
+
+ if(isset($utd_cookie['product_observe']))
+ {
+ $ids = $utd_cookie['product_observe'];
+ $ids = array_reverse($ids);
+ }
+ }
+
+ if($ids)
+ {
+ // złącz listę ID w ciąg "1,2,3,4"
+ $inList = implode(',', $ids);
+
+ $c = new Criteria();
+ $c -> add(ProductPeer::ACTIVE, 1);
+ $c->add(ProductPeer::ID, $ids, Criteria::IN);
+ $c->addAscendingOrderByColumn("FIELD(" . ProductPeer::ID . ", $inList)");
+ $c->setLimit(100);
+
+ $this->productPagerInit($c);
+
+ }
+
+ }
+
+ protected function productPagerInit(Criteria $c)
+ {
+
+ $config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
+
+ $this->product_pager = new stPropelPager('Product', $config->get('long_list'));
+
+ $c = clone $c;
+
+ $this->product_pager->setPage($this->getFilteredRequestParameter('page', sfDataFilterIntType::class));
+
+ $this->product_pager->setCriteria($c);
+
+ $this->product_pager->setPeerMethod('doSelect');
+
+ $this->product_pager->init();
+ }
}
diff --git a/apps/frontend/modules/stUserData/actions/components.class.php b/apps/frontend/modules/stUserData/actions/components.class.php
index 0bf8426..fa0bc5d 100644
--- a/apps/frontend/modules/stUserData/actions/components.class.php
+++ b/apps/frontend/modules/stUserData/actions/components.class.php
@@ -197,6 +197,8 @@ class stUserDataComponents extends sfComponents
$this->panel_navigator = stTabNavigator::getInstance($this->getContext(), null, null, false);
$this->panel_navigator->addTab('Moje konto', 'stUserData', 'userPanel', null, 'userPanel');
$this->panel_navigator->addTab('Moje dane', 'stUser', 'editAccount', null, 'editAccount');
+
+ $this->panel_navigator->addTab('Lista produktow', 'stUserData', 'productList', null, 'productList');
$this->panel_navigator->setTab(isset($this->action)? $this->action : $this->getActionName());
$this->getDispatcher()->notify(new sfEvent($this, 'stUserDataComponents.postExecuteUserPanelMenu'));
@@ -208,6 +210,11 @@ class stUserDataComponents extends sfComponents
$this->smarty = new stSmarty('stUserData');
}
+ public function executeResponsiveUserPanelBreadcrumbs()
+ {
+ $this->smarty = new stSmarty('stUserData');
+ }
+
public function updateUserLoginForm($user_data, $request_parameter)
@@ -275,7 +282,6 @@ class stUserDataComponents extends sfComponents
*/
public function executeOrderFormBilling()
{
- $delivery = stDeliveryFrontend::getInstance(stBasket::getInstance($this->getUser()));
$this->smarty = new stSmarty('stUserData');
$user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser');
@@ -294,37 +300,55 @@ class stUserDataComponents extends sfComponents
$this->show_region = $user_config->get('show_region');
$this->show_pesel = $user_config->get('show_pesel');
- $this->show_address_more = $user_config->get('show_address_more');
+ $this->show_address_more = $user_config->get('show_address_more');
+ $user_data_billing = $this->getRequestParameter('user_data_billing', []);
- $userDataBilling = new UserData();
-
- if ($this->getUser()->isAuthenticated() && !$this->getRequestParameter('user_data_billing'))
+ if ($this->getUser()->isAuthenticated())
{
+ /**
+ * @var UserData|null $userDataDefaultBilling
+ */
$userDataDefaultBilling = isset($this->profile_id) ? UserDataPeer::retrieveByPK($this->profile_id) : $this->getUser()->getUserDataDefaultbilling();
- $user = new stUser();
if(!$userDataDefaultBilling)
{
$userDataDefaultBilling = stUser::addEmptyUserData(1,1);
- }
+ };
- $user_data_billing['company'] = $userDataDefaultBilling->getCompany();
- $user_data_billing['vat_number'] = $userDataDefaultBilling->getVatNumber();
- $user_data_billing['customer_type'] = $user_data_billing['company'] ? 2 : 1;
- $user_data_billing['full_name'] = $userDataDefaultBilling->getFullName();
- $user_data_billing['address'] = $userDataDefaultBilling->getAddress();
- $user_data_billing['address_more'] = $userDataDefaultBilling->getAddressMore();
- $user_data_billing['code'] = $userDataDefaultBilling->getCode();
- $user_data_billing['town'] = $userDataDefaultBilling->getTown();
- $user_data_billing['phone'] = $userDataDefaultBilling->getPhone();
- $userDataBilling->setCountriesId($userDataDefaultBilling->getCountriesId());
- $user_data_billing['country'] = $userDataDefaultBilling->getCountriesId();
- $user_data_billing['pesel'] = $userDataDefaultBilling->getPesel();
+ $fields = [
+ 'company',
+ 'vat_number',
+ 'customer_type',
+ 'full_name',
+ 'address',
+ 'address_more',
+ 'region',
+ 'code',
+ 'town',
+ 'phone',
+ 'country',
+ 'pesel',
+ 'customer_type',
+ ];
+
+ $userDataDefaulBillingFields = $userDataDefaultBilling->toArray(BasePeer::TYPE_FIELDNAME);
+ $userDataDefaulBillingFields['customer_type'] = $userDataDefaultBilling->getCustomerType();
+
+ foreach ($fields as $field)
+ {
+ if (!isset($user_data_billing[$field]) || $this->getVar('force_default'))
+ {
+ $defaultField = $field === 'country' ? 'countries_id' : $field;
+ $user_data_billing[$field] = $userDataDefaulBillingFields[$defaultField];
+ }
+ }
+
+ $user_data_billing['description'] = "";
}
- else
+
+ if (!isset($user_data_billing['customer_type']))
{
- $user_data_billing = $this->getRequestParameter('user_data_billing');
- $userDataBilling->setCountriesId($user_data_billing['country']);
+ $user_data_billing['customer_type'] = 1;
}
if ($this->getUser()->hasVatEu())
@@ -333,8 +357,6 @@ class stUserDataComponents extends sfComponents
}
$this->user_data_billing = $user_data_billing;
-
- $this->userDataBilling = $userDataBilling;
}
/**
@@ -342,10 +364,8 @@ class stUserDataComponents extends sfComponents
*/
public function executeOrderFormDelivery()
{
- $this->smarty = new stSmarty('stUserData');
-
$basket = stBasket::getInstance($this->getUser());
-
+ $this->smarty = new stSmarty('stUserData');
$this->delivery = stDeliveryFrontend::getInstance($basket);
$user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser');
@@ -353,30 +373,48 @@ class stUserDataComponents extends sfComponents
$this->show_region = $user_config->get('show_region');
$this->show_pesel = $user_config->get('show_pesel');
$this->show_address_more = $user_config->get('show_address_more');
+ $user_data_delivery = $this->getRequestParameter('user_data_delivery');
- if ($this->getUser()->isAuthenticated() && !$this->getRequestParameter('user_data_delivery'))
+ if ($this->getUser()->isAuthenticated())
{
+ /**
+ * @var UserData|null $userDataDefaultDelivery
+ */
$userDataDefaultDelivery = isset($this->profile_id) ? UserDataPeer::retrieveByPK($this->profile_id) : $this->getUser()->getUserDataDefaultDelivery();
- $user = new stUser();
if(!$userDataDefaultDelivery)
{
$userDataDefaultDelivery = stUser::addEmptyUserData(0,1);
}
-
- $user_data_delivery['company'] = $userDataDefaultDelivery->getCompany();
- $user_data_delivery['customer_type'] = $user_data_delivery['company'] ? 2 : 1;
- $user_data_delivery['full_name'] = $userDataDefaultDelivery->getFullName();
- $user_data_delivery['address'] = $userDataDefaultDelivery->getAddress();
- $user_data_delivery['address_more'] = $userDataDefaultDelivery->getAddressMore();
- $user_data_delivery['region'] = $userDataDefaultDelivery->getRegion();
- $user_data_delivery['code'] = $userDataDefaultDelivery->getCode();
- $user_data_delivery['town'] = $userDataDefaultDelivery->getTown();
- $user_data_delivery['phone'] = $userDataDefaultDelivery->getPhone();
+
+ $fields = [
+ 'company',
+ 'customer_type',
+ 'full_name',
+ 'address',
+ 'address_more',
+ 'region',
+ 'code',
+ 'town',
+ 'phone',
+ ];
+
+ $userDataDefaultDeliveryFields = $userDataDefaultDelivery->toArray(BasePeer::TYPE_FIELDNAME);
+ $userDataDefaultDeliveryFields['customer_type'] = $userDataDefaultDelivery->getCustomerType();
+
+ foreach ($fields as $field)
+ {
+ if (!isset($user_data_delivery[$field]) || $this->getVar('force_default'))
+ {
+ $defaultField = $field === 'country' ? 'countries_id' : $field;
+ $user_data_delivery[$field] = $userDataDefaultDeliveryFields[$defaultField];
+ }
+ }
}
- else
+
+ if (!isset($user_data_delivery['customer_type']))
{
- $user_data_delivery = $this->getRequestParameter('user_data_delivery');
+ $user_data_delivery['customer_type'] = 1;
}
$this->user_data_delivery = $user_data_delivery;
@@ -389,69 +427,17 @@ class stUserDataComponents extends sfComponents
*/
public function executeOrderForm()
{
- $this->smarty = new stSmarty('stUserData');
-
+ $smarty = new stSmarty('stUserData');
$basket = stBasket::getInstance($this->getUser());
- $this->delivery = stDeliveryFrontend::getInstance($basket);
-
- $this->config = stConfig::getInstance($this->getContext(), 'stSecurityBackend');
-
- $invoice_config = stConfig::getInstance($this->getContext(), 'stInvoiceBackend');
-
- if($invoice_config->get('invoice_on')==1)
- {
- $this->show_invoice_request = 1;
-
- if($invoice_config->get('auto_invoice_on')==1)
- {
- $this->auto_invoice_request = 1;
- }
- }
-
- $user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser');
-
- $this->show_region = $user_config->get('show_region');
- $this->show_pesel = $user_config->get('show_pesel');
- $this->show_address_more = $user_config->get('show_address_more');
-
-
- $user_data_billing = $this->getRequestParameter('user_data_billing', array());
- $user_data_delivery = $this->getRequestParameter('user_data_delivery', array());
-
- if (!$user_data_billing && !$user_data_delivery)
- {
- if (!isset($user_data_billing['customer_type']))
- {
- $user_data_billing['customer_type'] = 1;
- }
-
- if (!isset($user_data_delivery['customer_type']))
- {
- $user_data_delivery['customer_type'] = 1;
- }
-
- if($user_config->get('change_default_user'))
- {
- $user_data_billing['customer_type'] = 2;
- $user_data_delivery['customer_type'] = 2;
- }
-
- if ($this->getUser()->hasVatEu())
- {
- $user_data_billing['customer_type'] = 2;
- }
- }
-
- $this->user_data_billing = $user_data_billing;
- $this->user_data_delivery = $user_data_delivery;
-
- if ($this->getRequest()->getMethod() == sfRequest::POST && $this->hasRequestParameter('submit_save'))
- {
- $this->user_basket_form_error = $this->hasRequestParameter('submit_save');
- }
-
- $this->delivery_country_id = $this->delivery->getDefaultDeliveryCountry() ? $this->delivery->getDefaultDeliveryCountry()->getId() : null;
+ $this->setVar('delivery', stDeliveryFrontend::getInstance($basket));
+ $this->setVar('config', stConfig::getInstance('stSecurityBackend'));
+ $this->setVar('user_config', stConfig::getInstance('stUser'));
+ $this->setVar('smarty', $smarty);
+ $this->setVar('user_data_billing', $this->getUserDataBilling());
+ $this->setVar('user_data_delivery', $this->getUserDataDelivery());
+ $this->setVar('user_basket_form_error', $this->getRequest()->getMethod() == sfRequest::POST && $this->hasRequestParameter('submit_save'));
+ $this->setVar('delivery_country_id', $this->delivery->getDefaultDeliveryCountry() ? $this->delivery->getDefaultDeliveryCountry()->getId() : null);
}
/**
@@ -669,7 +655,58 @@ class stUserDataComponents extends sfComponents
$this->user_data = $user_data;
$this->userData = $userDataDefault;
+ }
+
+ protected function getUserDataBilling(): array
+ {
+ $userConfig = stConfig::getInstance('stUser');
+ $data = $this->getRequestParameter('user_data_billing', []);
+
+ return array_replace([
+ 'company' => null,
+ 'vat_number' => null,
+ 'full_name' => null,
+ 'address' => null,
+ 'region' => null,
+ 'code' => null,
+ 'town' => null,
+ 'phone' => null,
+ 'email' => null,
+ 'email_exist' => null,
+ 'password1' => null,
+ 'password2' => null,
+ 'password_parse' => null,
+ 'privacy' => null,
+ 'terms' => null,
+ 'country' => null,
+ 'create_account' => null,
+ 'address_more' => null,
+ 'pesel' => null,
+ 'customer_type' => $userConfig->get('change_default_user') || $this->getUser()->hasVatEu() ? UserData::COMPANY_TYPE : UserData::CUSTOMER_TYPE,
+ 'different_delivery' => null,
+ 'description' => null,
+ 'not_professional_purchase' => null,
+ ], $data);
+ }
+
+ protected function getUserDataDelivery(): array
+ {
+ $userConfig = stConfig::getInstance('stUser');
+ $data = $this->getRequestParameter('user_data_delivery', []);
+ return array_replace([
+ 'company' => null,
+ 'vat_number' => null,
+ 'full_name' => null,
+ 'address' => null,
+ 'region' => null,
+ 'code' => null,
+ 'town' => null,
+ 'phone' => null,
+ 'country' => null,
+ 'address_more' => null,
+ 'customer_type' => $userConfig->get('change_default_user') ? UserData::COMPANY_TYPE : UserData::CUSTOMER_TYPE,
+ ], $data);
}
}
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/_ajaxEditProfile.php b/apps/frontend/modules/stUserData/templates/_ajaxEditProfile.php
index b6fe817..6159657 100644
--- a/apps/frontend/modules/stUserData/templates/_ajaxEditProfile.php
+++ b/apps/frontend/modules/stUserData/templates/_ajaxEditProfile.php
@@ -32,16 +32,16 @@ if($user_config->get('validate_phone')==1){
get('validate_phone')==1 ? $phone_label = "* ".__('Telefon') : $phone_label = __('Telefon'); ?>
-assign('input_company', input_tag('user_data[company]', $userData->getCompany(), array('id'=>'company', 'placeholder'=> '* '.__("Firma"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_nip', input_tag('user_data[vat_number]', $userData->getVatNumber(), array('id'=>'nip','placeholder'=> "* ".__($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"), 'maxlength'=>'255', 'class'=>'form-control'))) ?>
-assign('input_full_name', input_tag('user_data[full_name]', $userData->getFullName(), array('id'=>'full_name', 'placeholder'=> "* ".__('Imię i nazwisko'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_address', input_tag('user_data[address]', $userData->getAddress(), array('id'=>'address', 'placeholder'=> '* '.__("Adres"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_address_more', input_tag('user_data[address_more]', $userData->getAddressMore(), array('id'=>'address_more', 'placeholder'=>__("Adres ciąg dalszy"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_region', input_tag('user_data[region]', $userData->getRegion(), array('id'=>'region', 'placeholder'=>__("Województwo"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_code', input_tag('user_data[code]', $userData->getCode(), array('id'=>'code', 'placeholder'=> '* '.__("Kod"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_town', input_tag('user_data[town]', $userData->getTown(), array('id'=>'town', 'placeholder'=> '* '.__("Miasto"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_phone', input_tag('user_data[phone]', $userData->getPhone(), array('id'=>'phone', 'placeholder'=> $phone_label, 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_pesel', input_tag('user_data[pesel]', $userData->getPesel(), array('id'=>'billing-pesel', 'placeholder'=>__('PESEL'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_company', input_tag('user_data[company]', $userData->getCompany(), array('id'=>'company', 'placeholder'=> '* '.__("Firma"), 'aria-label'=> __("Firma"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_nip', input_tag('user_data[vat_number]', $userData->getVatNumber(), array('id'=>'nip','placeholder'=> "* ".__($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"), 'aria-label'=> __($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"), 'maxlength'=>'255', 'class'=>'form-control'))) ?>
+assign('input_full_name', input_tag('user_data[full_name]', $userData->getFullName(), array('id'=>'full_name', 'placeholder'=> "* ".__('Imię i nazwisko'), 'aria-label'=> __('Imię i nazwisko'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_address', input_tag('user_data[address]', $userData->getAddress(), array('id'=>'address', 'placeholder'=> '* '.__("Adres"), 'aria-label'=> __("Adres"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_address_more', input_tag('user_data[address_more]', $userData->getAddressMore(), array('id'=>'address_more', 'placeholder'=>__("Adres ciąg dalszy"), 'aria-label'=>__("Adres ciąg dalszy"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_region', input_tag('user_data[region]', $userData->getRegion(), array('id'=>'region', 'placeholder'=>__("Województwo"), 'aria-label'=>__("Województwo"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_code', input_tag('user_data[code]', $userData->getCode(), array('id'=>'code', 'placeholder'=> '* '.__("Kod"), 'aria-label'=> __("Kod"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_town', input_tag('user_data[town]', $userData->getTown(), array('id'=>'town', 'placeholder'=> '* '.__("Miasto"), 'aria-label'=> __("Miasto"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_phone', input_tag('user_data[phone]', $userData->getPhone(), array('id'=>'phone', 'placeholder'=> $phone_label, 'aria-label'=> __('Telefon'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+assign('input_pesel', input_tag('user_data[pesel]', $userData->getPesel(), array('id'=>'billing-pesel', 'placeholder'=>__('PESEL'), 'aria-label'=>__('PESEL'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
assign('is_default', $userData->getIsDefault()) ?>
diff --git a/apps/frontend/modules/stUserData/templates/_editProfileForm.php b/apps/frontend/modules/stUserData/templates/_editProfileForm.php
index b7d512a..1157161 100644
--- a/apps/frontend/modules/stUserData/templates/_editProfileForm.php
+++ b/apps/frontend/modules/stUserData/templates/_editProfileForm.php
@@ -1,167 +1,140 @@
-
-
-
-
-
-assign('show_region', $show_region);?>
-assign('show_pesel', $show_pesel);?>
-assign('show_address_more', $show_address_more);?>
-
-assign('form_start', form_tag('stUserData/saveProfile', array('class' => 'st_form_ver6', 'name'=>'register'))) ?>
-assign('error_message', form_error('user_data[message]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_company', form_error('user_data[company]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_full_name', form_error('user_data[full_name]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_address', form_error('user_data[address]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_address_more', form_error('user_data[address_more]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_region', form_error('user_data[region]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_code', form_error('user_data[code]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_town', form_error('user_data[town]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_phone', form_error('user_data[phone]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_vat', form_error('user_data[vat_number]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-
-assign('error_company', $sf_request->getError('user_data{company}')); ?>
-assign('error_nip', $sf_request->getError('user_data{vat_number}')); ?>
-assign('error_full_name', $sf_request->getError('user_data{full_name}')); ?>
-assign('error_address', $sf_request->getError('user_data{address}')); ?>
-assign('error_region', $sf_request->getError('user_data{region}')); ?>
-assign('error_code_town', $sf_request->getError('user_data{code}').$sf_request->getError('user_data{town}')); ?>
-assign('error_code', $sf_request->getError('user_data{code}')); ?>
-assign('error_town', $sf_request->getError('user_data{town}')); ?>
-assign('error_phone', $sf_request->getError('user_data{phone}')); ?>
-
-
-getIsBilling()==1): ?>
- assign('billing_data', $userData->getIsBilling()==1) ?>
-
-
-assign('label_customer_type1', __('Klient indywidualny')) ?>
-assign('radio_customer_type1', radiobutton_tag('user_data[customer_type]', 1, $type1_checker)) ?>
-
-assign('label_customer_type2', __('Firma')) ?>
-assign('radio_customer_type2', radiobutton_tag('user_data[customer_type]', 2, $type2_checker)) ?>
-
-assign('label_company', label_for('company',"* ".__('Firma'))) ?>
-assign('input_company', input_tag('user_data[company]', $userData->getCompany(), array('id'=>'company', 'maxlength'=>'255', 'class'=>form_has_error('user_data{company}') ? 'st_form-error' : ''))) ?>
-
-assign('label_full_name', label_for('full_name',"* ".__('Imię i nazwisko'), array('id'=>'full_name_label'))) ?>
-assign('label_full_name_text', __('Imię i nazwisko')); ?>
-assign('input_full_name', input_tag('user_data[full_name]', $userData->getFullName(), array('id'=>'full_name', 'maxlength'=>'255', 'class'=>form_has_error('user_data{full_name}') ? 'st_form-error' : ''))) ?>
-
-assign('label_address', label_for('address',"* ".__('Ulica nr domu / nr lokalu'))) ?>
-assign('input_address', input_tag('user_data[address]', $userData->getAddress(), array('id'=>'address', 'maxlength'=>'255', 'class'=>form_has_error('user_data{address}') ? 'st_form-error' : ''))) ?>
-
-assign('label_address_more', label_for('address_more',__('Adres ciąg dalszy'))) ?>
-assign('input_address_more', input_tag('user_data[address_more]', $userData->getAddressMore(), array('id'=>'address_more', 'maxlength'=>'255', 'class'=>form_has_error('user_data{address_more}') ? 'st_form-error' : ''))) ?>
-
-assign('label_region', label_for('region',__('Województwo'))) ?>
-assign('input_region', input_tag('user_data[region]', $userData->getRegion(), array('id'=>'region', 'maxlength'=>'255'))) ?>
-
-assign('label_pesel', label_for('pesel',__('PESEL'))) ?>
-assign('input_pesel', input_tag('user_data[pesel]', $userData->getPesel(), array('id'=>'pesel', 'maxlength'=>'255'))) ?>
-
-assign('label_code', label_for('code',"* ".__('Kod'))) ?>
-assign('input_code', input_tag('user_data[code]', $userData->getCode(), array('id'=>'code', 'maxlength'=>'255', 'class'=>form_has_error('user_data{code}') ? 'st_form-error code' : 'code'))) ?>
-
-assign('label_town', label_for('town',"* ".__('Miasto'))) ?>
-assign('input_town', input_tag('user_data[town]', $userData->getTown(), array('id'=>'town', 'maxlength'=>'255', 'class'=>form_has_error('user_data{town}') ? 'st_form-error town' : 'town'))) ?>
-
-assign('label_country', label_for('st_form-userData-field6',__('Kraj'))) ?>
-
-getIsBilling()!=1): ?>
-
- getAddress()==""): ?>
-
- assign('select_country', st_get_component('stUserData', 'deliveryCountriesSelect', array('id'=>'user_data_country','force_default_country_id' => $userData->getCountriesId()))) ?>
-
-
-
- assign('select_country', object_select_tag($userData->getCountriesId(), 'getId', array('id'=>'user_data_country', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data[country]'))) ?>
-
-
-
-
-
- assign('select_country', object_select_tag($userData->getCountriesId(), 'getId', array('id'=>'user_data_country', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data[country]'))) ?>
-
-
-
get('validate_phone')==1){
- $smarty->assign('label_phone', label_for('phone',"* ".__('Telefon')));
-}else{
- $smarty->assign('label_phone', label_for('phone',__('Telefon')));
-}
-?>
+use_helper('Validation', 'Object');
+st_theme_use_stylesheet('stUser.css');
+use_javascript('jquery.infieldlabel.js', 'last');
+$user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser');
-assign('input_phone', input_tag('user_data[phone]', $userData->getPhone(), array('id'=>'phone', 'maxlength'=>'255', 'class'=>form_has_error('user_data{phone}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('show_region', $show_region);
+$smarty->assign('show_pesel', $show_pesel);
+$smarty->assign('show_address_more', $show_address_more);
+$smarty->assign('form_start', form_tag('stUserData/saveProfile', array('class' => 'st_form_ver6', 'name'=>'register')));
+$smarty->assign('error_message', form_error('user_data[message]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')));
+$smarty->assign('error_address_more', form_error('user_data[address_more]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')));;
+$smarty->assign('error_vat', form_error('user_data[vat_number]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')));
+
+$smarty->assign('error_company', $sf_request->getError('user_data{company}'));
+$smarty->assign('error_nip', $sf_request->getError('user_data{vat_number}'));
+$smarty->assign('error_full_name', $sf_request->getError('user_data{full_name}'));
+$smarty->assign('error_address', $sf_request->getError('user_data{address}'));
+$smarty->assign('error_code_town', $sf_request->getError('user_data{code}').$sf_request->getError('user_data{town}'));
+$smarty->assign('error_code', $sf_request->getError('user_data{code}'));
+$smarty->assign('error_town', $sf_request->getError('user_data{town}'));
+$smarty->assign('error_phone', $sf_request->getError('user_data{phone}'));
+
+
+if ($userData->getIsBilling()==1):
+ $smarty->assign('billing_data', $userData->getIsBilling()==1);
+endif;
+
+$smarty->assign('label_customer_type1', __('Klient indywidualny'));
+$smarty->assign('radio_customer_type1', radiobutton_tag('user_data[customer_type]', 1, $type1_checker, array('style'=>'margin-left: 0px;')));
+
+$smarty->assign('label_customer_type2', __('Firma'));
+$smarty->assign('radio_customer_type2', radiobutton_tag('user_data[customer_type]', 2, $type2_checker, array('style'=>'margin-left: 0px;')));
-assign('label_nip', label_for('nip',"* ".__($sf_user->hasVatEu() ? 'VAT UE' : 'NIP'))) ?>
-assign('input_nip', input_tag('user_data[vat_number]', $userData->getVatNumber(), array('id'=>'nip', 'maxlength'=>'255', 'class'=>form_has_error('user_data{vat_number}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('hidden_is_default', input_hidden_tag('user_data[isDefault]', $userData->getIsDefault()));
-assign('hidden_is_default', input_hidden_tag('user_data[isDefault]', $userData->getIsDefault())) ?>
+if(stTheme::is_responsive()):
-
+ if ($userData->getIsBilling()==1){
+ $smarty->assignComponent('edit_profiles', 'stUserData', 'profileList', array('type' => 'user_edit_profile_billing', 'selected' => $sf_request->getParameter('user_billing_profile')));
+ }else{
+ $smarty->assignComponent('edit_profiles', 'stUserData', 'profileList', array('type' => 'user_edit_profile_delivery', 'selected' => $sf_request->getParameter('user_delivery_profile')));
+ }
-getIsBilling()==1): ?>
-assignComponent('edit_profiles', 'stUserData', 'profileList', array('type' => 'user_edit_profile_billing', 'selected' => $sf_request->getParameter('user_billing_profile'))); ?>
-
-assignComponent('edit_profiles', 'stUserData', 'profileList', array('type' => 'user_edit_profile_delivery', 'selected' => $sf_request->getParameter('user_delivery_profile'))); ?>
-
+ $show_message = '';
+ if($showMessage == true){
+ $show_message = true;
+ }
+ $smarty->assign('show_message', $show_message);
-
- assign('show_message', $showMessage) ?>
-
+ $user_config->get('validate_phone')==1 ? $phone_label = "* ".__('Telefon') : $phone_label = __('Telefon');
+
+ // company
+ $user_data_company_array = array('id'=>'company', 'maxlength'=>'255', 'class'=>'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data{company}')){
+ $user_data_company_array += array('aria-describedby'=>"error_company", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_company', input_tag('user_data[company]', $userData->getCompany(), $user_data_company_array));
-get('validate_phone')==1 ? $phone_label = "* ".__('Telefon') : $phone_label = __('Telefon'); ?>
+ // nip
+ $smarty->assign("nip_label", __($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"));
+ $user_data_nip_array = array('id'=>'nip', 'maxlength'=>'255', 'class'=>'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data{vat_number}')){
+ $user_data_nip_array += array('aria-describedby'=>"error_nip", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_nip', input_tag('user_data[vat_number]', $userData->getVatNumber(), $user_data_nip_array));
-
-assign('input_company', input_tag('user_data[company]', $userData->getCompany(), array('id'=>'company', 'placeholder'=> '* '.__("Firma"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_nip', input_tag('user_data[vat_number]', $userData->getVatNumber(), array('id'=>'nip','placeholder'=> "* ".__($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"), 'maxlength'=>'255', 'class'=>'form-control'))) ?>
-assign('input_full_name', input_tag('user_data[full_name]', $userData->getFullName(), array('id'=>'full_name', 'placeholder'=> "* ".__('Imię i nazwisko'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_address', input_tag('user_data[address]', $userData->getAddress(), array('id'=>'address', 'placeholder'=> '* '.__("Ulica nr domu / nr lokalu"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_address_more', input_tag('user_data[address_more]', $userData->getAddressMore(), array('id'=>'address_more', 'placeholder'=>__("Adres ciąg dalszy"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_region', input_tag('user_data[region]', $userData->getRegion(), array('id'=>'region', 'placeholder'=>__("Województwo"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_code', input_tag('user_data[code]', $userData->getCode(), array('id'=>'code', 'placeholder'=> '* '.__("Kod"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_town', input_tag('user_data[town]', $userData->getTown(), array('id'=>'town', 'placeholder'=> '* '.__("Miasto"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_phone', input_tag('user_data[phone]', $userData->getPhone(), array('id'=>'phone', 'placeholder'=> $phone_label, 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_pesel', input_tag('user_data[pesel]', $userData->getPesel(), array('id'=>'billing-pesel', 'placeholder'=>__('PESEL'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+ // full name
+ $user_data_full_name_array = array('id'=>'full_name', 'maxlength'=>'255', 'class'=>'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data{full_name}')){
+ $user_data_full_name_array += array('aria-describedby'=>"error_full_name", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_full_name', input_tag('user_data[full_name]', $userData->getFullName(), $user_data_full_name_array));
-assign('show_add', $userData->getAddress()); ?>
+ // address
+ $user_data_address_array = array('id'=>'address', 'maxlength'=>'255', 'class'=>'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data{address}')){
+ $user_data_address_array += array('aria-describedby'=>"error_address", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_address', input_tag('user_data[address]', $userData->getAddress(), $user_data_address_array));
+ $smarty->assign('input_address_more', input_tag('user_data[address_more]', $userData->getAddressMore(), array('id'=>'address_more', 'maxlength'=>'255', 'class'=>'form-control')));
+ // region
+ $smarty->assign('input_region', input_tag('user_data[region]', $userData->getRegion(), array('id'=>'region', 'maxlength'=>'255', 'class'=>'form-control')));
-getIsBilling()!=1): ?>
+ // code
+ $user_data_code_array = array('id'=>'code', 'maxlength'=>'255', 'class'=>'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data{code}')){
+ $user_data_code_array += array('aria-describedby'=>"error_code", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_code', input_tag('user_data[code]', $userData->getCode(), $user_data_code_array));
- getAddress()==""): ?>
+ // town
+ $user_data_town_array = array('id'=>'town', 'maxlength'=>'255', 'class'=>'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data{town}')){
+ $user_data_town_array += array('aria-describedby'=>"error_town", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_town', input_tag('user_data[town]', $userData->getTown(), $user_data_town_array));
- assign('select_country', st_get_component('stUserData', 'deliveryCountriesSelect', array('id'=>'user_data_country','force_default_country_id' => $userData->getCountriesId()))) ?>
+ // phone
+ $user_data_phone_array = array('id'=>'phone', 'maxlength'=>'255', 'class'=>'form-control');
+ $smarty->assign('validate_phone',0);
+ if($user_config->get('validate_phone') == 1){
+ $smarty->assign('validate_phone',1);
+ $user_data_phone_array += array('aria-required'=>"true");
+ if ($sf_request->getError('user_data{phone}')){
+ $user_data_phone_array += array('aria-describedby'=>"error_phone", 'aria-invalid'=>"true");
+ }
+ }
+ $smarty->assign('input_phone', input_tag('user_data[phone]', $userData->getPhone(), $user_data_phone_array));
-
+ // pesel
+ $smarty->assign('input_pesel', input_tag('user_data[pesel]', $userData->getPesel(), array('id'=>'billing-pesel', 'maxlength'=>'255', 'class'=>'form-control')));
- assign('select_country', object_select_tag($userData->getCountriesId(), 'getId', array('id'=>'user_data_country', 'class' => 'form-control', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data[country]'))) ?>
-
-
-
-
-
- assign('select_country', object_select_tag($userData->getCountriesId(), 'getId', array('id'=>'user_data_country', 'class' => 'form-control', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data[country]'))) ?>
-
-
+ $smarty->assign('show_add', $userData->getAddress());
-
+ if ($userData->getIsBilling()!=1):
+ if ($userData->getAddress()==""):
+ $smarty->assign('select_country', st_get_component('stUserData', 'deliveryCountriesSelect', array('id'=>'user_data_country','force_default_country_id' => $userData->getCountriesId())));
+ else:
+ $smarty->assign('select_country', object_select_tag($userData->getCountriesId(), 'getId', array('id'=>'user_data_country', 'class' => 'form-control', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data[country]')));
+ endif;
+ else:
+ $smarty->assign('select_country', object_select_tag($userData->getCountriesId(), 'getId', array('id'=>'user_data_country', 'class' => 'form-control', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data[country]')));
+ endif;
+
+endif;
+$smarty->assign('is_default', $userData->getIsDefault());
+$smarty->assign('checkbox_set_as_default', checkbox_tag('user_data[isDefault]', 1, $userData->getIsDefault(), array('id'=>'st_form-user-default')));
+$smarty->assign('delete_url', 'stUserData/deleteProfile?userDataType='.$userDataType.'&userDataId='.$userData->getId());
+$smarty->assign('save_submit', submit_tag(__('Zapisz'),array('name'=>'submit_save')));
+$smarty->assign('hidden_show_edit_profile_form', input_hidden_tag('showEditProfileForm', $showEditProfileForm));
+$smarty->assign('hidden_uderdata_type', input_hidden_tag('userDataType', $userDataType));
+$smarty->assign('hidden_user_data_id', input_hidden_tag('user_data[id]', $userData->getId()));
+$smarty->assign('hidden_user_data_is_billing', input_hidden_tag('user_data[isBilling]', $userData->getIsBilling()));
+$smarty->assign('hidden_userdata_id', input_hidden_tag('userDataId', $userData->getId()));
-
- assign('is_default', $userData->getIsDefault()) ?>
- assign('checkbox_set_as_default', checkbox_tag('user_data[isDefault]', 1, $userData->getIsDefault(), array('id'=>'st_form-user-default'))) ?>
-
-assign('delete_url', 'stUserData/deleteProfile?userDataType='.$userDataType.'&userDataId='.$userData->getId()) ?>
-
-assign('save_submit', submit_tag(__('Zapisz'),array('name'=>'submit_save'))) ?>
-assign('hidden_show_edit_profile_form', input_hidden_tag('showEditProfileForm', $showEditProfileForm)) ?>
-assign('hidden_uderdata_type', input_hidden_tag('userDataType', $userDataType)) ?>
-assign('hidden_user_data_id', input_hidden_tag('user_data[id]', $userData->getId())) ?>
-assign('hidden_user_data_is_billing', input_hidden_tag('user_data[isBilling]', $userData->getIsBilling())) ?>
-assign('hidden_userdata_id', input_hidden_tag('userDataId', $userData->getId())) ?>
-
-display('userdata_edit_profile_form.html') ?>
\ No newline at end of file
+$smarty->display('userdata_edit_profile_form.html');
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/_orderForm.php b/apps/frontend/modules/stUserData/templates/_orderForm.php
index 926bad8..5dbe6d9 100644
--- a/apps/frontend/modules/stUserData/templates/_orderForm.php
+++ b/apps/frontend/modules/stUserData/templates/_orderForm.php
@@ -1,9 +1,18 @@
assign('show_invoice_request', $invoiceConfig->getBool('invoice_on'));
+$smarty->assign('additional_billing_fields', null);
+$smarty->assign('additional_delivery_fields', null);
+
+$smarty->assign('show_region', $user_config->get('show_region'));
+$smarty->assign('show_address_more', $user_config->get('show_address_more'));
+$smarty->assign('show_pesel', $user_config->get('show_pesel'));
$smarty->assign('error_billing_company', form_error('user_data_billing[company]', array('suffix' => '', 'prefix' => '', 'class' => 'st_error error_label')));
$smarty->assign('error_billing_vat', form_error('user_data_billing[vat_number]', array('suffix' => '', 'prefix' => '', 'class' => 'st_error error_label')));
@@ -61,15 +70,11 @@ if ($sf_request->getErrors() && $user_basket_form_error) {
$smarty->assign('errors', __('Uzupełnij zaznaczone pola.'));
}
-$smarty->assign('show_region', $show_region);
-$smarty->assign('show_address_more', $show_address_more);
-$smarty->assign('show_pesel', $show_pesel);
-
$smarty->assign('label_billing_customer_type1', __('Klient indywidualny'));
-$smarty->assign('radio_billing_customer_type1', radiobutton_tag('user_data_billing[customer_type]', 1, $user_data_billing['customer_type'] == 1, array('disabled' => $sf_user->hasVatEu())));
+$smarty->assign('radio_billing_customer_type1', radiobutton_tag('user_data_billing[customer_type]', 1, $user_data_billing['customer_type'] == 1, array('style'=>'margin-left: 0px;','disabled' => $sf_user->hasVatEu())));
$smarty->assign('label_billing_customer_type2', __('Firma'));
-$smarty->assign('radio_billing_customer_type2', radiobutton_tag('user_data_billing[customer_type]', 2, $user_data_billing['customer_type'] == 2));
+$smarty->assign('radio_billing_customer_type2', radiobutton_tag('user_data_billing[customer_type]', 2, $user_data_billing['customer_type'] == 2, array('style'=>'margin-left: 0px;')));
$smarty->assign('label_billing_company', label_for('company_billing', "* " . __('Firma')));
$smarty->assign('input_billing_company', input_tag('user_data_billing[company]', $user_data_billing['company'], array('id' => 'company_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{company}') ? 'st_form-error' : '')));
@@ -80,7 +85,13 @@ $smarty->assign('input_billing_nip', input_tag('user_data_billing[vat_number]',
$smarty->assign('label_billing_email', label_for('email_billing', "* " . __('E-mail')));
$smarty->assign('input_billing_email', input_tag('user_data_billing[email]', $user_data_billing['email'], array('id' => 'email_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{email}') ? 'st_form-error' : '')));
-$smarty->assign('checkbox_create_account', checkbox_tag('user_data_billing[create_account]', 1, $user_data_billing['create_account'], array('id' => 'create_account', 'class' => 'checkobox')));
+if (!empty($user_data_billing['create_account']) && $user_data_billing['create_account'] != 0) {
+ $create_account = 1;
+}else{
+ $create_account = 0;
+}
+
+$smarty->assign('checkbox_create_account', checkbox_tag('user_data_billing[create_account]', 1, $create_account, array('id' => 'create_account', 'class' => 'checkobox')));
$smarty->assign('label_billing_password1', label_for('password1_billing', "* " . __('Hasło'), array('id' => 'label-password1')));
$smarty->assign('input_billing_password1', input_password_tag('user_data_billing[password1]', $user_data_billing['password1'], array('id' => 'password1_billing', 'maxlength' => '255', 'autocomplete' => 'off', 'class' => form_has_error('user_data_billing{password1}') ? 'st_form-error' : '')));
@@ -96,20 +107,19 @@ $smarty->assign('label_billing_address', label_for('address_billing', "* " . __(
$smarty->assign('input_billing_address', input_tag('user_data_billing[address]', $user_data_billing['address'], array('id' => 'address_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{address}') ? 'st_form-error' : '')));
$smarty->assign('label_billing_address_more', label_for('address_more_billing', __('Adres ciąg dalszy')));
-$smarty->assign('input_billing_address_more', input_tag('user_data_billing[address_more]', $user_data_billing['address_more'], array('id' => 'address_more_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{address_more}') ? 'st_form-error' : '')));
+$smarty->assign('input_billing_address_more', input_tag('user_data_billing[address_more]', isset($user_data_billing['address_more']) ? $user_data_billing['address_more'] : null, array('id' => 'address_more_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{address_more}') ? 'st_form-error' : '')));
$smarty->assign('label_billing_region', label_for('region_billing', __('Województwo')));
-$smarty->assign('input_billing_region', input_tag('user_data_billing[region]', $user_data_billing['region'], array('id' => 'region_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{region}') ? 'st_form-error' : '')));
+$smarty->assign('input_billing_region', input_tag('user_data_billing[region]', isset($user_data_billing['region']) ? $user_data_billing['region'] : null, array('id' => 'region_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{region}') ? 'st_form-error' : '')));
-$smarty->assign('label_billing_code', label_for('code_billing', "* " . __('Kod pocztowy')));
+$smarty->assign('label_billing_code', label_for('code_billing', "* " . __('Kod')));
$smarty->assign('input_billing_code', input_tag('user_data_billing[code]', $user_data_billing['code'], array('id' => 'code_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{code}') ? 'st_form-error' : '')));
$smarty->assign('label_billing_town', label_for('town_billing', "* " . __('Miasto')));
$smarty->assign('input_billing_town', input_tag('user_data_billing[town]', $user_data_billing['town'], array('id' => 'town_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{town}') ? 'st_form-error' : '')));
$smarty->assign('label_billing_country', label_for('country_billing', __('Kraj')));
-$smarty->assign('select_billing_country', countries_select_tag('user_data_billing[country]', isset($user_data_billing['country']) ? $user_data_billing['country'] : $delivery_country_id));
-
+$smarty->assign('select_billing_country', st_countries_select_tag('user_data_billing[country]', isset($user_data_billing['country']) ? $user_data_billing['country'] : $delivery_country_id, array('class' => 'form-control', 'group' => false)));
if ($user_config->get('validate_phone') == 1) {
$smarty->assign('label_billing_phone', label_for('phone_billing', "* " . __('Telefon')));
@@ -120,17 +130,22 @@ if ($user_config->get('validate_phone') == 1) {
$smarty->assign('input_billing_phone', input_tag('user_data_billing[phone]', $user_data_billing['phone'], array('id' => 'phone_billing', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{phone}') ? 'st_form-error' : '')));
$smarty->assign('label_billing_pesel', label_for('billing-pesel', __('PESEL')));
-$smarty->assign('input_billing_pesel', input_tag('user_data_billing[pesel]', $user_data_billing['pesel'], array('id' => 'billing-pesel', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{pesel}') ? 'st_form-error' : '')));
+$smarty->assign('input_billing_pesel', input_tag('user_data_billing[pesel]', isset($user_data_billing['pesel']) ? $user_data_billing['pesel'] : null, array('id' => 'billing-pesel', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{pesel}') ? 'st_form-error' : '')));
-$smarty->assign('checkbox_different_delivery', checkbox_tag('user_data_billing[different_delivery]', 1, $user_data_billing['different_delivery'], array('id' => 'different_delivery', 'class' => 'checkobox')));
+if (!empty($user_data_billing['different_delivery']) && $user_data_billing['different_delivery'] != 0) {
+ $different_delivery = 1;
+}else{
+ $different_delivery = 0;
+}
+
+$smarty->assign('checkbox_different_delivery', checkbox_tag('user_data_billing[different_delivery]', 1, $different_delivery, array('id' => 'different_delivery', 'class' => 'checkobox')));
$smarty->assign('label_delivery_customer_type1', __('Klient indywidualny'));
-$smarty->assign('label_delivery_customer_type1', __('Klient indywidualny'));
-$smarty->assign('radio_delivery_customer_type1', radiobutton_tag('user_data_delivery[customer_type]', 1, $user_data_delivery['customer_type'] == 1));
+$smarty->assign('radio_delivery_customer_type1', radiobutton_tag('user_data_delivery[customer_type]', 1, $user_data_delivery['customer_type'] == 1, array('style'=>'margin-left: 0px;')));
$smarty->assign('label_delivery_customer_type2', __('Firma'));
-$smarty->assign('radio_delivery_customer_type2', radiobutton_tag('user_data_delivery[customer_type]', 2, $user_data_delivery['customer_type'] == 2));
+$smarty->assign('radio_delivery_customer_type2', radiobutton_tag('user_data_delivery[customer_type]', 2, $user_data_delivery['customer_type'] == 2, array('style'=>'margin-left: 0px;')));
$smarty->assign('label_delivery_company', label_for('company_delivery', "* " . __('Firma')));
$smarty->assign('input_delivery_company', input_tag('user_data_delivery[company]', $user_data_delivery['company'], array('id' => 'company_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{company}') ? 'st_form-error' : '')));
@@ -143,10 +158,10 @@ $smarty->assign('label_delivery_address', label_for('address_delivery', "* " . _
$smarty->assign('input_delivery_address', input_tag('user_data_delivery[address]', $user_data_delivery['address'], array('id' => 'address_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{address}') ? 'st_form-error' : '')));
$smarty->assign('label_delivery_address_more', label_for('address_more_delivery', __('Adres ciąg dalszy')));
-$smarty->assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $user_data_delivery['address_more'], array('id' => 'address_more_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{address_more}') ? 'st_form-error' : '')));
+$smarty->assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', isset($user_data_delivery['address_more']) ? $user_data_delivery['address_more'] : null, array('id' => 'address_more_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{address_more}') ? 'st_form-error' : '')));
$smarty->assign('label_delivery_region', label_for('region_delivery', __('Województwo')));
-$smarty->assign('input_delivery_region', input_tag('user_data_delivery[region]', $user_data_delivery['region'], array('id' => 'region_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{region}') ? 'st_form-error' : '')));
+$smarty->assign('input_delivery_region', input_tag('user_data_delivery[region]', isset($user_data_delivery['region']) ? $user_data_delivery['region'] : null, array('id' => 'region_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{region}') ? 'st_form-error' : '')));
$smarty->assign('label_delivery_code', label_for('code_delivery', "* " . __('Kod')));
$smarty->assign('input_delivery_code', input_tag('user_data_delivery[code]', $user_data_delivery['code'], array('id' => 'code_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{code}') ? 'st_form-error' : '')));
@@ -165,14 +180,11 @@ if ($user_config->get('validate_phone') == 1) {
$smarty->assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $user_data_delivery['phone'], array('id' => 'phone_delivery', 'maxlength' => '255', 'class' => form_has_error('user_data_delivery{phone}') ? 'st_form-error' : '')));
-$smarty->assign('checkbox_privacy', checkbox_tag('user_data_billing[privacy]', 1, $user_data_billing['privacy'], array('id' => 'user_data_billing_privacy', 'class' => 'checkobox')));
+$smarty->assign('checkbox_privacy', checkbox_tag('user_data_billing[privacy]', 1, isset($user_data_billing['privacy']), array('id' => 'user_data_billing_privacy', 'class' => 'checkobox')));
-$smarty->assign('checkbox_terms', checkbox_tag('user_data_billing[terms]', 1, $user_data_billing['terms'], array('id' => 'user_data_billing_terms', 'class' => 'checkobox')));
+$smarty->assign('checkbox_terms', checkbox_tag('user_data_billing[terms]', 1, isset($user_data_billing['terms']), array('id' => 'user_data_billing_terms', 'class' => 'checkobox')));
-if (stConfig::getInstance('stOrder')->get('show_not_professional_purchase'))
-{
- $smarty->assign('not_professional_purchase_checkbox', checkbox_tag('user_data_billing[not_professional_purchase]', 1, $user_data_billing['not_professional_purchase']));
-}
+$smarty->assign('not_professional_purchase_checkbox', stConfig::getInstance('stOrder')->getBool('show_not_professional_purchase') ? checkbox_tag('user_data_billing[not_professional_purchase]', 1, isset($user_data_billing['not_professional_purchase'])) : null);
$smarty->assignPartial('link_to_privacy', 'stUser', 'privacy');
@@ -216,9 +228,9 @@ foreach ($tmp_string as $value) {
$smarty->assign("terms_shop_text", $string);
if ($config->get('captcha_on', stConfig::INT) == 1 && sfContext::getInstance()->getUser()->getAttribute('captcha_off') != 1) {
-
+
$smarty->assign('captcha_mod', $config->get('captcha_mod'));
-
+
$smarty->assign('captcha_on', $config->get('captcha_on', stConfig::INT) == 1);
$smarty->assign('error_captcha', form_error('captcha', array('suffix' => '', 'prefix' => '', 'class' => 'st_error red')));
@@ -230,15 +242,15 @@ if ($config->get('captcha_on', stConfig::INT) == 1 && sfContext::getInstance()-
$smarty->assign('label_captcha', label_for('captcha_img', "* " . __('Cyfry z obrazka')));
$smarty->assign('input_captcha', input_tag('captcha', '', array('id' => 'captcha_img', 'class' => form_has_error('captcha') ? 'st_form-error' : '')));
-
+
if($config->get('captcha_mod')=="recaptcha3")
{
$smarty->assign('re_captcha_key', $config->get('recaptcha_key'));
$smarty->assign('re_captcha_badge_position', $config->get('recaptcha_badge_position'));
- $smarty->assign('re_captcha_badge_margin', $config->get('recaptcha_badge_margin'));
-
+ $smarty->assign('re_captcha_badge_margin', $config->get('recaptcha_badge_margin'));
+
$smarty->assign('badscore', sfContext::getInstance()->getUser()->getAttribute('badscore'));
-
+
}
}
@@ -250,31 +262,145 @@ if (stTheme::is_responsive()) {
$user_config->get('validate_phone') == 1 ? $phone_label = "* " . __('Telefon') : $phone_label = __('Telefon');
- $smarty->assign('input_billing_email', input_tag('user_data_billing[email]', $user_data_billing['email'], array('id' => 'email_billing', 'placeholder' => '* ' . __("E-mail"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_password1', input_password_tag('user_data_billing[password1]', $user_data_billing['password1'], array('id' => 'password1_billing', 'maxlength' => '255', 'placeholder' => '* ' . __("Hasło"), 'autocomplete' => 'off', 'class' => 'form-control')));
- $smarty->assign('input_billing_password2', input_password_tag('user_data_billing[password2]', $user_data_billing['password2'], array('id' => 'password2_billing', 'maxlength' => '255', 'placeholder' => '* ' . __("Powtórz hasło"), 'autocomplete' => 'off', 'class' => 'form-control')));
+ // email
+ $user_data_billing_email_array = array('id' => 'email_billing', 'aria-required'=>"true", 'maxlength' => '255', 'class' => 'form-control');
+ if($sf_request->getError('user_data_billing{email}') || $sf_request->getError('user_data_billing{email_exist}')){
+ $user_data_billing_email_array += array('aria-describedby'=>"error_email_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_email', input_tag('user_data_billing[email]', $user_data_billing['email'], $user_data_billing_email_array));
+
+ // password 1
+ $user_data_billing_password1_array = array('id' => 'password1_billing', 'maxlength' => '255', 'autocomplete' => 'off', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_billing{password1}')){
+ $user_data_billing_password1_array += array('aria-describedby'=>"error_password1_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_password1', input_password_tag('user_data_billing[password1]', $user_data_billing['password1'], $user_data_billing_password1_array));
+
+ // password 2
+ $user_data_billing_password2_array = array('id' => 'password2_billing', 'maxlength' => '255', 'autocomplete' => 'off', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_billing{password2}')){
+ $user_data_billing_password2_array += array('aria-describedby'=>"error_password2_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_password2', input_password_tag('user_data_billing[password2]', $user_data_billing['password2'], $user_data_billing_password2_array));
+
$smarty->assign('input_captcha', input_tag('captcha', '', array('id' => 'captcha_img', 'placeholder' => '* ' . __("Cyfry z obrazka"), 'class' => 'form-control')));
+
+ // company
+ $user_data_billing_company_array = array('id' => 'company_billing', 'aria-required'=>"true", 'maxlength' => '255', 'class' => 'form-control');
+ if($sf_request->getError('user_data_billing{company}')){
+ $user_data_billing_company_array += array('aria-describedby'=>"error_company_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_company', input_tag('user_data_billing[company]', $user_data_billing['company'], $user_data_billing_company_array));
- $smarty->assign('input_billing_company', input_tag('user_data_billing[company]', $user_data_billing['company'], array('id' => 'company_billing', 'placeholder' => '* ' . __("Firma"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_nip', input_tag('user_data_billing[vat_number]', $user_data_billing['vat_number'], array('id' => 'nip_billing', 'placeholder' => "* " . __($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_full_name', input_tag('user_data_billing[full_name]', $user_data_billing['full_name'], array('id' => 'full_name_billing', 'placeholder' => "* " . __('Imię i nazwisko'), 'maxlength' => '255', 'class' => $user_config->get('require_billing_fullname') ? 'form-control required' : 'form-control')));
- $smarty->assign('input_billing_address', input_tag('user_data_billing[address]', $user_data_billing['address'], array('id' => 'address_billing', 'placeholder' => '* ' . __("Ulica nr domu / nr lokalu"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_address_more', input_tag('user_data_billing[address_more]', $user_data_billing['address_more'], array('id' => 'address_more_billing', 'placeholder' => __("Adres ciąg dalszy"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_region', input_tag('user_data_billing[region]', $user_data_billing['region'], array('id' => 'region_billing', 'placeholder' => __("Województwo"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_code', input_tag('user_data_billing[code]', $user_data_billing['code'], array('id' => 'code_billing', 'placeholder' => '* ' . __("Kod pocztowy"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_town', input_tag('user_data_billing[town]', $user_data_billing['town'], array('id' => 'town_billing', 'placeholder' => '* ' . __("Miasto"), 'maxlength' => '255', 'class' => 'form-control')));
+ // nip
+ $smarty->assign("nip_billing_label", __($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"));
+ $user_data_billing_vat_number_array = array('id' => 'nip_billing', 'maxlength' => '255', 'aria-required'=>"true", 'class' => 'form-control');
+ if ($sf_request->getError('user_data_billing{vat_number}')){
+ $user_data_billing_vat_number_array += array('aria-describedby'=>"error_vat_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_nip', input_tag('user_data_billing[vat_number]', $user_data_billing['vat_number'], $user_data_billing_vat_number_array));
+
+ // full name
+ $user_data_billing_full_name_array = array('id' => 'full_name_billing', 'aria-required'=>"true", 'maxlength' => '255', 'class' => 'form-control');
+ if($sf_request->getError('user_data_billing{full_name}')){
+ $user_data_billing_full_name_array += array('aria-describedby'=>"error_full_name_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_full_name', input_tag('user_data_billing[full_name]', $user_data_billing['full_name'], $user_data_billing_full_name_array));
+
+ // adress
+ $user_data_billing_address_array = array('id' => 'address_billing', 'aria-required'=>"true", 'maxlength' => '255', 'class' => 'form-control');
+ if($sf_request->getError('user_data_billing{address}')){
+ $user_data_billing_address_array += array('aria-describedby'=>"error_address_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_address', input_tag('user_data_billing[address]', $user_data_billing['address'], $user_data_billing_address_array));
+
+ $smarty->assign('input_billing_address_more', input_tag('user_data_billing[address_more]', isset($user_data_billing['address_more']) ? $user_data_billing['address_more'] : null, array('id' => 'address_more_billing', 'maxlength' => '255', 'class' => 'form-control')));
+
+ // region
+ $smarty->assign('input_billing_region', input_tag('user_data_billing[region]', isset($user_data_billing['region']) ? $user_data_billing['region'] : null, array('id' => 'region_billing', 'maxlength' => '255', 'class' => 'form-control')));
+
+ // code
+ $user_data_billing_code_array = array('id' => 'code_billing', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_billing{code}')){
+ $user_data_billing_code_array += array('aria-describedby'=>"error_code_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_code', input_tag('user_data_billing[code]', $user_data_billing['code'], $user_data_billing_code_array));
+
+ // town
+ $user_data_billing_town_array = array('id' => 'town_billing', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_billing{town}')){
+ $user_data_billing_town_array += array('aria-describedby'=>"error_town_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_town', input_tag('user_data_billing[town]', $user_data_billing['town'], $user_data_billing_town_array));
+
+ // country
$smarty->assign('select_billing_country', countries_select_tag('user_data_billing[country]', isset($user_data_billing['country']) ? $user_data_billing['country'] : $delivery_country_id));
- $smarty->assign('input_billing_phone', input_tag('user_data_billing[phone]', $user_data_billing['phone'], array('id' => 'phone_billing', 'placeholder' => $phone_label, 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_pesel', input_tag('user_data_billing[pesel]', $user_data_billing['pesel'], array('id' => 'billing-pesel', 'placeholder' => __('PESEL'), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_company', input_tag('user_data_delivery[company]', $user_data_delivery['company'], array('id' => 'company_delivery', 'placeholder' => '* ' . __("Firma"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $user_data_delivery['full_name'], array('id' => 'full_name_delivery', 'placeholder' => "* " . __('Imię i nazwisko'), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_address', input_tag('user_data_delivery[address]', $user_data_delivery['address'], array('id' => 'address_delivery', 'placeholder' => '* ' . __("Ulica nr domu / nr lokalu"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $user_data_delivery['address_more'], array('id' => 'address_more_delivery', 'placeholder' => __("Adres ciąg dalszy"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_region', input_tag('user_data_delivery[region]', $user_data_delivery['region'], array('id' => 'region_delivery', 'placeholder' => __("Województwo"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_code', input_tag('user_data_delivery[code]', $user_data_delivery['code'], array('id' => 'code_delivery', 'placeholder' => '* ' . __("Kod pocztowy"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_town', input_tag('user_data_delivery[town]', $user_data_delivery['town'], array('id' => 'town_delivery', 'placeholder' => '* ' . __("Miasto"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $user_data_delivery['phone'], array('id' => 'phone_delivery', 'placeholder' => $phone_label, 'maxlength' => '255', 'class' => 'form-control')));
+ // phone
+ $user_data_billing_phone_array = array('id' => 'phone_billing', 'maxlength' => '255', 'class' => 'form-control');
+ $smarty->assign('validate_phone',0);
+ if($user_config->get('validate_phone') == 1){
+ $smarty->assign('validate_phone',1);
+ $user_data_billing_phone_array += array('aria-required'=>"true");
+ if ($sf_request->getError('user_data_billing{phone}')){
+ $user_data_billing_phone_array += array('aria-describedby'=>"error_phone_billing", 'aria-invalid'=>"true");
+ }
+ }
+ $smarty->assign('input_billing_phone', input_tag('user_data_billing[phone]', $user_data_billing['phone'], $user_data_billing_phone_array));
+
+ // pesel
+ $smarty->assign('input_billing_pesel', input_tag('user_data_billing[pesel]', isset($user_data_billing['pesel']) ? $user_data_billing['pesel'] : null, array('id' => 'billing-pesel', 'maxlength' => '255', 'class' => 'form-control')));
+
+ // delivery company
+ $user_data_delivery_company_array = array('id' => 'company_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{company}')){
+ $user_data_delivery_company_array += array('aria-describedby'=>"error_company_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_company', input_tag('user_data_delivery[company]', $user_data_delivery['company'], $user_data_delivery_company_array));
+
+ // delivery full name
+ $user_data_delivery_full_name_array = array('id' => 'full_name_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{full_name}')){
+ $user_data_delivery_full_name_array += array('aria-describedby'=>"error_full_name_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $user_data_delivery['full_name'], $user_data_delivery_full_name_array));
+
+ // delivery address
+ $user_data_delivery_address_array = array('id' => 'address_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{address}')){
+ $user_data_delivery_address_array += array('aria-describedby'=>"error_address_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_address', input_tag('user_data_delivery[address]', $user_data_delivery['address'], $user_data_delivery_address_array ));
+
+ $smarty->assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', isset($user_data_delivery['address_more']) ? $user_data_delivery['address_more'] : null, array('id' => 'address_more_delivery','maxlength' => '255', 'class' => 'form-control')));
+
+ // delivery region
+ $smarty->assign('input_delivery_region', input_tag('user_data_delivery[region]', isset($user_data_delivery['region']) ? $user_data_delivery['region'] : null, array('id' => 'region_delivery', 'maxlength' => '255', 'class' => 'form-control')));
+
+ // delivery code
+ $user_data_delivery_code_array = array('id' => 'code_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{code}')){
+ $user_data_delivery_code_array += array('aria-describedby'=>"error_code_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_code', input_tag('user_data_delivery[code]', $user_data_delivery['code'], $user_data_delivery_code_array));
+
+ // delivery town
+ $user_data_delivery_town_array = array('id' => 'town_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{town}')){
+ $user_data_delivery_town_array += array('aria-describedby'=>"error_town_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_town', input_tag('user_data_delivery[town]', $user_data_delivery['town'], $user_data_delivery_town_array));
+
+ // delivery phone
+ $user_data_delivery_phone_array = array('id' => 'phone_delivery', 'maxlength' => '255', 'class' => 'form-control');
+
+ if($user_config->get('validate_phone') == 1){
+ $user_data_delivery_phone_array += array('aria-required'=>"true");
+ if ($sf_request->getError('user_data_delivery{phone}')){
+ $user_data_delivery_phone_array += array('aria-describedby'=>"error_phone_billing", 'aria-invalid'=>"true");
+ }
+ }
+ $smarty->assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $user_data_delivery['phone'], $user_data_delivery_phone_array));
}
$smarty->assign('under_basket_socket', stSocketView::openComponents('under_basket_socket') . stSocketView::openPartials('under_basket_socket'));
@@ -284,12 +410,12 @@ $delivery = stDeliveryFrontend::getInstance($sf_context->getUser()->getBasket())
$defaultDelivery = $delivery->getDefaultDelivery();
$hidden_fields = [
+ 'delivery_pickup_point' => $sf_request->getParameter('delivery_pickup_point') ? htmlspecialchars($sf_request->getParameter('delivery_pickup_point')) : null,
'payment_channel' => $sf_request->getParameter('payment_channel') ? htmlspecialchars($sf_request->getParameter('payment_channel')) : null,
- 'payment_id' => $defaultDelivery ? $defaultDelivery->getDefaultPayment()->getId() : null,
+ 'payment_id' => $defaultDelivery && $defaultDelivery->getDefaultPayment() ? $defaultDelivery->getDefaultPayment()->getId() : null,
'delivery_id' => $defaultDelivery ? $defaultDelivery->getId() : null,
'delivery_country_id' => $delivery->getDefaultDeliveryCountry() ? $delivery->getDefaultDeliveryCountry()->getId() : null,
];
$smarty->assign('hidden_fields', $hidden_fields);
-
$smarty->display('userdata_order_form.html');
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/_orderFormBilling.php b/apps/frontend/modules/stUserData/templates/_orderFormBilling.php
index 4de7f08..e8e92ec 100644
--- a/apps/frontend/modules/stUserData/templates/_orderFormBilling.php
+++ b/apps/frontend/modules/stUserData/templates/_orderFormBilling.php
@@ -1,5 +1,5 @@
assign('error_billing_vat', $sf_request->getError('user_data_billing{va
$smarty->assign('error_billing_country', $sf_request->getError('user_data_billing{country}'));
$smarty->assign('label_billing_customer_type1', __('Klient indywidualny'));
-$smarty->assign('radio_billing_customer_type1', radiobutton_tag('user_data_billing[customer_type]', 1, $user_data_billing['customer_type'] == 1, array('disabled' => $sf_user->hasVatEu())));
+$smarty->assign('radio_billing_customer_type1', radiobutton_tag('user_data_billing[customer_type]', 1, $user_data_billing['customer_type'] == 1, array('style'=>'margin-left: 0px;','disabled' => $sf_user->hasVatEu())));
$smarty->assign('label_billing_customer_type2', __('Firma'));
-$smarty->assign('radio_billing_customer_type2', radiobutton_tag('user_data_billing[customer_type]', 2, $user_data_billing['customer_type'] == 2));
+$smarty->assign('radio_billing_customer_type2', radiobutton_tag('user_data_billing[customer_type]', 2, $user_data_billing['customer_type'] == 2, array('style'=>'margin-left: 0px;')));
$smarty->assign('label_billing_company', label_for('billing-company', "* " . __('Firma')));
$smarty->assign('input_billing_company', input_tag('user_data_billing[company]', $user_data_billing['company'], array('id' => 'billing-company', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{company}') ? 'st_form-error billing-company' : 'billing-company')));
@@ -49,19 +49,23 @@ $smarty->assign('input_billing_address_more', input_tag('user_data_billing[addre
$smarty->assign('label_billing_region', label_for('billing-region', __('Województwo')));
$smarty->assign('input_billing_region', input_tag('user_data_billing[region]', $user_data_billing['region'], array('id' => 'billing-region', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{region}') ? 'st_form-error billing-region' : 'billing-region')));
-$smarty->assign('label_billing_code', label_for('billing-code', "* " . __('Kod pocztowy')));
+$smarty->assign('label_billing_code', label_for('billing-code', "* " . __('Kod')));
$smarty->assign('input_billing_code', input_tag('user_data_billing[code]', $user_data_billing['code'], array('id' => 'billing-code', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{code}') ? 'st_form-error billing-code' : 'billing-code')));
$smarty->assign('label_billing_town', label_for('billing-town', "* " . __('Miasto')));
$smarty->assign('input_billing_town', input_tag('user_data_billing[town]', $user_data_billing['town'], array('id' => 'billing-town', 'maxlength' => '255', 'class' => form_has_error('user_data_billing{town}') ? 'st_form-error billing-town' : 'billing-town')));
$smarty->assign('label_billing_country', label_for('billing-country', __('Kraj')));
-$smarty->assign('select_billing_country', object_select_tag($userDataBilling->getCountriesId(), 'getId', array('id' => 'billing-country', 'related_class' => 'Countries', 'control_name' => 'user_data_billing[country]')));
+$smarty->assign('select_billing_country', st_countries_select_tag('user_data_billing[country]', $user_data_billing['country'], array('id' => 'billing-country', 'class' => 'form-control', 'group' => false)));
if (stConfig::getInstance('stOrder')->get('show_not_professional_purchase'))
{
$smarty->assign('not_professional_purchase_checkbox', checkbox_tag('user_data_billing[not_professional_purchase]', 1, $user_data_billing['not_professional_purchase']));
}
+else
+{
+ $smarty->assign('not_professional_purchase_checkbox', "");
+}
if ($user_config->get('validate_phone') == 1) {
$smarty->assign('label_billing_phone', label_for('billing-phone', "* " . __('Telefon')));
@@ -86,6 +90,7 @@ $delivery = stDeliveryFrontend::getInstance($sf_context->getUser()->getBasket())
$defaultDelivery = $delivery->getDefaultDelivery();
$hidden_fields = [
+ 'delivery_pickup_point' => $sf_request->getParameter('delivery_pickup_point') ? htmlspecialchars($sf_request->getParameter('delivery_pickup_point')) : null,
'payment_channel' => $sf_request->getParameter('payment_channel') ? htmlspecialchars($sf_request->getParameter('payment_channel')) : null,
'payment_id' => $defaultDelivery ? $defaultDelivery->getDefaultPayment()->getId() : null,
'delivery_id' => $defaultDelivery ? $defaultDelivery->getId() : null,
@@ -97,21 +102,71 @@ $smarty->assign('hidden_fields', $hidden_fields);
if (stTheme::is_responsive()) {
$user_config->get('validate_phone') == 1 ? $phone_label = "* " . __('Telefon') : $phone_label = __('Telefon');
- $smarty->assign('input_billing_company', input_tag('user_data_billing[company]', $user_data_billing['company'], array('id' => 'company_billing', 'placeholder' => '* ' . __("Firma"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_nip', input_tag('user_data_billing[vat_number]', $user_data_billing['vat_number'], array('id' => 'nip_billing', 'placeholder' => "* " . __($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_full_name', input_tag('user_data_billing[full_name]', $user_data_billing['full_name'], array('id' => 'full_name_billing', 'placeholder' => "* " . __('Imię i nazwisko'), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_address', input_tag('user_data_billing[address]', $user_data_billing['address'], array('id' => 'address_billing', 'placeholder' => '* ' . __("Ulica nr domu / nr lokalu"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_address_more', input_tag('user_data_billing[address_more]', $user_data_billing['address_more'], array('id' => 'address_more_billing', 'placeholder' => __("Adres ciąg dalszy"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_region', input_tag('user_data_billing[region]', $user_data_billing['region'], array('id' => 'region_billing', 'placeholder' => __("Województwo"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_code', input_tag('user_data_billing[code]', $user_data_billing['code'], array('id' => 'code_billing', 'placeholder' => '* ' . __("Kod"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_town', input_tag('user_data_billing[town]', $user_data_billing['town'], array('id' => 'town_billing', 'placeholder' => '* ' . __("Miasto"), 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('select_billing_country', object_select_tag($userDataBilling->getCountriesId(), 'getId', array('id' => 'billing-country', 'class' => 'form-control', 'related_class' => 'Countries', 'control_name' => 'user_data_billing[country]')));
- $smarty->assign('input_billing_phone', input_tag('user_data_billing[phone]', $user_data_billing['phone'], array('id' => 'phone_billing', 'placeholder' => $phone_label, 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('input_billing_pesel', input_tag('user_data_billing[pesel]', $user_data_billing['pesel'], array('id' => 'billing-pesel', 'placeholder' => __('PESEL'), 'maxlength' => '255', 'class' => 'form-control')));
+ // company
+ $user_data_billing_company_array = array('id' => 'company_billing', 'aria-required'=>"true", 'maxlength' => '255', 'class' => 'form-control');
+ if($sf_request->getError('user_data_billing{company}')){
+ $user_data_billing_company_array += array('aria-describedby'=>"error_company_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_company', input_tag('user_data_billing[company]', $user_data_billing['company'], $user_data_billing_company_array));
+
+ // nip
+ $smarty->assign("nip_billing_label", __($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"));
+ $user_data_billing_vat_number_array = array('id' => 'nip_billing', 'maxlength' => '255', 'aria-required'=>"true", 'class' => 'form-control');
+ if ($sf_request->getError('user_data_billing{vat_number}')){
+ $user_data_billing_vat_number_array += array('aria-describedby'=>"error_vat_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_nip', input_tag('user_data_billing[vat_number]', $user_data_billing['vat_number'], $user_data_billing_vat_number_array));
+
+ // full name
+ $user_data_billing_full_name_array = array('id' => 'full_name_billing', 'aria-required'=>"true", 'maxlength' => '255', 'class' => 'form-control');
+ if($sf_request->getError('user_data_billing{full_name}')){
+ $user_data_billing_full_name_array += array('aria-describedby'=>"error_full_name_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_full_name', input_tag('user_data_billing[full_name]', $user_data_billing['full_name'], $user_data_billing_full_name_array));
+
+
+ // adress
+ $user_data_billing_address_array = array('id' => 'address_billing', 'aria-required'=>"true", 'maxlength' => '255', 'class' => 'form-control');
+ if($sf_request->getError('user_data_billing{address}')){
+ $user_data_billing_address_array += array('aria-describedby'=>"error_address_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_address', input_tag('user_data_billing[address]', $user_data_billing['address'], $user_data_billing_address_array));
+
+ $smarty->assign('input_billing_address_more', input_tag('user_data_billing[address_more]', isset($user_data_billing['address_more']) ? $user_data_billing['address_more'] : null, array('id' => 'address_more_billing', 'maxlength' => '255', 'class' => 'form-control')));
+
+
+ // region
+ $smarty->assign('input_billing_region', input_tag('user_data_billing[region]', isset($user_data_billing['region']) ? $user_data_billing['region'] : null, array('id' => 'region_billing', 'maxlength' => '255', 'class' => 'form-control')));
+
+ // code
+ $user_data_billing_code_array = array('id' => 'code_billing', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_billing{code}')){
+ $user_data_billing_code_array += array('aria-describedby'=>"error_code_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_code', input_tag('user_data_billing[code]', $user_data_billing['code'], $user_data_billing_code_array));
+
+ // town
+ $user_data_billing_town_array = array('id' => 'town_billing', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_billing{town}')){
+ $user_data_billing_town_array += array('aria-describedby'=>"error_town_billing", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_billing_town', input_tag('user_data_billing[town]', $user_data_billing['town'], $user_data_billing_town_array));
+
+ // phone
+ $user_data_billing_phone_array = array('id' => 'phone_billing', 'maxlength' => '255', 'class' => 'form-control');
+ $smarty->assign('validate_phone',0);
+ if($user_config->get('validate_phone') == 1){
+ $smarty->assign('validate_phone',1);
+ $user_data_billing_phone_array += array('aria-required'=>"true");
+ if ($sf_request->getError('user_data_billing{phone}')){
+ $user_data_billing_phone_array += array('aria-describedby'=>"error_phone_billing", 'aria-invalid'=>"true");
+ }
+ }
+ $smarty->assign('input_billing_phone', input_tag('user_data_billing[phone]', $user_data_billing['phone'], $user_data_billing_phone_array));
+
+ // pesel
+ $smarty->assign('input_billing_pesel', input_tag('user_data_billing[pesel]', isset($user_data_billing['pesel']) ? $user_data_billing['pesel'] : null, array('id' => 'billing-pesel', 'maxlength' => '255', 'class' => 'form-control')));
- $smarty->assign('is_authenticated', $sf_user->isAuthenticated());
- $smarty->assign('username', $sf_user->isAuthenticated() ? $sf_user->getGuardUser()->getUsername() : "");
- $smarty->assign('external_account', $sf_user->isAuthenticated() ? $sf_user->getGuardUser()->getExternalAccount() : "");
}
$smarty->assign('is_authenticated', $sf_user->isAuthenticated());
diff --git a/apps/frontend/modules/stUserData/templates/_orderFormDelivery.php b/apps/frontend/modules/stUserData/templates/_orderFormDelivery.php
index bebe590..17f9410 100644
--- a/apps/frontend/modules/stUserData/templates/_orderFormDelivery.php
+++ b/apps/frontend/modules/stUserData/templates/_orderFormDelivery.php
@@ -1,95 +1,135 @@
-
-
-
-
-
+assign('error_company', form_error('user_data_delivery[company]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label'))) ?>
-assign('error_full_name', form_error('user_data_delivery[full_name]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label'))) ?>
-assign('error_address', form_error('user_data_delivery[address]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label'))) ?>
-assign('error_region', form_error('user_data_delivery[region]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label'))) ?>
-assign('error_code', form_error('user_data_delivery[code]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label'))) ?>
-assign('error_town', form_error('user_data_delivery[town]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label'))) ?>
-assign('error_phone', form_error('user_data_delivery[phone]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label'))) ?>
+$smarty->assign('error_company', form_error('user_data_delivery[company]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label')));
+$smarty->assign('error_full_name', form_error('user_data_delivery[full_name]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label')));
+$smarty->assign('error_address', form_error('user_data_delivery[address]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label')));
+$smarty->assign('error_region', form_error('user_data_delivery[region]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label')));
+$smarty->assign('error_code', form_error('user_data_delivery[code]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label')));
+$smarty->assign('error_town', form_error('user_data_delivery[town]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label')));
+$smarty->assign('error_phone', form_error('user_data_delivery[phone]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error error_label')));
+
+$smarty->assign('error_delivery_company', $sf_request->getError('user_data_delivery{company}'));
+$smarty->assign('error_delivery_full_name', $sf_request->getError('user_data_delivery{full_name}'));
+$smarty->assign('error_delivery_address', $sf_request->getError('user_data_delivery{address}'));
+$smarty->assign('error_delivery_region', $sf_request->getError('user_data_delivery{region}'));
+$smarty->assign('error_delivery_code_town', $sf_request->getError('user_data_delivery{code}').$sf_request->getError('user_data_delivery{town}'));
+$smarty->assign('error_delivery_code', $sf_request->getError('user_data_delivery{code}'));
+$smarty->assign('error_delivery_town', $sf_request->getError('user_data_delivery{town}'));
+$smarty->assign('error_delivery_phone', $sf_request->getError('user_data_delivery{phone}'));
+$smarty->assign('error_delivery_vat', $sf_request->getError('user_data_delivery{vat_number}'));
+$smarty->assign('error_delivery_country', $sf_request->getError('user_data_delivery{country}'));
-assign('error_delivery_company', $sf_request->getError('user_data_delivery{company}')); ?>
-assign('error_delivery_full_name', $sf_request->getError('user_data_delivery{full_name}')); ?>
-assign('error_delivery_address', $sf_request->getError('user_data_delivery{address}')); ?>
-assign('error_delivery_region', $sf_request->getError('user_data_delivery{region}')); ?>
-assign('error_delivery_code_town', $sf_request->getError('user_data_delivery{code}').$sf_request->getError('user_data_delivery{town}')); ?>
-assign('error_delivery_code', $sf_request->getError('user_data_delivery{code}')); ?>
-assign('error_delivery_town', $sf_request->getError('user_data_delivery{town}')); ?>
-assign('error_delivery_phone', $sf_request->getError('user_data_delivery{phone}')); ?>
-assign('error_delivery_vat', $sf_request->getError('user_data_delivery{vat_number}')); ?>
-assign('error_delivery_country', $sf_request->getError('user_data_delivery{country}')); ?>
-getErrors() && $user_basket_form_error):
$smarty->assign('errors', __('Uzupełnij zaznaczone pola.'));
endif;
-?>
-assign('show_region', $show_region);?>
-assign('show_address_more', $show_address_more);?>
-assign('label_delivery_customer_type1', __('Klient indywidualny')) ?>
-assign('radio_delivery_customer_type1', radiobutton_tag('user_data_delivery[customer_type]', 1, $user_data_delivery['customer_type'] == 1)) ?>
+$smarty->assign('show_region', $show_region);
+$smarty->assign('show_address_more', $show_address_more);
-assign('label_delivery_customer_type2', __('Firma')) ?>
-assign('radio_delivery_customer_type2', radiobutton_tag('user_data_delivery[customer_type]', 2, $user_data_delivery['customer_type'] == 2)) ?>
+$smarty->assign('label_delivery_customer_type1', __('Klient indywidualny'));
+$smarty->assign('radio_delivery_customer_type1', radiobutton_tag('user_data_delivery[customer_type]', 1, $user_data_delivery['customer_type'] == 1, array('style'=>'margin-left: 0px;')));
-assign('label_delivery_company', label_for('company',"* ".__('Firma'))) ?>
-assign('input_delivery_company', input_tag('user_data_delivery[company]', $user_data_delivery['company'], array('id'=>'company', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{company}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('label_delivery_customer_type2', __('Firma'));
+$smarty->assign('radio_delivery_customer_type2', radiobutton_tag('user_data_delivery[customer_type]', 2, $user_data_delivery['customer_type'] == 2, array('style'=>'margin-left: 0px;')));
-assign('label_delivery_full_name', label_for('full_name',"* ".__('Imię i nazwisko'), array('id'=>'full_name_delivery_label'))) ?>
-assign('label_delivery_full_name_text', __('Imię i nazwisko')); ?>
-assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $user_data_delivery['full_name'], array('id'=>'full_name', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{full_name}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('label_delivery_company', label_for('company',"* ".__('Firma')));
+$smarty->assign('input_delivery_company', input_tag('user_data_delivery[company]', $user_data_delivery['company'], array('id'=>'company', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{company}') ? 'st_form-error' : '')));
-assign('label_delivery_address', label_for('address',"* ".__('Ulica nr domu / nr lokalu'))) ?>
-assign('input_delivery_address', input_tag('user_data_delivery[address]', $user_data_delivery['address'], array('id'=>'address', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{address}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('label_delivery_full_name', label_for('full_name',"* ".__('Imię i nazwisko'), array('id'=>'full_name_delivery_label')));
+$smarty->assign('label_delivery_full_name_text', __('Imię i nazwisko'));
+$smarty->assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $user_data_delivery['full_name'], array('id'=>'full_name', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{full_name}') ? 'st_form-error' : '')));
-assign('label_delivery_address_more', label_for('address_more',__('Adres ciąg dalszy'))) ?>
-assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $user_data_delivery['address_more'], array('id'=>'address_more', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{address_more}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('label_delivery_address', label_for('address',"* ".__('Ulica nr domu / nr lokalu')));
+$smarty->assign('input_delivery_address', input_tag('user_data_delivery[address]', $user_data_delivery['address'], array('id'=>'address', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{address}') ? 'st_form-error' : '')));
-assign('label_delivery_region', label_for('region',__('Województwo'))) ?>
-assign('input_delivery_region', input_tag('user_data_delivery[region]', $user_data_delivery['region'], array('id'=>'region', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{region}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('label_delivery_address_more', label_for('address_more',__('Adres ciąg dalszy')));
+$smarty->assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $user_data_delivery['address_more'], array('id'=>'address_more', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{address_more}') ? 'st_form-error' : '')));
-assign('label_delivery_code', label_for('code',"* ".__('Kod'), array('id'=>'label_code'))) ?>
-assign('input_delivery_code', input_tag('user_data_delivery[code]', $user_data_delivery['code'], array('id'=>'code', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{code}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('label_delivery_region', label_for('region',__('Województwo')));
+$smarty->assign('input_delivery_region', input_tag('user_data_delivery[region]', $user_data_delivery['region'], array('id'=>'region', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{region}') ? 'st_form-error' : '')));
-assign('label_delivery_town', label_for('town',"* ".__('Miasto'), array('id'=>'label_town'))) ?>
-assign('input_delivery_town', input_tag('user_data_delivery[town]', $user_data_delivery['town'], array('id'=>'town', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{town}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('label_delivery_code', label_for('code',"* ".__('Kod'), array('id'=>'label_code')));
+$smarty->assign('input_delivery_code', input_tag('user_data_delivery[code]', $user_data_delivery['code'], array('id'=>'code', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{code}') ? 'st_form-error' : '')));
-assign('label_delivery_country', label_for('country',__('Kraj'))) ?>
-assign('select_delivery_country', delivery_countries_select_tag('user_data_delivery[country]', $delivery_country_id)) ?>
+$smarty->assign('label_delivery_town', label_for('town',"* ".__('Miasto'), array('id'=>'label_town')));
+$smarty->assign('input_delivery_town', input_tag('user_data_delivery[town]', $user_data_delivery['town'], array('id'=>'town', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{town}') ? 'st_form-error' : '')));
+
+$smarty->assign('label_delivery_country', label_for('country',__('Kraj')));
+$smarty->assign('select_delivery_country', delivery_countries_select_tag('user_data_delivery[country]', $delivery_country_id));
-get('validate_phone')==1){
$smarty->assign('label_delivery_phone', label_for('phone',"* ".__('Telefon')));
}else{
$smarty->assign('label_delivery_phone', label_for('phone',__('Telefon')));
}
-?>
-assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $user_data_delivery['phone'], array('id'=>'phone', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{phone}') ? 'st_form-error' : ''))) ?>
-
+$smarty->assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $user_data_delivery['phone'], array('id'=>'phone', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{phone}') ? 'st_form-error' : '')));
-get('validate_phone')==1 ? $phone_label = "* ".__('Telefon') : $phone_label = __('Telefon'); ?>
-
-
-assign('input_delivery_company', input_tag('user_data_delivery[company]', $user_data_delivery['company'], array('id'=>'company_delivery', 'placeholder'=> '* '.__("Firma"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $user_data_delivery['full_name'], array('id'=>'full_name_delivery', 'placeholder'=> "* ".__('Imię i nazwisko'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_address', input_tag('user_data_delivery[address]', $user_data_delivery['address'], array('id'=>'address_delivery', 'placeholder'=> '* '.__("Ulica nr domu / nr lokalu"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $user_data_delivery['address_more'], array('id'=>'address_more_delivery', 'placeholder'=>__("Adres ciąg dalszy"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_region', input_tag('user_data_delivery[region]', $user_data_delivery['region'], array('id'=>'region_delivery', 'placeholder'=>__("Województwo"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_code', input_tag('user_data_delivery[code]', $user_data_delivery['code'], array('id'=>'code_delivery', 'placeholder'=> '* '.__("Kod"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_town', input_tag('user_data_delivery[town]', $user_data_delivery['town'], array('id'=>'town_delivery', 'placeholder'=> '* '.__("Miasto"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $user_data_delivery['phone'], array('id'=>'phone_delivery', 'placeholder'=> $phone_label, 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+if(stTheme::is_responsive()){
-
+$user_config->get('validate_phone')==1 ? $phone_label = "* ".__('Telefon') : $phone_label = __('Telefon');
-assign('is_authenticated', $sf_user->isAuthenticated()); ?>
-assign('hidden_is_authenticated', input_hidden_tag('user_data_delivery[is_authenticated]', $sf_user->isAuthenticated())); ?>
+ // delivery company
+ $user_data_delivery_company_array = array('id' => 'company_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{company}')){
+ $user_data_delivery_company_array += array('aria-describedby'=>"error_company_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_company', input_tag('user_data_delivery[company]', $user_data_delivery['company'], $user_data_delivery_company_array));
-display('userdata_order_form_delivery.html') ?>
\ No newline at end of file
+ // delivery full name
+ $user_data_delivery_full_name_array = array('id' => 'full_name_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{full_name}')){
+ $user_data_delivery_full_name_array += array('aria-describedby'=>"error_full_name_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $user_data_delivery['full_name'], $user_data_delivery_full_name_array));
+
+ // delivery address
+ $user_data_delivery_address_array = array('id' => 'address_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{address}')){
+ $user_data_delivery_address_array += array('aria-describedby'=>"error_address_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_address', input_tag('user_data_delivery[address]', $user_data_delivery['address'], $user_data_delivery_address_array ));
+
+ $smarty->assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', isset($user_data_delivery['address_more']) ? $user_data_delivery['address_more'] : null, array('id' => 'address_more_delivery','maxlength' => '255', 'class' => 'form-control')));
+
+ // delivery region
+ $smarty->assign('input_delivery_region', input_tag('user_data_delivery[region]', isset($user_data_delivery['region']) ? $user_data_delivery['region'] : null, array('id' => 'region_delivery', 'maxlength' => '255', 'class' => 'form-control')));
+
+ // delivery code
+ $user_data_delivery_code_array = array('id' => 'code_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{code}')){
+ $user_data_delivery_code_array += array('aria-describedby'=>"error_code_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_code', input_tag('user_data_delivery[code]', $user_data_delivery['code'], $user_data_delivery_code_array));
+
+ // delivery town
+ $user_data_delivery_town_array = array('id' => 'town_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+ if($sf_request->getError('user_data_delivery{town}')){
+ $user_data_delivery_town_array += array('aria-describedby'=>"error_town_delivery", 'aria-invalid'=>"true");
+ }
+ $smarty->assign('input_delivery_town', input_tag('user_data_delivery[town]', $user_data_delivery['town'], $user_data_delivery_town_array));
+
+ // delivery phone
+ $user_data_delivery_phone_array = array('id' => 'phone_delivery', 'maxlength' => '255', 'class' => 'form-control');
+ $smarty->assign('validate_phone',0);
+ if($user_config->get('validate_phone') == 1){
+ $smarty->assign('validate_phone',1);
+ $user_data_delivery_phone_array += array('aria-required'=>"true");
+ if ($sf_request->getError('user_data_delivery{phone}')){
+ $user_data_delivery_phone_array += array('aria-describedby'=>"error_phone_billing", 'aria-invalid'=>"true");
+ }
+ }
+ $smarty->assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $user_data_delivery['phone'], $user_data_delivery_phone_array));
+}
+
+$smarty->assign('is_authenticated', $sf_user->isAuthenticated());
+$smarty->assign('hidden_is_authenticated', input_hidden_tag('user_data_delivery[is_authenticated]', $sf_user->isAuthenticated()));
+$smarty->display('userdata_order_form_delivery.html');
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/_pager.php b/apps/frontend/modules/stUserData/templates/_pager.php
new file mode 100644
index 0000000..1b2d95d
--- /dev/null
+++ b/apps/frontend/modules/stUserData/templates/_pager.php
@@ -0,0 +1,54 @@
+ 'stUserData',
+ 'action' => $action,
+);
+
+if ($type)
+{
+ $url_params['type'] = $type;
+}
+
+if ($product_pager->haveToPaginate())
+{
+ $smarty->assign('current_page', $product_pager->getPage());
+
+ $smarty->assign('last_page', $product_pager->getLastPage());
+
+ $links = array();
+
+ foreach ($product_pager->getLinks() as $page)
+ {
+ $url_params['page'] = $page;
+ $links[] = array(
+ 'page' => $page,
+ 'url' => st_url_for($url_params),
+ );
+ }
+
+ $smarty->assign('first_page', 1);
+
+ $url_params['page'] = $product_pager->getPreviousPage();
+
+ $smarty->assign('previous_page_url', st_url_for($url_params));
+
+ $url_params['page'] = $product_pager->getNextPage();
+
+ $smarty->assign('next_page_url', st_url_for($url_params));
+
+ $url_params['page'] = $product_pager->getLastPage();
+
+ $smarty->assign('last_page_url', st_url_for($url_params));
+
+ $smarty->assign('current', $product_pager->getPage());
+
+ $smarty->assign("links", $links);
+
+ $smarty->display('userdata_product_pager.html');
+}
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/_responsiveUserPanelBreadcrumbs.php b/apps/frontend/modules/stUserData/templates/_responsiveUserPanelBreadcrumbs.php
new file mode 100644
index 0000000..f456809
--- /dev/null
+++ b/apps/frontend/modules/stUserData/templates/_responsiveUserPanelBreadcrumbs.php
@@ -0,0 +1,7 @@
+assign('user_email', sfContext::getInstance()->getUser()->getUsername());
+$smarty->assign('active_tab', $active_tab);
+
+$smarty->display('userdata_responsive_user_panel_breadcrumbs.html');
+
+?>
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/_responsiveUserPanelMenu.php b/apps/frontend/modules/stUserData/templates/_responsiveUserPanelMenu.php
index 96bdb14..0e50cba 100644
--- a/apps/frontend/modules/stUserData/templates/_responsiveUserPanelMenu.php
+++ b/apps/frontend/modules/stUserData/templates/_responsiveUserPanelMenu.php
@@ -2,14 +2,13 @@
st_theme_use_stylesheet('stUser.css');
$smarty->assign('user_email', sfContext::getInstance()->getUser()->getUsername());
$smarty->assign('active_tab', $active_tab);
-$smarty->assign('order_number', $order_number);
$newsletter_config = stConfig::getInstance(sfContext::getInstance(), 'stNewsletterBackend');
if($newsletter_config->get('newsletter_enabled')==1){
- $smarty->assign('newsletter_enabled', 0);
+ $smarty->assign('newsletter_enabled', 1);
}else{
- $smarty->assign('newsletter_enabled', 1);
+ $smarty->assign('newsletter_enabled', 0);
}
diff --git a/apps/frontend/modules/stUserData/templates/addressListSuccess.php b/apps/frontend/modules/stUserData/templates/addressListSuccess.php
new file mode 100644
index 0000000..01d190f
--- /dev/null
+++ b/apps/frontend/modules/stUserData/templates/addressListSuccess.php
@@ -0,0 +1,20 @@
+
+
+
+";
+ print_r($userDataBillingDefault);
+ print_r($userDataBilling);
+ print_r($userDataDeliveryDefault);
+ print_r($userDataDelivery);
+ echo "";*/
+?>
+
+assign('userDataBillingDefault',$userDataBillingDefault); ?>
+assign('userDataBilling',$userDataBilling); ?>
+
+assign('userDataDeliveryDefault',$userDataDeliveryDefault); ?>
+assign('userDataDelivery',$userDataDelivery); ?>
+
+
+display('userdata_address_list.html') ?>
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/createFirstUserDataSuccess.php b/apps/frontend/modules/stUserData/templates/createFirstUserDataSuccess.php
index 5150dd5..e49e445 100644
--- a/apps/frontend/modules/stUserData/templates/createFirstUserDataSuccess.php
+++ b/apps/frontend/modules/stUserData/templates/createFirstUserDataSuccess.php
@@ -1,185 +1,180 @@
-
-
-
-
-
-assign('show_region', $show_region);?>
-assign('show_pesel', $show_pesel);?>
-assign('show_address_more', $show_address_more);?>
-
-
-
getErrors()):
-$smarty->assign('errors', __('Uzupełnij zaznaczone pola.'));
-endif;
-?>
+use_helper('Validation', 'Object');
+st_theme_use_stylesheet('stUser.css');
+use_javascript('jquery.infieldlabel.js', 'last');
-assign('form_start', form_tag('stUserData/createFirstUserData', array('class' => 'st_form_ver6', 'name'=>'register'))) ?>
+$smarty->assign('show_region', $show_region);
+$smarty->assign('show_pesel', $show_pesel);
+$smarty->assign('show_address_more', $show_address_more);
-assign('error_billing_message', form_error('user_data_billing[message]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_billing_full_name', form_error('user_data_billing[full_name]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_billing_address', form_error('user_data_billing[address]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_billing_address_more', form_error('user_data_billing[address_more]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>assign('error_billing_code', form_error('user_data_billing[code]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_billing_region', form_error('user_data_billing[region]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_billing_town', form_error('user_data_billing[town]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_billing_phone', form_error('user_data_billing[phone]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_billing_vat', form_error('user_data_billing[vatNumber]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
+$user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser');
-assign('error_company', $sf_request->getError('user_data_billing{company}')); ?>
-assign('error_nip', $sf_request->getError('user_data_billing{vat_number}')); ?>
-assign('error_full_name', $sf_request->getError('user_data_billing{full_name}')); ?>
-assign('error_address', $sf_request->getError('user_data_billing{address}')); ?>
-assign('error_code_town', $sf_request->getError('user_data_billing{code}').$sf_request->getError('user_data_billing{town}')); ?>
-assign('error_code', $sf_request->getError('user_data_billing{code}')); ?>
-assign('error_town', $sf_request->getError('user_data_billing{town}')); ?>
-assign('error_phone', $sf_request->getError('user_data_billing{phone}')); ?>
-
-
-assign('label_billing_customer_type1', __('Klient indywidualny')) ?>
-assign('radio_billing_customer_type1', radiobutton_tag('user_data_billing[customer_type]', 1, $type1_billing_checker)) ?>
-
-assign('label_billing_customer_type2', __('Firma')) ?>
-assign('radio_billing_customer_type2', radiobutton_tag('user_data_billing[customer_type]', 2, $type2_billing_checker)) ?>
-
-assign('label_company', label_for('billing_company',"* ".__('Firma'))) ?>
-assign('input_company', input_tag('user_data_billing[company]', $userDataBilling->getCompany(), array('id'=>'billing_company', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{company}') ? 'st_form-error' : ''))) ?>
-
-assign('label_full_name', label_for('billing_full_name',"* ".__('Imię i nazwisko'), array('id'=>'full_name_label'))) ?>
-assign('label_full_name_text', __('Imię i nazwisko')); ?>
-assign('input_full_name', input_tag('user_data_billing[full_name]', $userDataBilling->getFullName(), array('id'=>'billing_full_name', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{full_name}') ? 'st_form-error' : ''))) ?>
-
-assign('label_address', label_for('billing_address',"* ".__('Ulica nr domu / nr lokalu'))) ?>
-assign('input_address', input_tag('user_data_billing[address]', $userDataBilling->getAddress(), array('id'=>'billing_address', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{address}') ? 'st_form-error' : ''))) ?>
-
-assign('label_address_more', label_for('billing_address_more',__('Adres ciąg dalszy'))) ?>
-assign('input_address_more', input_tag('user_data_billing[address_more]', $userDataBilling->getAddressMore(), array('id'=>'billing_address_more', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{address_more}') ? 'st_form-error' : ''))) ?>
-
-assign('label_region', label_for('billing_region',__('Województwo'))) ?>
-assign('input_region', input_tag('user_data_billing[region]', $userDataBilling->getRegion(), array('id'=>'billing_region', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{region}') ? 'st_form-error' : ''))) ?>
-
-assign('label_code', label_for('billing_code',"* ".__('Kod'))) ?>
-assign('input_code', input_tag('user_data_billing[code]', $userDataBilling->getCode(), array('id'=>'billing_code', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{code}') ? 'st_form-error' : ''))) ?>
-
-assign('label_town', label_for('billing_town',"* ".__('Miasto'))) ?>
-assign('input_town', input_tag('user_data_billing[town]', $userDataBilling->getTown(), array('id'=>'billing_town', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{town}') ? 'st_form-error' : ''))) ?>
-
-assign('select_country', object_select_tag($userDataBilling->getCountriesId(), 'getId', array('id'=>'billing_country', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data_billing[country]'))) ?>
-
-get('validate_phone')==1){
- $smarty->assign('label_phone', label_for('billing_phone',"* ".__('Telefon')));
-}else{
- $smarty->assign('label_phone', label_for('billing_phone',__('Telefon')));
+if ($sf_request->getErrors()){
+ $smarty->assign('errors', __('Uzupełnij zaznaczone pola.'));
}
-?>
-assign('input_phone', input_tag('user_data_billing[phone]', $userDataBilling->getPhone(), array('id'=>'billing_phone', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{phone}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('form_start', form_tag('stUserData/createFirstUserData', array('class' => 'st_form_ver6', 'name'=>'register')));
-assign('label_nip', label_for('billing_nip',"* ".__('NIP'))) ?>
-assign('input_nip', input_tag('user_data_billing[vat_number]', $userDataBilling->getVatNumber(), array('id'=>'billing_nip', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{vat_number}') ? 'st_form-error' : ''))) ?>
+$smarty->assign('error_company', $sf_request->getError('user_data_billing{company}'));
+$smarty->assign('error_nip', $sf_request->getError('user_data_billing{vat_number}'));
+$smarty->assign('error_full_name', $sf_request->getError('user_data_billing{full_name}'));
+$smarty->assign('error_address', $sf_request->getError('user_data_billing{address}'));
+$smarty->assign('error_code_town', $sf_request->getError('user_data_billing{code}').$sf_request->getError('user_data_billing{town}'));
+$smarty->assign('error_code', $sf_request->getError('user_data_billing{code}'));
+$smarty->assign('error_town', $sf_request->getError('user_data_billing{town}'));
+$smarty->assign('error_phone', $sf_request->getError('user_data_billing{phone}'));
+
-assign('label_pesel', label_for('billing_pesel',__('PESEL'))) ?>
-assign('input_pesel', input_tag('user_data_billing[pesel]', $userDataBilling->getPesel(), array('id'=>'billing_pesel', 'maxlength'=>'255', 'class'=>form_has_error('user_data_billing{pesel}') ? 'st_form-error' : ''))) ?>
-
-assign('checkbox_delivery', checkbox_tag('different_delivery', 1, $different_delivery, array('id'=>'different_delivery', 'class'=>'checkobox'))) ?>
-
-assign('error_delivery_message', form_error('user_data_delivery[message]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_full_name',form_error('user_data_delivery[full_name]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_address', form_error('user_data_delivery[address]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_address_more', form_error('user_data_delivery[address_more]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_region', form_error('user_data_delivery[region]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_code', form_error('user_data_delivery[code]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_town', form_error('user_data_delivery[town]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_phone', form_error('user_data_delivery[phone]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-assign('error_delivery_vat', form_error('user_data_delivery[vatNumber]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error'))) ?>
-
-assign('error_delivery_company', $sf_request->getError('user_data_delivery{company}')); ?>
-assign('error_delivery_full_name', $sf_request->getError('user_data_delivery{full_name}')) ?>
-assign('error_delivery_address', $sf_request->getError('user_data_delivery{address}')) ?>
-assign('error_delivery_region', $sf_request->getError('user_data_delivery{region}')) ?>
-assign('error_delivery_code_town', $sf_request->getError('user_data_delivery{code}').$sf_request->getError('user_data_delivery{town}')); ?>
-assign('error_delivery_code', $sf_request->getError('user_data_delivery{code}')); ?>
-assign('error_delivery_town', $sf_request->getError('user_data_delivery{town}')); ?>
-assign('error_delivery_phone', $sf_request->getError('user_data_delivery{phone}')) ?>
+$smarty->assign('label_billing_customer_type1', __('Klient indywidualny'));
+$smarty->assign('radio_billing_customer_type1', radiobutton_tag('user_data_billing[customer_type]', 1, $type1_billing_checker, array('style'=>'margin-left: 0px;')));
+$smarty->assign('label_billing_customer_type2', __('Firma'));
+$smarty->assign('radio_billing_customer_type2', radiobutton_tag('user_data_billing[customer_type]', 2, $type2_billing_checker, array('style'=>'margin-left: 0px;')));
-assign('label_delivery_customer_type1', __('Klient indywidualny')) ?>
-assign('radio_delivery_customer_type1', radiobutton_tag('user_data_delivery[customer_type]', 1, $type1_delivery_checker)) ?>
+$smarty->assign('select_country', object_select_tag($userDataBilling->getCountriesId(), 'getId', array('id'=>'billing_country', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data_billing[country]')));
+$smarty->assign('checkbox_delivery', checkbox_tag('different_delivery', 1, $different_delivery, array('id'=>'different_delivery', 'class'=>'checkobox')));
+$smarty->assign('error_delivery_company', $sf_request->getError('user_data_delivery{company}'));
+$smarty->assign('error_delivery_full_name', $sf_request->getError('user_data_delivery{full_name}'));
+$smarty->assign('error_delivery_address', $sf_request->getError('user_data_delivery{address}'));
+$smarty->assign('error_delivery_code_town', $sf_request->getError('user_data_delivery{code}').$sf_request->getError('user_data_delivery{town}'));
+$smarty->assign('error_delivery_code', $sf_request->getError('user_data_delivery{code}'));
+$smarty->assign('error_delivery_town', $sf_request->getError('user_data_delivery{town}'));
+$smarty->assign('error_delivery_phone', $sf_request->getError('user_data_delivery{phone}'));
+
-assign('label_delivery_customer_type2', __('Firma')) ?>
-assign('radio_delivery_customer_type2', radiobutton_tag('user_data_delivery[customer_type]', 2, $type2_delivery_checker)) ?>
+$smarty->assign('label_delivery_customer_type1', __('Klient indywidualny'));
+$smarty->assign('radio_delivery_customer_type1', radiobutton_tag('user_data_delivery[customer_type]', 1, $type1_delivery_checker, array('style'=>'margin-left: 0px;')));
+$smarty->assign('label_delivery_customer_type2', __('Firma'));
+$smarty->assign('radio_delivery_customer_type2', radiobutton_tag('user_data_delivery[customer_type]', 2, $type2_delivery_checker, array('style'=>'margin-left: 0px;')));
+
+$smarty->assign('select_delivery_country', st_get_component('stUserData', 'deliveryCountriesSelect', array('id' => 'user_data_delivery_country', 'force_default_country_id' => $userDataDelivery->getCountriesId())));
+$smarty->assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $userDataDelivery->getPhone(), array('id'=>'delivery_phone', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{phone}') ? 'st_form-error' : '')));
-assign('label_delivery_company', label_for('delivery_company',"* ".__('Firma'))) ?>
-assign('input_delivery_company', input_tag('user_data_delivery[company]', $userDataDelivery->getCompany(), array('id'=>'delivery_company', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{company}') ? 'st_form-error' : ''))) ?>
+if(stTheme::is_responsive()){
-assign('label_delivery_full_name', label_for('delivery_full_name',"* ".__('Imię i nazwisko'), array('id'=>'full_name_delivery_label'))) ?>
-assign('label_delivery_full_name_text', __('Imię i nazwisko')); ?>
-assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $userDataDelivery->getFullName(), array('id'=>'delivery_full_name', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{full_name}') ? 'st_form-error' : ''))) ?>
+$user_config->get('validate_phone')==1 ? $phone_label = "* ".__('Telefon') : $phone_label = __('Telefon');
+
-assign('label_delivery_address', label_for('delivery_address',"* ".__('Ulica nr domu / nr lokalu'))) ?>
-assign('input_delivery_address', input_tag('user_data_delivery[address]', $userDataDelivery->getAddress(), array('id'=>'delivery_address', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{address}') ? 'st_form-error' : ''))) ?>
-
-assign('label_delivery_address_more', label_for('delivery_address_more',"* ".__('Adres ciąg dalszy'))) ?>
-assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $userDataDelivery->getAddressMore(), array('id'=>'delivery_address_more', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{address_more}') ? 'st_form-error' : ''))) ?>
-
-assign('label_delivery_region', label_for('delivery_region',__('Województwo'))) ?>
-assign('input_delivery_region', input_tag('user_data_delivery[region]', $userDataDelivery->getRegion(), array('id'=>'delivery_region', 'maxlength'=>'255'))) ?>
-
-assign('label_delivery_code', label_for('delivery_code',"* ".__('Kod'))) ?>
-assign('input_delivery_code', input_tag('user_data_delivery[code]', $userDataDelivery->getCode(), array('id'=>'delivery_code', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{code}') ? 'st_form-error' : ''))) ?>
-
-assign('label_delivery_town', label_for('delivery_town',"* ".__('Miasto'))) ?>
-assign('input_delivery_town', input_tag('user_data_delivery[town]', $userDataDelivery->getTown(), array('id'=>'delivery_town', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{town}') ? 'st_form-error' : ''))) ?>
-
-
-assign('select_delivery_country', st_get_component('stUserData', 'deliveryCountriesSelect', array('force_default_country_id' => $userDataDelivery->getCountriesId()))) ?>
-
-get('validate_phone')==1){
- $smarty->assign('label_delivery_phone', label_for('delivery_phone',"* ".__('Telefon')));
-}else{
- $smarty->assign('label_delivery_phone', label_for('delivery_phone',__('Telefon')));
+// company
+$user_data_company_array = array('id'=>'company_billing', 'aria-required'=>"true", 'maxlength'=>'255', 'class'=>'form-control');
+if($sf_request->getError('user_data_billing{company}')){
+ $user_data_company_array += array('aria-describedby'=>"error_company", 'aria-invalid'=>"true");
}
-?>
+$smarty->assign('input_company', input_tag('user_data_billing[company]', $userDataBilling->getCompany(), $user_data_company_array));
-assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $userDataDelivery->getPhone(), array('id'=>'delivery_phone', 'maxlength'=>'255', 'class'=>form_has_error('user_data_delivery{phone}') ? 'st_form-error' : ''))) ?>
+// nip
+$smarty->assign("nip_label", __($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"));
+$user_data_vat_number_array = array('id'=>'nip_billing', 'aria-required'=>"true", 'maxlength'=>'255', 'class'=>'form-control');
+if ($sf_request->getError('user_data_billing{vat_number}')){
+ $user_data_vat_number_array += array('aria-describedby'=>"error_vat", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_nip', input_tag('user_data_billing[vat_number]', $userDataBilling->getVatNumber(), $user_data_vat_number_array));
+
+// full name
+$user_data_full_name_array = array('id'=>'full_name_billing', 'aria-required'=>"true", 'maxlength'=>'255', 'class'=>'form-control');
+if ($sf_request->getError('user_data_billing{full_name}')){
+ $user_data_full_name_array += array('aria-describedby'=>"error_full_name", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_full_name', input_tag('user_data_billing[full_name]', $userDataBilling->getFullName(), $user_data_full_name_array));
+
+// adress
+$user_data_address_array = array('id'=>'address_billing', 'aria-required'=>"true", 'maxlength'=>'255', 'class'=>'form-control');
+if ($sf_request->getError('user_data_billing{address}')){
+ $user_data_address_array += array('aria-describedby'=>"error_adress", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_address', input_tag('user_data_billing[address]', $userDataBilling->getAddress(), $user_data_address_array));
+
+$smarty->assign('input_address_more', input_tag('user_data_billing[address_more]', $userDataBilling->getAddressMore(), array('id'=>'address_more_billing', 'maxlength'=>'255', 'class'=>'form-control')));
+
+// region
+$smarty->assign('input_region', input_tag('user_data_billing[region]', $userDataBilling->getRegion(), array('id'=>'region_billing', 'maxlength'=>'255', 'class'=>'form-control')));
+
+// code
+$user_data_code_array = array('id'=>'code_billing', 'aria-required'=>"true", 'maxlength'=>'255', 'class'=>'form-control');
+if ($sf_request->getError('user_data_billing{code}')){
+ $user_data_code_array += array('aria-describedby'=>"error_code", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_code', input_tag('user_data_billing[code]', $userDataBilling->getCode(), $user_data_code_array));
+
+// town
+$user_data_town_array = array('id'=>'town_billing', 'aria-required'=>"true", 'maxlength'=>'255', 'class'=>'form-control');
+if ($sf_request->getError('user_data_billing{town}')){
+ $user_data_town_array += array('aria-describedby'=>"error_town", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_town', input_tag('user_data_billing[town]', $userDataBilling->getTown(), $user_data_town_array));
+
+// country
+$smarty->assign('select_country', object_select_tag($userDataBilling->getCountriesId(), 'getId', array('id'=>'billing_country', 'class'=>'form-control', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data_billing[country]')));
+
+// phone
+$user_data_phone_array = array('id'=>'phone_billing', 'maxlength'=>'255', 'class'=>'form-control');
+$smarty->assign('validate_phone',0);
+if($user_config->get('validate_phone') == 1){
+ $smarty->assign('validate_phone',1);
+ $user_data_phone_array += array('aria-required'=>"true");
+ if ($sf_request->getError('user_data_billing{phone}')){
+ $user_data_phone_array += array('aria-describedby'=>"error_phone", 'aria-invalid'=>"true");
+ }
+}
+$smarty->assign('input_phone', input_tag('user_data_billing[phone]', $userDataBilling->getPhone(), $user_data_phone_array));
+
+// pesel
+$smarty->assign('input_pesel', input_tag('user_data_billing[pesel]', $userDataBilling->getPesel(), array('id'=>'billing-pesel', 'maxlength'=>'255', 'class'=>'form-control')));
+
+// delivery company
+$user_data_delivery_company_array = array('id' => 'company_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+if($sf_request->getError('user_data_delivery{company}')){
+ $user_data_delivery_company_array += array('aria-describedby'=>"error_company_delivery", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_delivery_company', input_tag('user_data_delivery[company]', $userDataDelivery->getCompany(), $user_data_delivery_company_array));
-
-get('validate_phone')==1 ? $phone_label = "* ".__('Telefon') : $phone_label = __('Telefon'); ?>
+// delivery full name
+$user_data_delivery_full_name_array = array('id' => 'full_name_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+if($sf_request->getError('user_data_delivery{full_name}')){
+ $user_data_delivery_full_name_array += array('aria-describedby'=>"error_full_name_delivery", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $userDataDelivery->getFullName(), $user_data_delivery_full_name_array));
-
-assign('input_company', input_tag('user_data_billing[company]', $userDataBilling->getCompany(), array('id'=>'company_billing', 'placeholder'=> '* '.__("Firma"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_nip', input_tag('user_data_billing[vat_number]', $userDataBilling->getVatNumber(), array('id'=>'nip_billing','placeholder'=> "* ".__($sf_user->hasVatEu() ? "Numer VAT UE" : "NIP"), 'maxlength'=>'255', 'class'=>'form-control'))) ?>
-assign('input_full_name', input_tag('user_data_billing[full_name]', $userDataBilling->getFullName(), array('id'=>'full_name_billing', 'placeholder'=> "* ".__('Imię i nazwisko'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_address', input_tag('user_data_billing[address]', $userDataBilling->getAddress(), array('id'=>'address_billing', 'placeholder'=> '* '.__("Ulica nr domu / nr lokalu"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_address_more', input_tag('user_data_billing[address_more]', $userDataBilling->getAddressMore(), array('id'=>'address_more_billing', 'placeholder'=>__("Adres ciąg dalszy"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_region', input_tag('user_data_billing[region]', $userDataBilling->getRegion(), array('id'=>'region_billing', 'placeholder'=>__("Województwo"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_code', input_tag('user_data_billing[code]', $userDataBilling->getCode(), array('id'=>'code_billing', 'placeholder'=> '* '.__("Kod pocztowy"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_town', input_tag('user_data_billing[town]', $userDataBilling->getTown(), array('id'=>'town_billing', 'placeholder'=> '* '.__("Miasto"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('select_country', object_select_tag($userDataBilling->getCountriesId(), 'getId', array('id'=>'billing_country', 'class'=>'form-control', 'related_class' => 'Countries', 'peer_method'=>"doSelectActive", 'control_name' => 'user_data_billing[country]'))) ?>
-assign('input_phone', input_tag('user_data_billing[phone]', $userDataBilling->getPhone(), array('id'=>'phone_billing', 'placeholder'=> $phone_label, 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_pesel', input_tag('user_data_billing[pesel]', $userDataBilling->getPesel(), array('id'=>'billing-pesel', 'placeholder'=>__('PESEL'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+// delivery address
+$user_data_delivery_address_array = array('id' => 'address_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+if($sf_request->getError('user_data_delivery{address}')){
+ $user_data_delivery_address_array += array('aria-describedby'=>"error_address_delivery", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_delivery_address', input_tag('user_data_delivery[address]', $userDataDelivery->getAddress(), $user_data_delivery_address_array ));
-
-assign('input_delivery_company', input_tag('user_data_delivery[company]', $userDataDelivery->getCompany(), array('id'=>'company_delivery', 'placeholder'=> '* '.__("Firma"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_full_name', input_tag('user_data_delivery[full_name]', $userDataDelivery->getFullName(), array('id'=>'full_name_delivery', 'placeholder'=> "* ".__('Imię i nazwisko'), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_address', input_tag('user_data_delivery[address]', $userDataDelivery->getAddress(), array('id'=>'address_delivery', 'placeholder'=> '* '.__("Ulica nr domu / nr lokalu"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $userDataDelivery->getAddressMore(), array('id'=>'address_more_delivery', 'placeholder'=>__("Adres ciąg dalszy"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_region', input_tag('user_data_delivery[region]', $userDataDelivery->getRegion(), array('id'=>'region_delivery', 'placeholder'=>__("Województwo"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_code', input_tag('user_data_delivery[code]', $userDataDelivery->getCode(), array('id'=>'code_delivery', 'placeholder'=> '* '.__("Kod"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_town', input_tag('user_data_delivery[town]', $userDataDelivery->getTown(), array('id'=>'town_delivery', 'placeholder'=> '* '.__("Miasto"), 'maxlength'=>'255', 'class'=>'form-control'))); ?>
-assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $userDataDelivery->getPhone(), array('id'=>'phone_delivery', 'placeholder'=> $phone_label, 'maxlength'=>'255', 'class'=>'form-control'))); ?>
+$smarty->assign('input_delivery_address_more', input_tag('user_data_delivery[address_more]', $userDataDelivery->getAddressMore(), array('id' => 'address_more_delivery','maxlength' => '255', 'class' => 'form-control')));
-
+// delivery region
+$smarty->assign('input_delivery_region', input_tag('user_data_delivery[region]', $userDataDelivery->getRegion(), array('id' => 'region_delivery', 'maxlength' => '255', 'class' => 'form-control')));
-assign('save_submit',submit_tag(__('Zapisz'),array('name'=>'submit_save'))) ?>
+// delivery code
+$user_data_delivery_code_array = array('id' => 'code_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+if($sf_request->getError('user_data_delivery{code}')){
+ $user_data_delivery_code_array += array('aria-describedby'=>"error_code_delivery", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_delivery_code', input_tag('user_data_delivery[code]', $userDataDelivery->getCode(), $user_data_delivery_code_array));
+// delivery town
+$user_data_delivery_town_array = array('id' => 'town_delivery', 'maxlength' => '255', 'class' => 'form-control', 'aria-required'=>"true");
+if($sf_request->getError('user_data_delivery{town}')){
+ $user_data_delivery_town_array += array('aria-describedby'=>"error_town_delivery", 'aria-invalid'=>"true");
+}
+$smarty->assign('input_delivery_town', input_tag('user_data_delivery[town]', $userDataDelivery->getTown(), $user_data_delivery_town_array));
-
-assign('hidden_delivery_id', input_hidden_tag('user_data_delivery[id]', $userDataDelivery->getId())) ?>
-assign('hidden_billing_id', input_hidden_tag('user_data_billing[id]', $userDataBilling->getId())) ?>
-
-display('userdata_create_first_user_data.html') ?>
\ No newline at end of file
+// delivery phone
+$user_data_delivery_phone_array = array('id' => 'phone_delivery', 'maxlength' => '255', 'class' => 'form-control');
+ if($user_config->get('validate_phone') == 1){
+ $user_data_delivery_phone_array += array('aria-required'=>"true");
+ if ($sf_request->getError('user_data_delivery{phone}')){
+ $user_data_delivery_phone_array += array('aria-describedby'=>"error_phone_billing", 'aria-invalid'=>"true");
+ }
+}
+$smarty->assign('input_delivery_phone', input_tag('user_data_delivery[phone]', $userDataDelivery->getPhone(), $user_data_delivery_phone_array));
+}
+$smarty->assign('save_submit',submit_tag(__('Zapisz'),array('name'=>'submit_save')));
+$smarty->assign('hidden_delivery_id', input_hidden_tag('user_data_delivery[id]', $userDataDelivery->getId()));
+$smarty->assign('hidden_billing_id', input_hidden_tag('user_data_billing[id]', $userDataBilling->getId()));
+$smarty->display('userdata_create_first_user_data.html');
+?>
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/productListSuccess.php b/apps/frontend/modules/stUserData/templates/productListSuccess.php
new file mode 100644
index 0000000..2a8360e
--- /dev/null
+++ b/apps/frontend/modules/stUserData/templates/productListSuccess.php
@@ -0,0 +1,235 @@
+
+
+
+assign('tab', $tab);
+
+$smarty->assign('is_authenticated', $is_authenticated);
+
+$results = array();
+
+if (isset($product_pager))
+{
+
+ $config = stConfig::getInstance('stProduct');
+
+ foreach ($product_pager->getResults() as $product)
+ {
+ $photo_max_height = st_asset_thumbnail_setting('height', 'small');
+
+ $photo_max_width = st_asset_thumbnail_setting('width', 'small');
+
+ $description_type = $config->get('description_type_long');
+
+ $cut_description = $config->get('cut_description_long');
+
+ $max_desc_length = $config->get('cut_description_num_long');
+
+ $cut_name = $config->get('cut_name_long');
+
+ $max_name_length = $config->get('cut_name_num_long');
+
+ $cut_code = $config->get('cut_code_long');
+
+ $max_code_length = $config->get('cut_code_num_long');
+
+ $weight_unit = $config->get('weight_unit');
+
+ $url_params = array(
+ 'module' => 'stProduct',
+ 'action' => 'show',
+ );
+
+
+ $url_params['url'] = $product->getUrl();
+
+ $product_url = st_url_for($url_params);
+
+ $product_name = $product->getName();
+
+ $row['instance'] = $product;
+
+ if ($cut_name && st_check_strlen($product_name) > $max_name_length + 1)
+ {
+ $row['name'] = '' . content_tag('a', st_truncate_text($product_name, $max_name_length, '...'), array('href' => $product_url, 'class' => 'product_name')) . '';
+ }
+ else
+ {
+ $row['name'] = content_tag('a', $product_name, array('href' => $product_url, 'class' => 'product_name'));
+ }
+
+ if ($cut_code && st_check_strlen($product->getCode()) > $max_code_length)
+ {
+ $row['code'] = '' . content_tag('a', st_truncate_text($product->getCode(), $max_code_length, '...'), array('href' => $product_url, 'class' => 'product_name')) . '';
+ }
+ else
+ {
+ $row['code'] = content_tag('a', $product->getCode(), array('href' => $product_url));
+ }
+
+ $row['id'] = $product->getId();
+
+ $row['photo'] = content_tag('a', st_product_image_tag($product, 'small'), array('href' => $product_url));
+
+ $row['photo_max_height'] = $photo_max_height;
+
+ $row['colors'] = st_get_component('stProductOptionsFrontend', 'colors', array('product' => $product));
+
+ $row['uom'] = st_product_uom($product);
+
+ $row['stock'] = $product->getStock();
+
+ if ($product->isPriceVisible())
+ {
+
+ if ($config->get('show_uom_long') && $product->getUom())
+ {
+ $uom = " / ".$row['uom'];
+ }else{
+ $uom = "";
+ }
+
+ $row['price'] = st_currency_format($product->getPriceBrutto(true)).$uom;
+
+ $row['price_net'] = st_currency_format($product->getPriceNetto(true)).$uom;
+
+ $row['price_brutto_pure'] = $product->getPriceBrutto(true).$uom;
+
+ $row['price_netto_pure'] = $product->getPriceNetto(true).$uom;
+
+ $currency = stCurrency::getInstance(sfContext::getInstance());
+
+ if ($currency->getFrontSymbol())
+ {
+ $row['currency'] = $currency->getFrontSymbol();
+ }
+ else
+ {
+ $row['currency'] = $currency->getBackSymbol();
+ }
+
+
+ $old_price_brutto = $product->getOldPriceBrutto(true);
+
+ $row['check_old_price'] = $old_price_brutto != 0;
+
+ $row['old_price'] = st_currency_format($old_price_brutto);
+
+ $row['old_price_net'] = st_currency_format($product->getOldPriceNetto(true));
+
+ $row['discount'] = $product->getDiscountInPercent();
+
+ $row['check_price'] = false;
+
+ if ($config->get('show_basic_price_long') && $product->hasBasicPrice() && $product->getBasicPriceBrutto()!=0)
+ {
+ $row['basic_price'] = array(
+ 'netto' => st_currency_format($product->getBasicPriceNetto(true)),
+ 'brutto' => st_currency_format($product->getBasicPriceBrutto(true)),
+ 'quantity' => st_product_basic_price_quantity($product),
+ 'for_quantity' => st_product_basic_price_for_quantity($product),
+ );
+
+ }
+ else
+ {
+ $row['basic_price'] = null;
+ }
+
+ }
+ else
+ {
+ $row['check_price'] = true;
+ }
+
+ $row['points_value'] = $product->getPointsValue();
+
+ $row['points_earn'] = $product->getPointsEarn();
+
+ $row['points_only'] = $product->getPointsOnly();
+
+
+ // 7
+
+ if ($description_type == 'short')
+ {
+ if ($cut_description && st_check_strlen($product->getShortDescription()) > $max_desc_length)
+ {
+ $row['description'] = st_truncate_text($product->getShortDescription(), $max_desc_length, '...');
+ }
+ else
+ {
+ $row['description'] = strip_tags($product->getShortDescription());
+ }
+ }
+ elseif ($description_type == 'full')
+ {
+ if ($cut_description && st_check_strlen($product->getDescription()) > $max_desc_length)
+ {
+ $row['description'] = st_truncate_text($product->getDescription(), $max_desc_length, '...');
+ }
+ else
+ {
+ $row['description'] = strip_tags($product->getDescription());
+ }
+ }
+
+ $row['availability'] = st_availability_show($product);
+
+ $row['name_without_link'] = $product_name;
+
+ $row['link'] = $product_url;
+
+ $row['my_groups'] = st_product_group_labels($product, $product_url, sfContext::getInstance()->getUser()->getCulture());
+
+ $row['weight'] = $config->get('show_weight_long') && $product->getWeight() ? $product->getWeight().' '.$weight_unit : '';
+
+
+ $row['name'] = $product->getName();
+ $results[] = $row;
+ }
+
+$smarty->assign("show_name", $config->get('show_name_long'));
+
+$smarty->assign("show_image", $config->get('show_image_long'));
+
+$smarty->assign("show_code", $config->get('show_code_long'));
+
+$smarty->assign("show_price", $config->get('show_price_long'));
+
+$smarty->assign("show_old_price", $config->get('show_old_price_long'));
+
+$smarty->assign("show_discount", $config->get('show_discount_long'));
+
+$smarty->assign("show_basket", $config->get('show_basket_long'));
+
+$smarty->assign("price_view", $config->get('price_view_long'));
+
+$smarty->assign("show_description", $config->get('show_description_long'));
+
+$smarty->assign('show_weight', $config->get('show_weight_long'));
+
+$smarty->assign('button_type', $config->get('button_type_long'));
+
+$smarty->assign('show_stock', $config->get('show_depository_long'));
+
+$smarty->assign('show_availability', $config->get('show_availability_long'));
+
+$config_observe = stConfig::getInstance(sfContext::getInstance(), 'stProductObserveBackend');
+
+$smarty->assign('is_observe_enabled', $config_observe->get('enabled'));
+
+$smarty->assignPartial('pager', 'stUserData', 'pager', array('product_pager' => $product_pager, 'type' => $type, 'action' => 'productList'));
+
+}
+
+$smarty->assign('results', $results);
+
+
+$smarty->display('userdata_product_list.html')
+
+?>
\ No newline at end of file
diff --git a/apps/frontend/modules/stUserData/templates/theme/default2/userdata_order_form_billing.html.bck b/apps/frontend/modules/stUserData/templates/theme/default2/userdata_order_form_billing.html.bck
new file mode 100644
index 0000000..22f161e
--- /dev/null
+++ b/apps/frontend/modules/stUserData/templates/theme/default2/userdata_order_form_billing.html.bck
@@ -0,0 +1,296 @@
+{__ text="Zarządzaj swoimi adresami do wysyłki. Możesz dodawać nowe, edytować istniejące lub ustawić domyślny adres dla swoich zamówień."}
+