Skip to content

Commit f1324d8

Browse files
committed
5.2.3
1 parent 93046c4 commit f1324d8

File tree

43 files changed

+171
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+171
-67
lines changed

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Phoca Cart is e-commerce extension - powerful shopping cart for Joomla! CMS. Pho
132132

133133
## Version (Joomla! 5.x)
134134

135-
5.2.2
135+
5.2.3
136136

137137

138138

admin/controllers/phocacartstatus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function editMailtemplate()
5353
return;
5454
}
5555

56-
$language = $this->app->input->getCmd('language');
56+
$language = $this->app->getInput()->getCmd('language');
5757
if (!$language) {
5858
$language = ComponentHelper::getParams('com_languages')->get('site');
5959
}

admin/install/sql/mysql/install.utf8.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_specifications` (
379379
`title` varchar(255) NOT NULL DEFAULT '',
380380
`alias` varchar(255) NOT NULL DEFAULT '',
381381
`value` text,
382-
`alias_value` text,
382+
`alias_value` varchar(255) NOT NULL DEFAULT '',
383383

384384
`image` varchar(255) NOT NULL DEFAULT '',
385385
`image_medium` varchar(255) NOT NULL DEFAULT '',

admin/libraries/phocacart/captcha/recaptcha.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ public static function render() {
2323
if ($lang != '') {
2424
$lang = '?hl='.$lang;
2525
}
26+
$app = Factory::getApplication();
27+
$wa = $app->getDocument()->getWebAssetManager();
28+
$wa->registerAndUseScript('com_phocacart.recaptcha.api.js', 'https://www.google.com/recaptcha/api.js'.$lang, ['version' => 'auto']);
29+
//$document->addScript('https://www.google.com/recaptcha/api.js'.$lang);
2630

27-
$document->addScript('https://www.google.com/recaptcha/api.js'.$lang);
2831
return '<div class="g-recaptcha" data-sitekey="'.$siteKey.'"></div>';
2932
}
3033
public static function isValid() {

admin/libraries/phocacart/file/uploadmultiple.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static public function renderMultipleUploadLibraries() {
3535
$paramsC = PhocacartUtils::getComponentParameters();
3636
$chunkMethod = $paramsC->get( 'multiple_upload_chunk', 0 );
3737
$uploadMethod = $paramsC->get( 'multiple_upload_method', 4 );
38+
$wa = $app->getDocument()->getWebAssetManager();
3839

3940
//JHtml::_('behavior.framework', true);// Load it here to be sure, it is loaded before jquery
4041
HTMLHelper::_('jquery.framework', false);// Load it here because of own nonConflict method (nonconflict is set below)
@@ -48,7 +49,8 @@ static public function renderMultipleUploadLibraries() {
4849
//$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/plupload.browserplus.js');
4950
}*/
5051

51-
$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/plupload.js');
52+
//$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/plupload.js');
53+
$wa->registerAndUseScript('com_phocacart.plupload.js', 'media/com_phocacart/js/plupload/plupload.js', ['version' => 'auto']);
5254
/*if ($uploadMethod == 2) {
5355
$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/plupload.gears.js');
5456
}
@@ -65,10 +67,13 @@ static public function renderMultipleUploadLibraries() {
6567
$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/plupload.html4.js');
6668
}*/
6769
if ($uploadMethod == 4) {
68-
$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/plupload.html5.js');
70+
//$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/plupload.html5.js');
71+
$wa->registerAndUseScript('com_phocacart.plupload.html5.js', 'media/com_phocacart/js/plupload/plupload.html5.js', ['version' => 'auto']);
6972
}
70-
$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js');
71-
HTMLHelper::stylesheet( 'media/com_phocacart/js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css' );
73+
$wa->registerAndUseStyle('com_phocacart.jquery.plupload.queue', 'media/com_phocacart/js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', array('version' => 'auto'));
74+
$wa->registerAndUseScript('com_phocacart.jquery.plupload.queue.js', 'media/com_phocacart/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js', ['version' => 'auto']);
75+
//$document->addScript(Uri::root(true).'/media/com_phocacart/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js');
76+
//HTMLHelper::stylesheet( 'media/com_phocacart/js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css' );
7277
}
7378

7479
static public function getMultipleUploadSizeFormat($size) {
@@ -241,7 +246,10 @@ public function renderMultipleUploadJS($frontEnd = 0, $chunkMethod = 0) {
241246

242247
$js.='});'."\n";// End $(function()
243248

244-
$document->addScriptDeclaration($js);
249+
//$document->addScriptDeclaration($js);
250+
$app = Factory::getApplication();
251+
$wa = $app->getDocument()->getWebAssetManager();
252+
$wa->addInlineScript($js);
245253
}
246254

247255
public function getMultipleUploadHTML($width = '', $height = '330', $mootools = 1) {

admin/libraries/phocacart/order/status.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ private static function sendOrderEmail(object $order, PhocacartOrderView $orderV
242242
$recipient = ''; // Customer/Buyer
243243
$recipientOthers = ''; // others
244244
$bcc = '';
245-
$notificationResult = -1;
245+
//$notificationResult = -1;
246+
$notificationResult = 0;
246247

247248
if ($notifyUser) {
248249
if (self::canSendEmail($orderToken, $order)) {
@@ -262,7 +263,8 @@ private static function sendOrderEmail(object $order, PhocacartOrderView $orderV
262263
}
263264

264265
if (!JoomlaMailHelper::isEmailAddress($recipient) && !JoomlaMailHelper::isEmailAddress($recipientOthers)) {
265-
return 0;
266+
PhocacartLog::add(2, 'Sending email - ERROR', $order->id, Text::_('COM_PHOCACART_ERROR'). ' (Incorrect recipient email)');
267+
return -1;
266268
}
267269

268270
// ------------------------
@@ -357,10 +359,12 @@ private static function sendOrderEmail(object $order, PhocacartOrderView $orderV
357359

358360
$notificationResult = 1;
359361
} else {
360-
$notificationResult = 0;
362+
PhocacartLog::add(2, 'Sending email - ERROR', $order->id, Text::_('COM_PHOCACART_ERROR'). ' (Error when sending email using mailer)');
363+
$notificationResult = -1;
361364
}
362365
} catch (\Exception $exception) {
363-
$notificationResult = 0;
366+
$notificationResult = -1;
367+
PhocacartLog::add(2, 'Sending email - ERROR', $order->id, Text::_('COM_PHOCACART_ERROR'). ' ('.Text::_($exception->errorMessage()).')');
364368
Factory::getApplication()->enqueueMessage(Text::_($exception->errorMessage()), 'warning');
365369
}
366370
}
@@ -649,6 +653,7 @@ public static function changeStatus($orderId, $statusId, $orderToken = '',
649653
$stockMovements = '99', $changeUserGroup = '99', $changePointsNeeded = '99', $changePointsReceived = '99', $emailSendFormat = '99'
650654
)
651655
{
656+
652657
// ORDER INFO
653658
$orderView = new PhocacartOrderView();
654659
$order = $orderView->getItemCommon($orderId);
@@ -674,7 +679,7 @@ public static function changeStatus($orderId, $statusId, $orderToken = '',
674679
throw new PhocaCartException('Invalid status ID');
675680
}
676681

677-
if ($notifyUser == 99) {
682+
if ($notifyUser === 99) {
678683
if ($status['email_customer'] == 2) {
679684
$notifyUser = !PhocacartPos::isPos();
680685
} else {
@@ -684,17 +689,17 @@ public static function changeStatus($orderId, $statusId, $orderToken = '',
684689
$notifyUser = !!$notifyUser;
685690
}
686691

687-
if ($notifyOthers == 99) {
692+
if ($notifyOthers === 99) {
688693
$notifyOthers = !!$status['email_others'];
689694
} else {
690695
$notifyOthers = !!$notifyOthers;
691696
}
692697

693-
if ($emailSend == 99) {
698+
if ($emailSend === 99) {
694699
$emailSend = $status['email_send'];
695700
}
696701

697-
if ($emailSendFormat == 99) {
702+
if ($emailSendFormat === 99) {
698703
$emailSendFormat = $status['email_send_format'];
699704
}
700705

@@ -738,7 +743,6 @@ public static function changeStatus($orderId, $statusId, $orderToken = '',
738743
self::updateDownload($order->id, $status['download']);
739744
$notificationResult = self::sendOrderEmail($order, $orderView, $status, $addresses, $orderToken, $notifyUser, $notifyOthers, (int)$emailSend, !!$emailSendFormat);
740745
self::sendGiftEmail($order, $orderView, $status, $addresses, $orderToken);
741-
742746
return $notificationResult;
743747
}
744748

admin/libraries/phocacart/render/adminjs.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ public static function renderOverlayOnSubmit($id) {
133133
$s[] = ' })';
134134
$s[] = '})';
135135

136-
$document->addScriptDeclaration(implode("\n", $s));
136+
//$document->addScriptDeclaration(implode("\n", $s));
137+
$app = Factory::getApplication();
138+
$wa = $app->getDocument()->getWebAssetManager();
139+
$wa->addInlineScript(implode("\n", $s));
137140
}
138141

139142
public static function renderOverlay(){
@@ -209,7 +212,10 @@ public static function renderImportExportItems($url, $messageBox, $formId, $coun
209212
$s[] = ' jQuery(\'#'.$formId.'\').on(\'submit\',{a1: '.(int)$count.'}, phImportAllItems);';
210213
$s[] = '})';
211214

212-
$document->addScriptDeclaration(implode("\n", $s));
215+
//$document->addScriptDeclaration(implode("\n", $s));
216+
$app = Factory::getApplication();
217+
$wa = $app->getDocument()->getWebAssetManager();
218+
$wa->addInlineScript(implode("\n", $s));
213219

214220
}
215221

admin/libraries/phocacart/route/route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static function getCategoriesRoute($lang = [])
3838
}
3939

4040
$itemId = 0;
41-
if ((int)$activeId > 0 &&$option == 'com_phocacart' && $view == 'category') {
41+
if ((int)$activeId > 0 && $option == 'com_phocacart' && $view == 'category') {
4242
// 2) if there are two menu links, try to select the one active
4343
$itemId = $activeId;
4444
}

admin/libraries/phocacart/specification/specification.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public static function storeSpecificationsById($productId, $specsArray, $new = 0
102102
// When no value, then no alias
103103
if ($specification['alias_value']) {
104104
$specification['alias_value'] = PhocacartUtils::getAliasName($specification['alias_value']);
105+
$specification['alias_value'] = trim($specification['alias_value']);
106+
$specification['alias_value'] = substr($specification['alias_value'], 0, 255);
105107
}
106108

107109
$specification = PhocacartUtils::arrayDefValues($specification, [

admin/libraries/phocacart/time/time.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ public static function checkOpeningTimes($renderMessage = 1) {
151151
foreach($days as $k => $v) {
152152

153153
// 1. Test CLOSING DAYS (3)
154-
if ($v['type'] == 3 && $v['date'] != '' && $v['date'] != '0000-00-00 00:00:00' && strtotime($currentDate) == strtotime($v['date'])) {
154+
$dbDate = Factory::getDate($v['date'], 'UTC');
155+
$dbDate->setTimezone(new DateTimeZone($config->get('offset')));
156+
$dbDateFormat = $dbDate->format('Y-m-d', true, false);
157+
if ($v['type'] == 3 && $v['date'] != '' && $v['date'] != '0000-00-00 00:00:00' && strtotime($currentDate) == strtotime($dbDateFormat)) {
155158
if ($renderMessage) {$app->enqueueMessage($msg, $msgType);}
156159
return $orderAllowed;
157160
} else if ($v['type'] == 3 && $v['day'] > -1 && (int)$currentDay == (int)$v['day']) {

0 commit comments

Comments
 (0)