From c763b26acb5d5b8b5b5f7dc1dc01623c70b9b6f7 Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Thu, 23 Jul 2015 16:02:56 +0300 Subject: [PATCH 01/15] Do not show header if this option is enabled in theme settings. Fix #356 --- .../Order/html_client/mod_order_list.phtml | 2 - .../huraga/html/layout_default.phtml | 122 +++++++++--------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/bb-modules/Order/html_client/mod_order_list.phtml b/src/bb-modules/Order/html_client/mod_order_list.phtml index 6f05e1771..74ca5d430 100644 --- a/src/bb-modules/Order/html_client/mod_order_list.phtml +++ b/src/bb-modules/Order/html_client/mod_order_list.phtml @@ -42,9 +42,7 @@ {% trans 'The list is empty' %} - {% endfor %} - diff --git a/src/bb-themes/huraga/html/layout_default.phtml b/src/bb-themes/huraga/html/layout_default.phtml index 250a6cdde..a9762b214 100644 --- a/src/bb-themes/huraga/html/layout_default.phtml +++ b/src/bb-themes/huraga/html/layout_default.phtml @@ -52,71 +52,73 @@
-
-
    - {% set languages = guest.extension_languages %} - {% if languages|length > 1 %} - {% set currentLang = guest.system_locale %} - {% set countryCode = currentLang | slice(3, 2) %} -
  • -
    - - - {{ countryCode }} - + {% if settings.show_page_header %} +
    +
      + {% set languages = guest.extension_languages %} + {% if languages|length > 1 %} + {% set currentLang = guest.system_locale %} + {% set countryCode = currentLang | slice(3, 2) %} +
    • +
      + + + {{ countryCode }} + + +
        + {% for lang in languages %} + {% set countryCode = lang | slice(3, 2) %} + {% if lang != currentLang %} +
      • {{ lang | trans }}
      • + {% endif %} + {% endfor %} +
      +
      +
    • + + {% endif %} + + {% if settings.top_menu_dashboard %} +
    • + {% trans 'Dashboard' %} +
    • + {% endif %} + {% if settings.top_menu_order %} +
    • + {% trans 'Order services' %} +
    • + {% endif %} + {% if settings.top_menu_profile %} +
    • + {% trans 'Profile' %} +
    • + {% endif %} + + {% if settings.top_menu_signout %} +
    • + {% trans 'Sign out' %} +
    • + {% endif %} +
    +
    + + {% if settings.show_company_logo %} + {% if company.logo_url %} +

    + + {{company.name}} -
      - {% for lang in languages %} - {% set countryCode = lang | slice(3, 2) %} - {% if lang != currentLang %} -
    • {{ lang | trans }}
    • - {% endif %} - {% endfor %} -
    -

    -
  • - +

    + + {% endif %} {% endif %} - {% if settings.top_menu_dashboard %} -
  • - {% trans 'Dashboard' %} -
  • + {% if settings.show_company_name %} +

    {{company.name}}

    {% endif %} - {% if settings.top_menu_order %} -
  • - {% trans 'Order services' %} -
  • - {% endif %} - {% if settings.top_menu_profile %} -
  • - {% trans 'Profile' %} -
  • - {% endif %} - - {% if settings.top_menu_signout %} -
  • - {% trans 'Sign out' %} -
  • - {% endif %} -
-
- - {% if settings.show_company_logo %} - {% if company.logo_url %} -

- - {{company.name}} - -

-

{% endif %} - {% endif %} - - {% if settings.show_company_name %} -

{{company.name}}

- {% endif %} -
+
From 0e618a5c457880ab24c3184995128904e29b5377 Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Thu, 23 Jul 2015 16:31:00 +0300 Subject: [PATCH 02/15] Pagination 'Previous' and 'Next' arrows fixed. Fixes #354 --- src/bb-themes/huraga/html/partial_pagination.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bb-themes/huraga/html/partial_pagination.phtml b/src/bb-themes/huraga/html/partial_pagination.phtml index 50430ed6c..4c37084f1 100644 --- a/src/bb-themes/huraga/html/partial_pagination.phtml +++ b/src/bb-themes/huraga/html/partial_pagination.phtml @@ -4,11 +4,11 @@
  • - « + «
  • - +
  • {% for i in 1..list.pages %} @@ -22,11 +22,11 @@ {% endfor %}
  • - +
  • - » + »
