XoopsModules25x /
oledrion
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /* |
||
| 3 | You may not change or alter any portion of this comment or credits |
||
| 4 | of supporting developers from this source code or any supporting source code |
||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | |||
| 7 | This program is distributed in the hope that it will be useful, |
||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * oledrion |
||
| 14 | * |
||
| 15 | * @copyright {@link http://xoops.org/ XOOPS Project} |
||
| 16 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
| 17 | * @author Hervé Thouzard (http://www.herve-thouzard.com/) |
||
| 18 | */ |
||
| 19 | |||
| 20 | require __DIR__ . '/header.php'; |
||
| 21 | $GLOBALS['current_category'] = -1; |
||
| 22 | |||
| 23 | $op = isset($_GET['op']) ? $_GET['op'] : 'default'; |
||
| 24 | |||
| 25 | View Code Duplication | if (isset($_GET['id'])) { |
|
| 26 | $cmdId = (int)$_GET['id']; |
||
| 27 | } else { |
||
| 28 | Oledrion_utils::redirect(_OLEDRION_ERROR11, 'index.php', 6); |
||
| 29 | } |
||
| 30 | |||
| 31 | View Code Duplication | if (isset($_GET['pass'])) { |
|
| 32 | $pass = $_GET['pass']; |
||
| 33 | } else { |
||
| 34 | if (!Oledrion_utils::isAdmin()) { |
||
| 35 | Oledrion_utils::redirect(_OLEDRION_ERROR11, 'index.php', 6); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | $order = null; |
||
| 40 | $order = $h_oledrion_commands->get($cmdId); |
||
| 41 | if (!is_object($order)) { |
||
| 42 | Oledrion_utils::redirect(_OLEDRION_ERROR11, 'index.php', 6); |
||
| 43 | } |
||
| 44 | |||
| 45 | // Vérification du mot de passe (si pas admin) |
||
| 46 | if (!Oledrion_utils::isAdmin()) { |
||
| 47 | if ($pass != $order->getVar('cmd_password')) { |
||
| 48 | Oledrion_utils::redirect(_OLEDRION_ERROR11, 'index.php', 6); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | // Vérification de la validité de la facture (si pas admin) |
||
| 53 | /* if (!Oledrion_utils::isAdmin()) { |
||
| 54 | if ($order->getVar('cmd_state') != OLEDRION_STATE_VALIDATED) { // Commande non validée |
||
| 55 | Oledrion_utils::redirect(_OLEDRION_ERROR12, 'index.php', 6); |
||
| 56 | } |
||
| 57 | } */ |
||
| 58 | |||
| 59 | $caddy = $tmp = $products = $vats = $manufacturers = $tmp2 = $manufacturers = $productsManufacturers = array(); |
||
| 60 | |||
| 61 | // Récupération des TVA |
||
| 62 | $vats = $h_oledrion_vat->getAllVats(new Oledrion_parameters()); |
||
| 63 | |||
| 64 | // Récupération des caddy associés |
||
| 65 | $caddy = $h_oledrion_caddy->getCaddyFromCommand($cmdId); |
||
| 66 | if (count($caddy) == 0) { |
||
| 67 | Oledrion_utils::redirect(_OLEDRION_ERROR11, 'index.php', 6); |
||
| 68 | } |
||
| 69 | |||
| 70 | // Récupération de la liste des produits associés |
||
| 71 | foreach ($caddy as $item) { |
||
| 72 | $tmp[] = $item->getVar('caddy_product_id'); |
||
| 73 | } |
||
| 74 | |||
| 75 | // Recherche des produits *********************************************************************************************** |
||
| 76 | $products = $h_oledrion_products->getProductsFromIDs($tmp, true); |
||
| 77 | |||
| 78 | // Recherche des fabricants ********************************************************************************************** |
||
| 79 | $tmp2 = $h_oledrion_productsmanu->getFromProductsIds($tmp); |
||
| 80 | $tmp = array(); |
||
| 81 | View Code Duplication | foreach ($tmp2 as $item) { |
|
| 82 | $tmp[] = $item->getVar('pm_manu_id'); |
||
| 83 | $productsManufacturers[$item->getVar('pm_product_id')][] = $item; |
||
| 84 | } |
||
| 85 | $manufacturers = $h_oledrion_manufacturer->getManufacturersFromIds($tmp); |
||
| 86 | |||
| 87 | switch ($op) { |
||
| 88 | case 'print': |
||
| 89 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 90 | |||
| 91 | // Informations sur la commande *************************************************************************************** |
||
| 92 | $xoopsTpl->assign('order', $order->toArray()); |
||
| 93 | $xoopsTpl->assign('ask_vatnumber', Oledrion_utils::getModuleOption('ask_vatnumber')); |
||
| 94 | $handlers = OledrionHandler::getInstance(); |
||
| 95 | |||
| 96 | // Boucle sur le caddy ************************************************************************************************ |
||
| 97 | View Code Duplication | foreach ($caddy as $itemCaddy) { |
|
| 98 | $productForTemplate = $tblJoin = $productManufacturers = $productAttributes = array(); |
||
| 99 | $product = $products[$itemCaddy->getVar('caddy_product_id')]; |
||
| 100 | $productForTemplate = $product->toArray(); // Produit |
||
| 101 | // Est-ce qu'il y a des attributs ? |
||
| 102 | if ($handlers->h_oledrion_caddy_attributes->getAttributesCountForCaddy($itemCaddy->getVar('caddy_id')) > 0) { |
||
|
0 ignored issues
–
show
|
|||
| 103 | $productAttributes = $handlers->h_oledrion_caddy_attributes->getFormatedAttributesForCaddy($itemCaddy->getVar('caddy_id'), $product); |
||
|
0 ignored issues
–
show
The property
h_oledrion_caddy_attributes does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 104 | } |
||
| 105 | $productForTemplate['product_attributes'] = $productAttributes; |
||
| 106 | |||
| 107 | $productManufacturers = $productsManufacturers[$product->getVar('product_id')]; |
||
| 108 | foreach ($productManufacturers as $oledrion_productsmanu) { |
||
| 109 | if (isset($manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')])) { |
||
| 110 | $manufacturer = $manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')]; |
||
| 111 | $tblJoin[] = $manufacturer->getVar('manu_commercialname') . ' ' . $manufacturer->getVar('manu_name'); |
||
| 112 | } |
||
| 113 | } |
||
| 114 | if (count($tblJoin) > 0) { |
||
| 115 | $productForTemplate['product_joined_manufacturers'] = implode(', ', $tblJoin); |
||
| 116 | } |
||
| 117 | $productForTemplate['product_caddy'] = $itemCaddy->toArray(); |
||
| 118 | $xoopsTpl->append('products', $productForTemplate); |
||
| 119 | } |
||
| 120 | // Display print page |
||
| 121 | echo $xoopsTpl->fetch(OLEDRION_PATH . '/templates/oledrion_bill_print.tpl'); |
||
| 122 | break; |
||
| 123 | |||
| 124 | case 'default': |
||
| 125 | default: |
||
| 126 | /** |
||
| 127 | * Visualisation d'une facture à l'écran |
||
| 128 | */ |
||
| 129 | $GLOBALS['xoopsOption']['template_main'] = 'oledrion_bill.tpl'; |
||
| 130 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 131 | |||
| 132 | // Informations sur la commande *************************************************************************************** |
||
| 133 | $xoopsTpl->assign('order', $order->toArray()); |
||
| 134 | $xoopsTpl->assign('ask_vatnumber', Oledrion_utils::getModuleOption('ask_vatnumber')); |
||
| 135 | $xoopsTpl->assign('printurl', OLEDRION_URL . basename(__FILE__) . '?op=print&id=' . $order->getVar('cmd_id') . '&pass=' . $order->getVar('cmd_password')); |
||
| 136 | |||
| 137 | $handlers = OledrionHandler::getInstance(); |
||
| 138 | |||
| 139 | // Boucle sur le caddy ************************************************************************************************ |
||
| 140 | View Code Duplication | foreach ($caddy as $itemCaddy) { |
|
| 141 | $productForTemplate = $tblJoin = $productManufacturers = $productAttributes = array(); |
||
| 142 | $product = $products[$itemCaddy->getVar('caddy_product_id')]; |
||
| 143 | $productForTemplate = $product->toArray(); // Produit |
||
| 144 | // Est-ce qu'il y a des attributs ? |
||
| 145 | if ($handlers->h_oledrion_caddy_attributes->getAttributesCountForCaddy($itemCaddy->getVar('caddy_id')) > 0) { |
||
|
0 ignored issues
–
show
The property
h_oledrion_caddy_attributes does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 146 | $productAttributes = $handlers->h_oledrion_caddy_attributes->getFormatedAttributesForCaddy($itemCaddy->getVar('caddy_id'), $product); |
||
|
0 ignored issues
–
show
The property
h_oledrion_caddy_attributes does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 147 | } |
||
| 148 | $productForTemplate['product_attributes'] = $productAttributes; |
||
| 149 | |||
| 150 | $productManufacturers = $productsManufacturers[$product->getVar('product_id')]; |
||
| 151 | foreach ($productManufacturers as $oledrion_productsmanu) { |
||
| 152 | if (isset($manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')])) { |
||
| 153 | $manufacturer = $manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')]; |
||
| 154 | $tblJoin[] = $manufacturer->getVar('manu_commercialname') . ' ' . $manufacturer->getVar('manu_name'); |
||
| 155 | } |
||
| 156 | } |
||
| 157 | if (count($tblJoin) > 0) { |
||
| 158 | $productForTemplate['product_joined_manufacturers'] = implode(', ', $tblJoin); |
||
| 159 | } |
||
| 160 | $productForTemplate['product_caddy'] = $itemCaddy->toArray(); |
||
| 161 | $xoopsTpl->append('products', $productForTemplate); |
||
| 162 | } |
||
| 163 | |||
| 164 | Oledrion_utils::setCSS(); |
||
| 165 | Oledrion_utils::setLocalCSS($xoopsConfig['language']); |
||
| 166 | $title = _OLEDRION_BILL . ' - ' . Oledrion_utils::getModuleName(); |
||
| 167 | Oledrion_utils::setMetas($title, $title); |
||
| 168 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 169 | break; |
||
| 170 | } |
||
| 171 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.