1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Oledrion; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* oledrion |
17
|
|
|
* |
18
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
19
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
20
|
|
|
* @author Hervé Thouzard (http://www.herve-thouzard.com/) |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
use XoopsModules\Oledrion; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Sales order management |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class Commands |
31
|
|
|
*/ |
32
|
|
|
class Commands extends OledrionObject |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* constructor |
36
|
|
|
* |
37
|
|
|
* normally, this is called from child classes only |
38
|
|
|
*/ |
39
|
|
|
public function __construct() |
40
|
|
|
{ |
41
|
|
|
$this->initVar('cmd_id', XOBJ_DTYPE_INT, null, false); |
42
|
|
|
$this->initVar('cmd_uid', XOBJ_DTYPE_INT, null, false); |
43
|
|
|
$this->initVar('cmd_date', XOBJ_DTYPE_TXTBOX, null, false); |
44
|
|
|
$this->initVar('cmd_create', XOBJ_DTYPE_INT, null, false); |
45
|
|
|
$this->initVar('cmd_state', XOBJ_DTYPE_INT, null, false); |
46
|
|
|
$this->initVar('cmd_ip', XOBJ_DTYPE_TXTBOX, null, false); |
47
|
|
|
$this->initVar('cmd_lastname', XOBJ_DTYPE_TXTBOX, null, false); |
48
|
|
|
$this->initVar('cmd_firstname', XOBJ_DTYPE_TXTBOX, null, false); |
49
|
|
|
$this->initVar('cmd_adress', XOBJ_DTYPE_OTHER, null, false); |
50
|
|
|
$this->initVar('cmd_zip', XOBJ_DTYPE_TXTBOX, null, false); |
51
|
|
|
$this->initVar('cmd_town', XOBJ_DTYPE_TXTBOX, null, false); |
52
|
|
|
$this->initVar('cmd_country', XOBJ_DTYPE_TXTBOX, null, false); |
53
|
|
|
$this->initVar('cmd_telephone', XOBJ_DTYPE_TXTBOX, null, false); |
54
|
|
|
$this->initVar('cmd_mobile', XOBJ_DTYPE_TXTBOX, null, false); |
55
|
|
|
$this->initVar('cmd_email', XOBJ_DTYPE_TXTBOX, null, false); |
56
|
|
|
$this->initVar('cmd_articles_count', XOBJ_DTYPE_INT, null, false); |
57
|
|
|
$this->initVar('cmd_total', XOBJ_DTYPE_TXTBOX, null, false); |
58
|
|
|
$this->initVar('cmd_shipping', XOBJ_DTYPE_TXTBOX, null, false); |
59
|
|
|
$this->initVar('cmd_packing_price', XOBJ_DTYPE_TXTBOX, null, false); |
60
|
|
|
$this->initVar('cmd_bill', XOBJ_DTYPE_INT, null, false); |
61
|
|
|
$this->initVar('cmd_password', XOBJ_DTYPE_TXTBOX, null, false); |
62
|
|
|
$this->initVar('cmd_text', XOBJ_DTYPE_OTHER, null, false); |
63
|
|
|
$this->initVar('cmd_cancel', XOBJ_DTYPE_TXTBOX, null, false); |
64
|
|
|
$this->initVar('cmd_comment', XOBJ_DTYPE_OTHER, null, false); |
65
|
|
|
$this->initVar('cmd_vat_number', XOBJ_DTYPE_TXTAREA, null, false); |
66
|
|
|
$this->initVar('cmd_packing', XOBJ_DTYPE_TXTBOX, null, false); |
67
|
|
|
$this->initVar('cmd_packing_id', XOBJ_DTYPE_INT, null, false); |
68
|
|
|
$this->initVar('cmd_location', XOBJ_DTYPE_TXTBOX, null, false); |
69
|
|
|
$this->initVar('cmd_location_id', XOBJ_DTYPE_INT, null, false); |
70
|
|
|
$this->initVar('cmd_delivery', XOBJ_DTYPE_TXTBOX, null, false); |
71
|
|
|
$this->initVar('cmd_delivery_id', XOBJ_DTYPE_INT, null, false); |
72
|
|
|
$this->initVar('cmd_payment', XOBJ_DTYPE_TXTBOX, null, false); |
73
|
|
|
$this->initVar('cmd_payment_id', XOBJ_DTYPE_INT, null, false); |
74
|
|
|
$this->initVar('cmd_status', XOBJ_DTYPE_INT, null, false); |
75
|
|
|
$this->initVar('cmd_track', XOBJ_DTYPE_TXTBOX, null, false); |
76
|
|
|
$this->initVar('cmd_gift', XOBJ_DTYPE_TXTBOX, null, false); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Returns the elements of the products formatted for display |
81
|
|
|
* |
82
|
|
|
* @param string $format The format to use |
83
|
|
|
* @return array Formatted information |
84
|
|
|
*/ |
85
|
|
|
public function toArray($format = 's') |
86
|
|
|
{ |
87
|
|
|
$ret = []; |
|
|
|
|
88
|
|
|
$ret = parent::toArray($format); |
89
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
90
|
|
|
$countries = []; |
|
|
|
|
91
|
|
|
$countries = \XoopsLists::getCountryList(); |
92
|
|
|
$oledrionCurrency = Oledrion\Currency::getInstance(); |
93
|
|
|
$ret['cmd_total_fordisplay'] = $oledrionCurrency->amountForDisplay($this->getVar('cmd_total')); // Montant TTC de la commande |
94
|
|
|
$ret['cmd_shipping_fordisplay'] = $oledrionCurrency->amountForDisplay($this->getVar('cmd_shipping')); // Montant TTC des frais de port |
95
|
|
|
$ret['cmd_packing_price_fordisplay'] = $oledrionCurrency->amountForDisplay($this->getVar('cmd_packing_price')); |
96
|
|
|
$ret['cmd_text_fordisplay'] = nl2br($this->getVar('cmd_text')); // Liste des réductions accordées |
97
|
|
|
if (isset($countries[$this->getVar('cmd_country')])) { |
98
|
|
|
// Libellé du pays de l'acheteur |
99
|
|
|
$ret['cmd_country_label'] = $countries[$this->getVar('cmd_country')]; |
100
|
|
|
} |
101
|
|
|
if ($this->getVar('cmd_uid') > 0) { |
102
|
|
|
$ret['cmd_uname'] = \XoopsUser::getUnameFromId($this->getVar('cmd_uid')); |
103
|
|
|
} |
104
|
|
|
$ret['cmd_create_date'] = formatTimestamp($this->getVar('cmd_create'), _MEDIUMDATESTRING); |
105
|
|
|
|
106
|
|
|
return $ret; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|