From 719503ec6ee7fe735b118295af206ee57c4e68cd Mon Sep 17 00:00:00 2001 From: Vaidas Lungis Date: Wed, 29 Jul 2015 13:46:21 +0300 Subject: [PATCH 03/15] fix input fields overlap in new domain order configuration page --- .../Servicedomain/html_admin/mod_servicedomain_order.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bb-modules/Servicedomain/html_admin/mod_servicedomain_order.phtml b/src/bb-modules/Servicedomain/html_admin/mod_servicedomain_order.phtml index 6a2459cdc..459fb5dc5 100644 --- a/src/bb-modules/Servicedomain/html_admin/mod_servicedomain_order.phtml +++ b/src/bb-modules/Servicedomain/html_admin/mod_servicedomain_order.phtml @@ -9,7 +9,7 @@
-
+
  • {{ mf.selectboxtld('config[register_tld]', guest.serviceDomain_tlds({"allow_register":1})) }}
  • @@ -21,7 +21,7 @@
    -
    +
    • {{ mf.selectboxtld('config[transfer_tld]', guest.serviceDomain_tlds({"allow_transfer":1})) }}
    • From 2382aca08bb7e0b8ef57d757dcb817c2d22194a1 Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Wed, 29 Jul 2015 16:47:32 +0300 Subject: [PATCH 04/15] Making sure that only single IP would be returned. HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP might return multiple IPs separated by comma --- src/bb-modules/Servicelicense/Server.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bb-modules/Servicelicense/Server.php b/src/bb-modules/Servicelicense/Server.php index 28f2f2bd1..dcc2fc1f5 100644 --- a/src/bb-modules/Servicelicense/Server.php +++ b/src/bb-modules/Servicelicense/Server.php @@ -77,15 +77,20 @@ class Server implements \Box\InjectionAwareInterface private function getIp($checkProxy = true) { - $ip = NULL; + $ip = null; if ($checkProxy && $this->getServer('HTTP_CLIENT_IP') != null) { $ip = $this->getServer('HTTP_CLIENT_IP'); - } else if ($checkProxy && $this->getServer('HTTP_X_FORWARDED_FOR') != null) { - $ip = $this->getServer('HTTP_X_FORWARDED_FOR'); } else { - $ip = $this->getServer('REMOTE_ADDR'); + if ($checkProxy && $this->getServer('HTTP_X_FORWARDED_FOR') != null) { + $ip = $this->getServer('HTTP_X_FORWARDED_FOR'); + } else { + $ip = $this->getServer('REMOTE_ADDR'); + } } + $ips_arr = explode(',', $ip); + $ip = trim($ips_arr[0]); + return $ip; } From f39d4fb4f2d98896ba2eb37a00a1b0add05f42ce Mon Sep 17 00:00:00 2001 From: Vaidas Lungis Date: Wed, 5 Aug 2015 10:27:27 +0300 Subject: [PATCH 05/15] fix email resend() it was using old System::getEmailSettings() which was trying to find email config in settings table --- src/bb-modules/Email/Service.php | 3 +-- src/bb-modules/System/Service.php | 24 ------------------------ tests/bb-modules/Email/ServiceTest.php | 11 ++++------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/bb-modules/Email/Service.php b/src/bb-modules/Email/Service.php index cc5d33955..082447f7a 100644 --- a/src/bb-modules/Email/Service.php +++ b/src/bb-modules/Email/Service.php @@ -304,8 +304,7 @@ class Service implements \Box\InjectionAwareInterface $this->_logEmailToDb($email); //Logging to DB - $systemService = $this->di['mod_service']('system'); - $settings = $systemService->getEmailSettings(); + $settings = $this->di['mod_config']('email'); $transport = $this->di['array_get']($settings, 'mailer', 'sendmail'); if (APPLICATION_ENV == 'testing') { diff --git a/src/bb-modules/System/Service.php b/src/bb-modules/System/Service.php index 186aea5cf..d85a19e38 100644 --- a/src/bb-modules/System/Service.php +++ b/src/bb-modules/System/Service.php @@ -1538,30 +1538,6 @@ class Service return $this->di['db']->getAssoc($query); } - public function getEmailSettings() - { - $params = array( - 'mailer', - 'smtp_authentication', - 'smtp_security', - 'smtp_port', - 'smtp_username', - 'smtp_password', - 'smtp_host', - ); - $res = $this->_getMultipleParams($params); - - return array( - 'mailer' => $this->di['array_get']($res, 'mailer', 'sendmail'), - 'smtp_authentication' => (isset($res['smtp_authentication']) && $res['smtp_authentication']) ? 'login' : NULL, - 'smtp_host' => $this->di['array_get']($res, 'smtp_host'), - 'smtp_security' => (isset($res['smtp_security']) && $res['smtp_security'] != 'no') ? $res['smtp_security'] : NULL, - 'smtp_port' => $this->di['array_get']($res, 'smtp_port'), - 'smtp_username' => $this->di['array_get']($res, 'smtp_username'), - 'smtp_password' => $this->di['array_get']($res, 'smtp_password'), - ); - } - public function getVersion() { return \Box_Version::VERSION; diff --git a/tests/bb-modules/Email/ServiceTest.php b/tests/bb-modules/Email/ServiceTest.php index 7b5851123..f2ef01a87 100644 --- a/tests/bb-modules/Email/ServiceTest.php +++ b/tests/bb-modules/Email/ServiceTest.php @@ -551,15 +551,12 @@ class ServiceTest extends \BBTestCase 'smtp_password' => NULL, ); - $systemService = $this->getMockBuilder('\Box\Mod\System\Service')->setMethods(array('getEmailSettings'))->getMock(); - $systemService->expects($this->atLeastOnce()) - ->method('getEmailSettings') - ->will($this->returnValue($emailSettings)); - $di['db'] = $db; $di['mail'] = $mailMock; - $di['mod_service'] = $di->protect(function () use ($systemService) { - return $systemService; + + $config = array(); + $di['mod_config'] = $di->protect(function ($modName) use($config){ + return $config; }); $di['logger'] = $this->getMockBuilder('Box_Log')->getMock(); $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use ($di) { From ed605edb016ad2c46e8d5d66aad57a85f4eaf27b Mon Sep 17 00:00:00 2001 From: Vaidas Lungis Date: Wed, 5 Aug 2015 10:31:46 +0300 Subject: [PATCH 06/15] fix Undefined index: icon_url --- src/bb-modules/Extension/Service.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bb-modules/Extension/Service.php b/src/bb-modules/Extension/Service.php index 0de63d922..681f68a8e 100644 --- a/src/bb-modules/Extension/Service.php +++ b/src/bb-modules/Extension/Service.php @@ -192,8 +192,9 @@ class Service implements InjectionAwareInterface foreach ($result as $key => $value){ $iconPath = 'images/icons/middlenav/cog.png'; - if ($value['icon_url']){ - $iconPath = $this->di['config']['url'].$value['icon_url']; + $icon_url = $this->di['array_get']($value, 'icon_url'); + if ($icon_url){ + $iconPath = $this->di['config']['url'].$icon_url; } $result[$key]['icon_url'] = $iconPath; } From 489a5603f60e76b256a1e27ade3974ce879edc4b Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Wed, 12 Aug 2015 11:29:45 +0300 Subject: [PATCH 07/15] Redirect client to BB_URL after sign up --- src/bb-modules/Page/html_client/mod_page_signup.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bb-modules/Page/html_client/mod_page_signup.phtml b/src/bb-modules/Page/html_client/mod_page_signup.phtml index bde8eef08..37f3f2b3e 100644 --- a/src/bb-modules/Page/html_client/mod_page_signup.phtml +++ b/src/bb-modules/Page/html_client/mod_page_signup.phtml @@ -232,7 +232,7 @@ bb.msg(data.error.message, 'error'); } } else { - bb.redirect('/'); + bb.redirect("{{ constant('BB_URL') }}"); } } }); From 1f3db6239183f9913b95c79a29afd1e2bbd582c1 Mon Sep 17 00:00:00 2001 From: Kaiden Prince Date: Fri, 21 Aug 2015 15:42:30 -0400 Subject: [PATCH 08/15] fix ssl fix issue boxbilling/boxbilling#371 --- src/bb-library/Server/Manager/Virtualmin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bb-library/Server/Manager/Virtualmin.php b/src/bb-library/Server/Manager/Virtualmin.php index bf0f76c2f..8269b8e81 100644 --- a/src/bb-library/Server/Manager/Virtualmin.php +++ b/src/bb-library/Server/Manager/Virtualmin.php @@ -40,9 +40,9 @@ class Server_Manager_Virtualmin extends Server_Manager public function getLoginUrl() { if ($this->_config['secure']) { - return 'http://'.$this->_config['host'] . ':' . $this->_config['port'] . '/'; + return 'https://'.$this->_config['host'] . ':' . $this->_config['port'] . '/'; } else { - return 'https://'.$this->_config['host'] . ':' . $this->_config['port'] . '/'; + return 'http://'.$this->_config['host'] . ':' . $this->_config['port'] . '/'; } } @@ -227,7 +227,7 @@ class Server_Manager_Virtualmin extends Server_Manager */ private function _getUrl() { - $url = (isset($this->_config['ssl']) && $this->_config['ssl']) ? 'https://' : 'http://'; + $url = (isset($this->_config['ssl']) && $this->_config['ssl']) ? 'http://' : 'https://'; $url .= $this->_config['host'] . ' : ' . $this->_config['port'] . '/virtual-server/remote.cgi'; return $url; @@ -710,4 +710,4 @@ class Server_Manager_Virtualmin extends Server_Manager return false; } -} \ No newline at end of file +} From 0a451e66f4cba69fe38eaf92275672ad5f90ccf1 Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Mon, 24 Aug 2015 11:03:19 +0300 Subject: [PATCH 09/15] Default countries list updated --- src/bb-modules/System/Service.php | 2 +- .../html_admin/mod_system_settings.phtml | 39 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/bb-modules/System/Service.php b/src/bb-modules/System/Service.php index d85a19e38..23bffa446 100644 --- a/src/bb-modules/System/Service.php +++ b/src/bb-modules/System/Service.php @@ -735,7 +735,7 @@ class Service "GF" => "French Guiana", "PF" => "French Polynesia", "GA" => "Gabon", - "GB" => "Great Britain", + "GB" => "United Kingdom", "GM" => "Gambia", "GE" => "Georgia", "DE" => "Germany", diff --git a/src/bb-modules/System/html_admin/mod_system_settings.phtml b/src/bb-modules/System/html_admin/mod_system_settings.phtml index c263b66dc..79bafb7cb 100644 --- a/src/bb-modules/System/html_admin/mod_system_settings.phtml +++ b/src/bb-modules/System/html_admin/mod_system_settings.phtml @@ -157,7 +157,7 @@ AD=Andorra AO=Angola AI=Anguilla AQ=Antarctica -AG=Antigua And Barbuda +AG=Antigua and Barbuda AR=Argentina AM=Armenia AW=Aruba @@ -175,10 +175,10 @@ BJ=Benin BM=Bermuda BT=Bhutan BO=Bolivia -BA=Bosnia And Herzegowina +BA=Bosnia and Herzegovina BW=Botswana BR=Brazil -BN=Brunei Darussalam +BN=Brunei BG=Bulgaria BF=Burkina Faso BI=Burundi @@ -195,7 +195,8 @@ CX=Christmas Island CC=Cocos (Keeling) Islands CO=Colombia KM=Comoros -CG=Congo +CG=Congo - Brazzaville +CD=Congo - Kinshasa CK=Cook Islands CR=Costa Rica CI=Cote D'Ivoire @@ -219,8 +220,10 @@ FO=Faroe Islands FJ=Fiji FI=Finland FR=France +GF=French Guiana +PF=French Polynesia GA=Gabon -GB=Great Britain +GB=United Kingdom GM=Gambia GE=Georgia DE=Germany @@ -254,18 +257,19 @@ JO=Jordan KZ=Kazakhstan KE=Kenya KI=Kiribati -KR=Korea, Republic Of KW=Kuwait KG=Kyrgyzstan +LA=Laos LV=Latvia LB=Lebanon LS=Lesotho LR=Liberia -LY=Libyan Arab Jamahiriya +LY=Libya LI=Liechtenstein LT=Lithuania LU=Luxembourg MO=Macau +MK=Macedonia MG=Madagascar MW=Malawi MY=Malaysia @@ -278,13 +282,14 @@ MR=Mauritania MU=Mauritius YT=Mayotte MX=Mexico -MD=Moldova, Republic Of +MD=Moldova MC=Monaco MN=Mongolia +ME=Montenegro MS=Montserrat MA=Morocco MZ=Mozambique -MM=Myanmar +MM=Myanmar (Burma) NA=Namibia NR=Nauru NP=Nepal @@ -307,14 +312,14 @@ PG=Papua New Guinea PY=Paraguay PE=Peru PH=Philippines -PN=Pitcairn +PN=Pitcairn Islands PL=Poland PT=Portugal PR=Puerto Rico QA=Qatar RE=Reunion RO=Romania -RU=Russian Federation +RU=Russia RW=Rwanda KN=Saint Kitts And Nevis LC=Saint Lucia @@ -323,6 +328,7 @@ SM=San Marino ST=Sao Tome And Principe SA=Saudi Arabia SN=Senegal +RS=Serbia SC=Seychelles SL=Sierra Leone SG=Singapore @@ -331,6 +337,7 @@ SI=Slovenia SB=Solomon Islands SO=Somalia ZA=South Africa +KR=South Korea ES=Spain LK=Sri Lanka SH=St. Helena @@ -340,7 +347,7 @@ SR=Suriname SZ=Swaziland SE=Sweden CH=Switzerland -SY=Syrian Arab Republic +SY=Syria TW=Taiwan TJ=Tajikistan TZ=Tanzania @@ -348,11 +355,11 @@ TH=Thailand TG=Togo TK=Tokelau TO=Tonga -TT=Trinidad And Tobago +TT=Trinidad and Tobago TN=Tunisia TR=Turkey TM=Turkmenistan -TC=Turks And Caicos Islands +TC=Turks and Caicos Islands TV=Tuvalu UG=Uganda UA=Ukraine @@ -360,9 +367,9 @@ AE=United Arab Emirates UY=Uruguay UZ=Uzbekistan VU=Vanuatu +VA=Vatican City VE=Venezuela -VN=Viet Nam -VG=Virgin Islands (British) +VN=Vietnam VI=Virgin Islands (U.S.) EH=Western Sahara YE=Yemen From 1ae9b8184521cbce08ec901507bb8df2e92e028e Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Mon, 24 Aug 2015 11:39:57 +0300 Subject: [PATCH 10/15] Load font using https:// Fix #369 --- src/install/layout.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/install/layout.phtml b/src/install/layout.phtml index 12f92a345..05649f8fb 100644 --- a/src/install/layout.phtml +++ b/src/install/layout.phtml @@ -5,7 +5,7 @@ BoxBilling setup - + From 5dca03bf3cf6929aeb1eef1e115d6d93ea690a39 Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Mon, 24 Aug 2015 11:52:53 +0300 Subject: [PATCH 11/15] Fixing Virtualmin secure link #371 --- src/bb-library/Server/Manager/Virtualmin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bb-library/Server/Manager/Virtualmin.php b/src/bb-library/Server/Manager/Virtualmin.php index 8269b8e81..ee8a6414e 100644 --- a/src/bb-library/Server/Manager/Virtualmin.php +++ b/src/bb-library/Server/Manager/Virtualmin.php @@ -227,7 +227,7 @@ class Server_Manager_Virtualmin extends Server_Manager */ private function _getUrl() { - $url = (isset($this->_config['ssl']) && $this->_config['ssl']) ? 'http://' : 'https://'; + $url = (isset($this->_config['ssl']) && $this->_config['ssl']) ? 'https://' : 'http://'; $url .= $this->_config['host'] . ' : ' . $this->_config['port'] . '/virtual-server/remote.cgi'; return $url; From 8ebff47158ae3944efef13f32cb721a7378d7d2e Mon Sep 17 00:00:00 2001 From: Vaidas Lungis Date: Fri, 11 Sep 2015 10:13:01 +0300 Subject: [PATCH 12/15] fix typos in pdf generate script [ci skip] --- src/bb-modules/Invoice/Service.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bb-modules/Invoice/Service.php b/src/bb-modules/Invoice/Service.php index 2bd988ca4..c0692454f 100644 --- a/src/bb-modules/Invoice/Service.php +++ b/src/bb-modules/Invoice/Service.php @@ -1227,7 +1227,7 @@ class Service implements InjectionAwareInterface $invoice_info = __("Invoice number: ") . $invoice['nr'] . "\n" . __("Invoice date: ") . $invoiceDate . "\n" . __("Due date: ") . strftime($localeDateFormat, strtotime($invoice['due_at'])) . "\n" . - __("Invoice status: ") . $invoice['status']; + __("Invoice status: ") . ucfirst($invoice['status']); $pdf->SetFont('DejaVu', 'B', $font_size); $pdf->text($left + 15, 75, __("Invoice")); $pdf->SetFont('DejaVu', '', $font_size); @@ -1248,7 +1248,7 @@ class Service implements InjectionAwareInterface $pdf->SetXY(75, 70); $pdf->MultiCell(60, 10, "\n" . $company_info, 0, "L", 0); - $buyer_info = __("Name: ") . $invoice['buyer']['first_name'] . $invoice['buyer']['last_name'] . "\n" . + $buyer_info = __("Name: ") . $invoice['buyer']['first_name'].' ' . $invoice['buyer']['last_name'] . "\n" . __("Company: ") . $invoice['buyer']['company'] . "\n" . __("Address: ") . $invoice['buyer']['address'] . "\n" . __("Company VAT: ") . $invoice['seller']['company_vat'] . "\n" . From 03f717082809f957711b2cf6fb0cffe4bf36400e Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Fri, 11 Sep 2015 10:42:48 +0300 Subject: [PATCH 13/15] Removed exit from bb-ipn --- src/bb-ipn.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bb-ipn.php b/src/bb-ipn.php index 0fa9ea9bb..d8243a8e3 100644 --- a/src/bb-ipn.php +++ b/src/bb-ipn.php @@ -52,7 +52,6 @@ try { // redirect to invoice if gateways requires if(isset($_GET['bb_redirect']) && isset($_GET['bb_invoice_hash'])) { $url = $di['url']->link('invoice/'.$_GET['bb_invoice_hash']); - var_dump($url);exit; header("Location: $url"); exit; } else { From 99382c7541a54d582beec1e4446aa589fb8193c2 Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Wed, 23 Sep 2015 17:24:04 +0300 Subject: [PATCH 14/15] Check if order ID exists for client. Closes #378 --- src/bb-modules/Support/Service.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bb-modules/Support/Service.php b/src/bb-modules/Support/Service.php index 3c0ec364e..d4bf4c6c7 100644 --- a/src/bb-modules/Support/Service.php +++ b/src/bb-modules/Support/Service.php @@ -863,6 +863,16 @@ class Service implements \Box\InjectionAwareInterface //@todo validate task params $rel_id = $this->di['array_get']($data, 'rel_id', NULL); $rel_type = $this->di['array_get']($data, 'rel_type', NULL); + + + if ($rel_type == \Model_SupportTicket::REL_TYPE_ORDER) { + $orderService = $this->di['mod_service']('order'); + $o = $orderService->findForClientById($client, $rel_id); + if (!$o instanceof \Model_ClientOrder) { + throw new \Box_Exception('Order ID does not exist'); + } + } + $rel_task = $this->di['array_get']($data, 'rel_task', NULL); $rel_new_value = $this->di['array_get']($data, 'rel_new_value', NULL); $rel_status = isset($data['rel_task']) ? \Model_SupportTicket::REL_STATUS_PENDING : \Model_SupportTicket::REL_STATUS_COMPLETE; From f6bd2896028e65abd5bbf3cfbb4c9c48c6605efd Mon Sep 17 00:00:00 2001 From: 4giedrius <4giedrius@gmail.com> Date: Wed, 23 Sep 2015 17:43:38 +0300 Subject: [PATCH 15/15] Check if `rel_id` is set --- src/bb-modules/Support/Service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bb-modules/Support/Service.php b/src/bb-modules/Support/Service.php index d4bf4c6c7..c762026e9 100644 --- a/src/bb-modules/Support/Service.php +++ b/src/bb-modules/Support/Service.php @@ -865,7 +865,7 @@ class Service implements \Box\InjectionAwareInterface $rel_type = $this->di['array_get']($data, 'rel_type', NULL); - if ($rel_type == \Model_SupportTicket::REL_TYPE_ORDER) { + if (!is_null($rel_id) && $rel_type == \Model_SupportTicket::REL_TYPE_ORDER) { $orderService = $this->di['mod_service']('order'); $o = $orderService->findForClientById($client, $rel_id); if (!$o instanceof \Model_ClientOrder) {