Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
1cb1473948
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Protection to avoid direct call of template
|
// Protection to avoid direct call of template
|
||||||
if (empty($conf) || ! is_object($conf)) {
|
if (empty($conf) || !is_object($conf)) {
|
||||||
print "Error, template page can't be called as URL";
|
print "Error, template page can't be called as URL";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -36,14 +36,14 @@ $langs->load("orders");
|
|||||||
|
|
||||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||||
|
|
||||||
$total=0;
|
$total = 0;
|
||||||
$ilink=0;
|
$ilink = 0;
|
||||||
foreach($linkedObjectBlock as $key => $objectlink)
|
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||||
{
|
{
|
||||||
$ilink++;
|
$ilink++;
|
||||||
|
|
||||||
$trclass='oddeven';
|
$trclass = 'oddeven';
|
||||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||||
echo '<tr class="'.$trclass.'" >';
|
echo '<tr class="'.$trclass.'" >';
|
||||||
echo '<td class="linkedcol-element" >'.$langs->trans("CustomerOrder");
|
echo '<td class="linkedcol-element" >'.$langs->trans("CustomerOrder");
|
||||||
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
|
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
|
||||||
@ -62,14 +62,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
|
echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
|
||||||
echo '<td class="linkedcol-action right">';
|
echo '<td class="linkedcol-action right">';
|
||||||
// For now, shipments must stay linked to order, so link is not deletable
|
// For now, shipments must stay linked to order, so link is not deletable
|
||||||
if($object->element != 'shipping') {
|
if ($object->element != 'shipping') {
|
||||||
echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
|
echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
if (count($linkedObjectBlock) > 1) {
|
if (count($linkedObjectBlock) > 1) {
|
||||||
echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
|
echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : '').'">';
|
||||||
echo '<td>'.$langs->trans("Total").'</td>';
|
echo '<td>'.$langs->trans("Total").'</td>';
|
||||||
echo '<td></td>';
|
echo '<td></td>';
|
||||||
echo '<td class="center"></td>';
|
echo '<td class="center"></td>';
|
||||||
|
|||||||
@ -1216,7 +1216,7 @@ if (empty($reshook))
|
|||||||
// Si facture standard
|
// Si facture standard
|
||||||
$object->socid = GETPOST('socid', 'int');
|
$object->socid = GETPOST('socid', 'int');
|
||||||
$object->type = GETPOST('type');
|
$object->type = GETPOST('type');
|
||||||
$object->ref = $_POST['ref'];
|
$object->ref = $_POST['ref'];
|
||||||
$object->date = $dateinvoice;
|
$object->date = $dateinvoice;
|
||||||
$object->date_pointoftax = $date_pointoftax;
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim(GETPOST('note_public', 'none'));
|
$object->note_public = trim(GETPOST('note_public', 'none'));
|
||||||
|
|||||||
190
htdocs/core/boxes/box_shipments.php
Normal file
190
htdocs/core/boxes/box_shipments.php
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
|
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/boxes/box_shipments.php
|
||||||
|
* \ingroup shipment
|
||||||
|
* \brief Module for generating the display of the shipment box
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage the box to show last shipments
|
||||||
|
*/
|
||||||
|
class box_shipments extends ModeleBoxes
|
||||||
|
{
|
||||||
|
public $boxcode="lastcustomershipments";
|
||||||
|
public $boximg="sending";
|
||||||
|
public $boxlabel="BoxLastCustomerShipments";
|
||||||
|
public $depends = array("expedition");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var DoliDB Database handler.
|
||||||
|
*/
|
||||||
|
public $db;
|
||||||
|
|
||||||
|
public $param;
|
||||||
|
|
||||||
|
public $info_box_head = array();
|
||||||
|
public $info_box_contents = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param string $param More parameters
|
||||||
|
*/
|
||||||
|
public function __construct($db, $param)
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$this->db=$db;
|
||||||
|
|
||||||
|
$this->hidden=! ($user->rights->expedition->lire);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data for box to show them later
|
||||||
|
*
|
||||||
|
* @param int $max Maximum number of records to load
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function loadBox($max = 5)
|
||||||
|
{
|
||||||
|
global $user, $langs, $conf;
|
||||||
|
$langs->loadLangs(array('orders', 'sendings'));
|
||||||
|
|
||||||
|
$this->max = $max;
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
|
||||||
|
$shipmentstatic = new Expedition($this->db);
|
||||||
|
$orderstatic = new Commande($this->db);
|
||||||
|
$societestatic = new Societe($this->db);
|
||||||
|
|
||||||
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerShipments", $max));
|
||||||
|
|
||||||
|
if ($user->rights->expedition->lire)
|
||||||
|
{
|
||||||
|
$sql = "SELECT s.nom as name";
|
||||||
|
$sql.= ", s.rowid as socid";
|
||||||
|
$sql.= ", s.code_client";
|
||||||
|
$sql.= ", s.logo, s.email";
|
||||||
|
$sql.= ", e.ref, e.tms";
|
||||||
|
$sql.= ", e.rowid";
|
||||||
|
$sql.= ", e.ref_customer";
|
||||||
|
$sql.= ", e.fk_statut";
|
||||||
|
$sql.= ", e.fk_user_valid";
|
||||||
|
$sql.= ", c.ref as commande_ref";
|
||||||
|
$sql.= ", c.rowid as commande_id";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
|
||||||
|
$sql.= " WHERE e.entity = ".$conf->entity;
|
||||||
|
if (! empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql.=" AND e.fk_statut = 1";
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND sc.fk_user = " .$user->id;
|
||||||
|
else $sql.= " ORDER BY e.date_delivery, e.ref DESC ";
|
||||||
|
$sql.= $this->db->plimit($max, 0);
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$num = $this->db->num_rows($result);
|
||||||
|
|
||||||
|
$line = 0;
|
||||||
|
|
||||||
|
while ($line < $num) {
|
||||||
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|
||||||
|
$shipmentstatic->id = $objp->rowid;
|
||||||
|
$shipmentstatic->ref = $objp->ref;
|
||||||
|
$shipmentstatic->ref_customer = $objp->ref_customer;
|
||||||
|
|
||||||
|
$orderstatic->id= $objp->commande_id;
|
||||||
|
$orderstatic->ref=$objp->commande_ref;
|
||||||
|
|
||||||
|
$societestatic->id = $objp->socid;
|
||||||
|
$societestatic->name = $objp->name;
|
||||||
|
$societestatic->email = $objp->email;
|
||||||
|
$societestatic->code_client = $objp->code_client;
|
||||||
|
$societestatic->logo = $objp->logo;
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][] = array(
|
||||||
|
'td' => '',
|
||||||
|
'text' => $shipmentstatic->getNomUrl(1),
|
||||||
|
'asis' => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][] = array(
|
||||||
|
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||||
|
'text' => $societestatic->getNomUrl(1),
|
||||||
|
'asis' => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][] = array(
|
||||||
|
'td' => '',
|
||||||
|
'text' => $orderstatic->getNomUrl(1),
|
||||||
|
'asis' => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][] = array(
|
||||||
|
'td' => 'class="right" width="18"',
|
||||||
|
'text' => $shipmentstatic->LibStatut($objp->fk_statut, 3),
|
||||||
|
);
|
||||||
|
|
||||||
|
$line++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedShipments"));
|
||||||
|
|
||||||
|
$this->db->free($result);
|
||||||
|
} else {
|
||||||
|
$this->info_box_contents[0][0] = array(
|
||||||
|
'td' => '',
|
||||||
|
'maxlength'=>500,
|
||||||
|
'text' => ($this->db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->info_box_contents[0][0] = array(
|
||||||
|
'td' => 'class="nohover opacitymedium left"',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to show box
|
||||||
|
*
|
||||||
|
* @param array $head Array with properties of box title
|
||||||
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function showBox($head = null, $contents = null, $nooutput = 0)
|
||||||
|
{
|
||||||
|
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -133,7 +133,9 @@ class modExpedition extends DolibarrModules
|
|||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
$this->boxes = array();
|
$this->boxes = array(
|
||||||
|
0=>array('file'=>'box_shipments.php','enabledbydefaulton'=>'Home'),
|
||||||
|
);
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Protection to avoid direct call of template
|
// Protection to avoid direct call of template
|
||||||
if (empty($conf) || ! is_object($conf))
|
if (empty($conf) || !is_object($conf))
|
||||||
{
|
{
|
||||||
print "Error, template page can't be called as URL";
|
print "Error, template page can't be called as URL";
|
||||||
exit;
|
exit;
|
||||||
@ -35,14 +35,14 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
|
|
||||||
$total=0;
|
$total = 0;
|
||||||
$ilink=0;
|
$ilink = 0;
|
||||||
foreach($linkedObjectBlock as $key => $objectlink)
|
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||||
{
|
{
|
||||||
$ilink++;
|
$ilink++;
|
||||||
|
|
||||||
$trclass='oddeven';
|
$trclass = 'oddeven';
|
||||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $trclass; ?>">
|
<tr class="<?php echo $trclass; ?>">
|
||||||
<td><?php echo $langs->trans("Shipment"); ?></td>
|
<td><?php echo $langs->trans("Shipment"); ?></td>
|
||||||
@ -58,7 +58,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
<td class="right">
|
<td class="right">
|
||||||
<?php
|
<?php
|
||||||
// For now, shipments must stay linked to order, so link is not deletable
|
// For now, shipments must stay linked to order, so link is not deletable
|
||||||
if($object->element != 'commande') {
|
if ($object->element != 'commande') {
|
||||||
?>
|
?>
|
||||||
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||||
<?php
|
<?php
|
||||||
@ -69,7 +69,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
}
|
}
|
||||||
if (count($linkedObjectBlock) > 1) {
|
if (count($linkedObjectBlock) > 1) {
|
||||||
?>
|
?>
|
||||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
|
||||||
<td><?php echo $langs->trans("Total"); ?></td>
|
<td><?php echo $langs->trans("Total"); ?></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td class="center"></td>
|
<td class="center"></td>
|
||||||
|
|||||||
@ -97,3 +97,6 @@ BoxSuspenseAccount=Count accountancy operation with suspense account
|
|||||||
BoxTitleSuspenseAccount=Number of unallocated lines
|
BoxTitleSuspenseAccount=Number of unallocated lines
|
||||||
NumberOfLinesInSuspenseAccount=Number of line in suspense account
|
NumberOfLinesInSuspenseAccount=Number of line in suspense account
|
||||||
SuspenseAccountNotDefined=Suspense account isn't defined
|
SuspenseAccountNotDefined=Suspense account isn't defined
|
||||||
|
BoxLastCustomerShipments=Last customer shipments
|
||||||
|
BoxTitleLastCustomerShipments=Latest %s customer shipments
|
||||||
|
NoRecordedShipments=No recorded customer shipment
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,10 @@ use Luracast\Restler\RestException;
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for products
|
* API class for products
|
||||||
@ -64,17 +68,18 @@ class Products extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* Return an array with product information.
|
* Return an array with product information.
|
||||||
*
|
*
|
||||||
* @param int $id ID of product
|
* @param int $id ID of product
|
||||||
* @param int $includestockdata Load also information about stock (slower)
|
* @param int $includestockdata Load also information about stock (slower)
|
||||||
|
* @param bool $includesubproducts Load information about subproducts
|
||||||
* @return array|mixed Data without useless information
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
* @throws 401
|
* @throws 401
|
||||||
* @throws 403
|
* @throws 403
|
||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
public function get($id, $includestockdata = 0)
|
public function get($id, $includestockdata = 0, $includesubproducts = false)
|
||||||
{
|
{
|
||||||
return $this->_fetch($id, '', '', '', $includestockdata);
|
return $this->_fetch($id, '', '', '', $includestockdata, $includesubproducts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,20 +87,21 @@ class Products extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* Return an array with product information.
|
* Return an array with product information.
|
||||||
*
|
*
|
||||||
* @param string $ref Ref of element
|
* @param string $ref Ref of element
|
||||||
* @param int $includestockdata Load also information about stock (slower)
|
* @param int $includestockdata Load also information about stock (slower)
|
||||||
|
* @param bool $includesubproducts Load information about subproducts
|
||||||
*
|
*
|
||||||
* @return array|mixed Data without useless information
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
* @url GET byRef/{ref}
|
* @url GET ref/{ref}
|
||||||
*
|
*
|
||||||
* @throws 401
|
* @throws 401
|
||||||
* @throws 403
|
* @throws 403
|
||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
public function getByRef($ref, $includestockdata = 0)
|
public function getByRef($ref, $includestockdata = 0, $includesubproducts = false)
|
||||||
{
|
{
|
||||||
return $this->_fetch('', $ref, '', '', $includestockdata);
|
return $this->_fetch('', $ref, '', '', $includestockdata, $includesubproducts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,20 +109,21 @@ class Products extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* Return an array with product information.
|
* Return an array with product information.
|
||||||
*
|
*
|
||||||
* @param string $ref_ext Ref_ext of element
|
* @param string $ref_ext Ref_ext of element
|
||||||
* @param int $includestockdata Load also information about stock (slower)
|
* @param int $includestockdata Load also information about stock (slower)
|
||||||
|
* @param bool $includesubproducts Load information about subproducts
|
||||||
*
|
*
|
||||||
* @return array|mixed Data without useless information
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
* @url GET byRefExt/{ref_ext}
|
* @url GET ref_ext/{ref_ext}
|
||||||
*
|
*
|
||||||
* @throws 401
|
* @throws 401
|
||||||
* @throws 403
|
* @throws 403
|
||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
public function getByRefExt($ref_ext, $includestockdata = 0)
|
public function getByRefExt($ref_ext, $includestockdata = 0, $includesubproducts = false)
|
||||||
{
|
{
|
||||||
return $this->_fetch('', '', $ref_ext, '', $includestockdata);
|
return $this->_fetch('', '', $ref_ext, '', $includestockdata, $includesubproducts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,20 +131,21 @@ class Products extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* Return an array with product information.
|
* Return an array with product information.
|
||||||
*
|
*
|
||||||
* @param string $barcode Barcode of element
|
* @param string $barcode Barcode of element
|
||||||
* @param int $includestockdata Load also information about stock (slower)
|
* @param int $includestockdata Load also information about stock (slower)
|
||||||
|
* @param bool $includesubproducts Load information about subproducts
|
||||||
*
|
*
|
||||||
* @return array|mixed Data without useless information
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
* @url GET byBarcode/{barcode}
|
* @url GET barcode/{barcode}
|
||||||
*
|
*
|
||||||
* @throws 401
|
* @throws 401
|
||||||
* @throws 403
|
* @throws 403
|
||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
public function getByBarcode($barcode, $includestockdata = 0)
|
public function getByBarcode($barcode, $includestockdata = 0, $includesubproducts = false)
|
||||||
{
|
{
|
||||||
return $this->_fetch('', '', '', $barcode, $includestockdata);
|
return $this->_fetch('', '', '', $barcode, $includestockdata, $includesubproducts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -370,6 +378,105 @@ class Products extends DolibarrApi
|
|||||||
return $this->product->delete(DolibarrApiAccess::$user);
|
return $this->product->delete(DolibarrApiAccess::$user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of subproducts of the product.
|
||||||
|
*
|
||||||
|
* @param int $id Id of parent product/service
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*
|
||||||
|
* @url GET {id}/subproducts
|
||||||
|
*/
|
||||||
|
public function getSubproducts($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! DolibarrApi::_checkAccessToResource('product', $id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$childsArbo = $this->product->getChildsArbo($id, 1);
|
||||||
|
|
||||||
|
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec'];
|
||||||
|
$childs = [];
|
||||||
|
foreach ($childsArbo as $values) {
|
||||||
|
$childs[] = array_combine($keys, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $childs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add subproduct.
|
||||||
|
*
|
||||||
|
* Link a product/service to a parent product/service
|
||||||
|
*
|
||||||
|
* @param int $id Id of parent product/service
|
||||||
|
* @param int $subproduct_id Id of child product/service
|
||||||
|
* @param int $qty Quantity
|
||||||
|
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*
|
||||||
|
* @url POST {id}/subproducts/add
|
||||||
|
*/
|
||||||
|
public function addSubproducts($id, $subproduct_id, $qty, $incdec = 1)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! DolibarrApi::_checkAccessToResource('product', $id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->product->add_sousproduit($id, $subproduct_id, $qty, $incdec);
|
||||||
|
if ($result <= 0) {
|
||||||
|
throw new RestException(500, "Error adding product child");
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove subproduct.
|
||||||
|
*
|
||||||
|
* Unlink a product/service from a parent product/service
|
||||||
|
*
|
||||||
|
* @param int $id Id of parent product/service
|
||||||
|
* @param int $subproduct_id Id of child product/service
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*
|
||||||
|
* @url DELETE {id}/subproducts/remove
|
||||||
|
*/
|
||||||
|
public function delSubproducts($id, $subproduct_id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! DolibarrApi::_checkAccessToResource('product', $id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->product->del_sousproduit($id, $subproduct_id);
|
||||||
|
if ($result <= 0) {
|
||||||
|
throw new RestException(500, "Error while removing product child");
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get categories for a product
|
* Get categories for a product
|
||||||
@ -696,6 +803,713 @@ class Products extends DolibarrApi
|
|||||||
return $this->_cleanObjectDatas($this->productsupplier);
|
return $this->_cleanObjectDatas($this->productsupplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get attributes.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*
|
||||||
|
* @url GET attributes
|
||||||
|
*/
|
||||||
|
public function getAttributes()
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
return $prodattr->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get attribute by ID.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*
|
||||||
|
* @url GET attributes/{id}
|
||||||
|
*/
|
||||||
|
public function getAttributeById($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
$result = $prodattr->fetch((int) $id);
|
||||||
|
|
||||||
|
if($result < 0) {
|
||||||
|
throw new RestException(404, "Attribute not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $prodattr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get attributes by ref.
|
||||||
|
*
|
||||||
|
* @param string $ref Reference of Attribute
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url GET attributes/ref/{ref}
|
||||||
|
*/
|
||||||
|
public function getAttributesByRef($ref)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, ref, label, rang FROM ".MAIN_DB_PREFIX."product_attribute WHERE ref LIKE '". trim($ref) ."' AND entity IN (".getEntity('product').")";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
if (!$this->db->num_rows($query)) {
|
||||||
|
throw new RestException(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->fetch_object($query);
|
||||||
|
|
||||||
|
$attr = [];
|
||||||
|
$attr['id'] = $result->rowid;
|
||||||
|
$attr['ref'] = $result->ref;
|
||||||
|
$attr['label'] = $result->label;
|
||||||
|
$attr['rang'] = $result->rang;
|
||||||
|
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add attributes.
|
||||||
|
*
|
||||||
|
* @param string $ref Reference of Attribute
|
||||||
|
* @param string $label Label of Attribute
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url POST attributes
|
||||||
|
*/
|
||||||
|
public function addAttributes($ref, $label)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
$prodattr->label = $label;
|
||||||
|
$prodattr->ref = $ref;
|
||||||
|
|
||||||
|
$resid = $prodattr->create(DolibarrApiAccess::$user);
|
||||||
|
if ($resid <= 0) {
|
||||||
|
throw new RestException(500, "Error creating new attribute");
|
||||||
|
}
|
||||||
|
return $resid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update attributes by id.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute
|
||||||
|
* @param array $request_data Datas
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*
|
||||||
|
* @url PUT attributes/{id}
|
||||||
|
*/
|
||||||
|
public function putAttributes($id, $request_data = null)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
|
||||||
|
$result = $prodattr->fetch((int) $id);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(404, 'Attribute not found');
|
||||||
|
} elseif ($result < 0) {
|
||||||
|
throw new RestException(500, "Error fetching attribute");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
if ($field == 'rowid') { continue;
|
||||||
|
}
|
||||||
|
$prodattr->$field = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prodattr->update(DolibarrApiAccess::$user) > 0) {
|
||||||
|
$result = $prodattr->fetch((int) $id);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(404, 'Attribute not found');
|
||||||
|
} elseif ($result < 0) {
|
||||||
|
throw new RestException(500, "Error fetching attribute");
|
||||||
|
} else {
|
||||||
|
return $prodattr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RestException(500, "Error updating attribute");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete attributes by id.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url DELETE attributes/{id}
|
||||||
|
*/
|
||||||
|
public function deleteAttributes($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
$prodattr->id = (int) $id;
|
||||||
|
$result = $prodattr->delete();
|
||||||
|
|
||||||
|
if ($result > 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
throw new RestException(500, "Error deleting attribute");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get attribute value by id.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute value
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url GET attributes/values/{id}
|
||||||
|
*/
|
||||||
|
public function getAttributeValueById($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, fk_product_attribute, ref, value FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE rowid = ".(int) $id." AND entity IN (".getEntity('product').")";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
if (!$query) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->db->num_rows($query)) {
|
||||||
|
throw new RestException(404, 'Attribute value not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->fetch_object($query);
|
||||||
|
|
||||||
|
$attrval = [];
|
||||||
|
$attrval['id'] = $result->rowid;
|
||||||
|
$attrval['fk_product_attribute'] = $result->fk_product_attribute;
|
||||||
|
$attrval['ref'] = $result->ref;
|
||||||
|
$attrval['value'] = $result->value;
|
||||||
|
|
||||||
|
return $attrval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get attribute value by ref.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute value
|
||||||
|
* @param string $ref Ref of Attribute value
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url GET attributes/{id}/values/ref/{ref}
|
||||||
|
*/
|
||||||
|
public function getAttributeValueByRef($id, $ref)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, fk_product_attribute, ref, value FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE ref LIKE '". trim($ref) ."' AND fk_product_attribute = ". (int) $id ." AND entity IN (".getEntity('product').")";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
if (!$query) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->db->num_rows($query)) {
|
||||||
|
throw new RestException(404, 'Attribute value not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->fetch_object($query);
|
||||||
|
|
||||||
|
$attrval = [];
|
||||||
|
$attrval['id'] = $result->rowid;
|
||||||
|
$attrval['fk_product_attribute'] = $result->fk_product_attribute;
|
||||||
|
$attrval['ref'] = $result->ref;
|
||||||
|
$attrval['value'] = $result->value;
|
||||||
|
|
||||||
|
return $attrval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete attribute value by ref.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute
|
||||||
|
* @param string $ref Ref of Attribute value
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url DELETE attributes/{id}/values/ref/{ref}
|
||||||
|
*/
|
||||||
|
public function deleteAttributeValueByRef($id, $ref)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE ref LIKE '". trim($ref) ."' AND fk_product_attribute = ". (int) $id;
|
||||||
|
|
||||||
|
if ($this->db->query($sql)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RestException(500, "Error deleting attribute value");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all values for an attribute id.
|
||||||
|
*
|
||||||
|
* @param int $id ID of an Attribute
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url GET attributes/{id}/values
|
||||||
|
*/
|
||||||
|
public function getAttributeValues($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objectval = new ProductAttributeValue($this->db);
|
||||||
|
return $objectval->fetchAllByProductAttribute((int) $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all values for an attribute ref.
|
||||||
|
*
|
||||||
|
* @param string $ref Ref of an Attribute
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url GET attributes/ref/{ref}/values
|
||||||
|
*/
|
||||||
|
public function getAttributeValuesByRef($ref)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT ';
|
||||||
|
$sql .= 'v.fk_product_attribute, v.rowid, v.ref, v.value FROM '.MAIN_DB_PREFIX.'product_attribute_value v ';
|
||||||
|
$sql .= "WHERE v.fk_product_attribute = ( SELECT rowid FROM ".MAIN_DB_PREFIX."product_attribute WHERE ref LIKE '". strtoupper(trim($ref)) ."' LIMIT 1)";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
while ($result = $this->db->fetch_object($query)) {
|
||||||
|
$tmp = new ProductAttributeValue($this->db);
|
||||||
|
$tmp->fk_product_attribute = $result->fk_product_attribute;
|
||||||
|
$tmp->id = $result->rowid;
|
||||||
|
$tmp->ref = $result->ref;
|
||||||
|
$tmp->value = $result->value;
|
||||||
|
|
||||||
|
$return[] = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add attribute value.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute
|
||||||
|
* @param string $ref Reference of Attribute value
|
||||||
|
* @param string $value Value of Attribute value
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url POST attributes/{id}/values
|
||||||
|
*/
|
||||||
|
public function addAttributeValue($id, $ref, $value)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($ref) || empty($value)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objectval = new ProductAttributeValue($this->db);
|
||||||
|
$objectval->fk_product_attribute = $id;
|
||||||
|
$objectval->ref = $ref;
|
||||||
|
$objectval->value = $value;
|
||||||
|
|
||||||
|
if ($objectval->create(DolibarrApiAccess::$user) > 0) {
|
||||||
|
return $objectval->id;
|
||||||
|
}
|
||||||
|
throw new RestException(500, "Error creating new attribute value");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update attribute value.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute
|
||||||
|
* @param array $request_data Datas
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url PUT attributes/values/{id}
|
||||||
|
*/
|
||||||
|
public function putAttributeValue($id, $request_data)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objectval = new ProductAttributeValue($this->db);
|
||||||
|
$result = $objectval->fetch((int) $id);
|
||||||
|
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(404, 'Attribute value not found');
|
||||||
|
} elseif ($result < 0) {
|
||||||
|
throw new RestException(500, "Error fetching attribute value");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
if ($field == 'rowid') { continue;
|
||||||
|
}
|
||||||
|
$objectval->$field = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($objectval->update(DolibarrApiAccess::$user) > 0) {
|
||||||
|
$result = $objectval->fetch((int) $id);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(404, 'Attribute not found');
|
||||||
|
} elseif ($result < 0) {
|
||||||
|
throw new RestException(500, "Error fetching attribute");
|
||||||
|
} else {
|
||||||
|
return $objectval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RestException(500, "Error updating attribute");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete attribute value by id.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Attribute value
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url DELETE attributes/values/{id}
|
||||||
|
*/
|
||||||
|
public function deleteAttributeValueById($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objectval = new ProductAttributeValue($this->db);
|
||||||
|
$objectval->id = (int) $id;
|
||||||
|
|
||||||
|
if ($objectval->delete() > 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
throw new RestException(500, "Error deleting attribute value");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get product variants.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Product
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url GET {id}/variants
|
||||||
|
*/
|
||||||
|
public function getVariants($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcomb = new ProductCombination($this->db);
|
||||||
|
$combinations = $prodcomb->fetchAllByFkProductParent((int) $id);
|
||||||
|
|
||||||
|
foreach ($combinations as $key => $combination) {
|
||||||
|
$prodc2vp = new ProductCombination2ValuePair($this->db);
|
||||||
|
$combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $combinations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get product variants by Product ref.
|
||||||
|
*
|
||||||
|
* @param string $ref Ref of Product
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url GET ref/{ref}/variants
|
||||||
|
*/
|
||||||
|
public function getVariantsByProdRef($ref)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->product->fetch('', $ref);
|
||||||
|
if(! $result ) {
|
||||||
|
throw new RestException(404, 'Product not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcomb = new ProductCombination($this->db);
|
||||||
|
$combinations = $prodcomb->fetchAllByFkProductParent((int) $this->product->id);
|
||||||
|
|
||||||
|
foreach ($combinations as $key => $combination) {
|
||||||
|
$prodc2vp = new ProductCombination2ValuePair($this->db);
|
||||||
|
$combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $combinations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add variant.
|
||||||
|
*
|
||||||
|
* "features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
|
||||||
|
*
|
||||||
|
* @param int $id ID of Product
|
||||||
|
* @param float $weight_impact Weight impact of variant
|
||||||
|
* @param float $price_impact Price impact of variant
|
||||||
|
* @param bool $price_impact_is_percent Price impact in percent (true or false)
|
||||||
|
* @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*
|
||||||
|
* @url POST {id}/variants
|
||||||
|
*/
|
||||||
|
public function addVariant($id, $weight_impact, $price_impact, $price_impact_is_percent, $features)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($id) || empty($features) || !is_array($features)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$weight_impact = price2num($weight_impact);
|
||||||
|
$price_impact = price2num($price_impact);
|
||||||
|
|
||||||
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
$prodattr_val = new ProductAttributeValue($this->db);
|
||||||
|
foreach ($features as $id_attr => $id_value) {
|
||||||
|
if ($prodattr->fetch((int) $id_attr) < 0) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
if ($prodattr_val->fetch((int) $id_value) < 0) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->product->fetch((int) $id);
|
||||||
|
if(! $result ) {
|
||||||
|
throw new RestException(404, 'Product not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcomb = new ProductCombination($this->db);
|
||||||
|
if (! $prodcomb->fetchByProductCombination2ValuePairs($id, $features))
|
||||||
|
{
|
||||||
|
$result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
return $result;
|
||||||
|
} else {
|
||||||
|
throw new RestException(500, "Error creating new product variant");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $prodcomb->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add variant by product ref.
|
||||||
|
*
|
||||||
|
* "features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
|
||||||
|
*
|
||||||
|
* @param string $ref Ref of Product
|
||||||
|
* @param float $weight_impact Weight impact of variant
|
||||||
|
* @param float $price_impact Price impact of variant
|
||||||
|
* @param bool $price_impact_is_percent Price impact in percent (true or false)
|
||||||
|
* @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*
|
||||||
|
* @url POST ref/{ref}/variants
|
||||||
|
*/
|
||||||
|
public function addVariantByProductRef($ref, $weight_impact, $price_impact, $price_impact_is_percent, $features)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($ref) || empty($features) || !is_array($features)) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$weight_impact = price2num($weight_impact);
|
||||||
|
$price_impact = price2num($price_impact);
|
||||||
|
|
||||||
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
$prodattr_val = new ProductAttributeValue($this->db);
|
||||||
|
foreach ($features as $id_attr => $id_value) {
|
||||||
|
if ($prodattr->fetch((int) $id_attr) < 0) {
|
||||||
|
throw new RestException(404);
|
||||||
|
}
|
||||||
|
if ($prodattr_val->fetch((int) $id_value) < 0) {
|
||||||
|
throw new RestException(404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->product->fetch('', trim($ref));
|
||||||
|
if(! $result ) {
|
||||||
|
throw new RestException(404, 'Product not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcomb = new ProductCombination($this->db);
|
||||||
|
if (! $prodcomb->fetchByProductCombination2ValuePairs($this->product->id, $features))
|
||||||
|
{
|
||||||
|
$result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
return $result;
|
||||||
|
} else {
|
||||||
|
throw new RestException(500, "Error creating new product variant");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $prodcomb->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put product variants.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Variant
|
||||||
|
* @param array $request_data Datas
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url PUT variants/{id}
|
||||||
|
*/
|
||||||
|
public function putVariant($id, $request_data = null)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcomb = new ProductCombination($this->db);
|
||||||
|
$prodcomb->fetch((int) $id);
|
||||||
|
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
if ($field == 'rowid') { continue;
|
||||||
|
}
|
||||||
|
$prodcomb->$field = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $prodcomb->update(DolibarrApiAccess::$user);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
throw new RestException(500, "Error editing variant");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete product variants.
|
||||||
|
*
|
||||||
|
* @param int $id ID of Variant
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
* @throws 401
|
||||||
|
*
|
||||||
|
* @url DELETE variants/{id}
|
||||||
|
*/
|
||||||
|
public function deleteVariant($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcomb = new ProductCombination($this->db);
|
||||||
|
$prodcomb->id = (int) $id;
|
||||||
|
$result = $prodcomb->delete(DolibarrApiAccess::$user);
|
||||||
|
return $result;
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
throw new RestException(500, "Error deleting variant");
|
||||||
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
@ -748,18 +1562,19 @@ class Products extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* Return an array with product information.
|
* Return an array with product information.
|
||||||
*
|
*
|
||||||
* @param int $id ID of product
|
* @param int $id ID of product
|
||||||
* @param string $ref Ref of element
|
* @param string $ref Ref of element
|
||||||
* @param string $ref_ext Ref ext of element
|
* @param string $ref_ext Ref ext of element
|
||||||
* @param string $barcode Barcode of element
|
* @param string $barcode Barcode of element
|
||||||
* @param int $includestockdata Load also information about stock (slower)
|
* @param int $includestockdata Load also information about stock (slower)
|
||||||
* @return array|mixed Data without useless information
|
* @param bool $includesubproducts Load information about subproducts
|
||||||
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
* @throws 401
|
* @throws 401
|
||||||
* @throws 403
|
* @throws 403
|
||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0)
|
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0, $includesubproducts = false)
|
||||||
{
|
{
|
||||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) {
|
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) {
|
||||||
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
|
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
|
||||||
@ -784,6 +1599,20 @@ class Products extends DolibarrApi
|
|||||||
$this->product->load_stock();
|
$this->product->load_stock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($includesubproducts) {
|
||||||
|
$childsArbo = $this->product->getChildsArbo($id, 1);
|
||||||
|
|
||||||
|
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec'];
|
||||||
|
$childs = [];
|
||||||
|
foreach ($childsArbo as $values) {
|
||||||
|
$childs[] = array_combine($keys, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->product->sousprods = $childs;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->product);
|
return $this->_cleanObjectDatas($this->product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,9 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
|||||||
{
|
{
|
||||||
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||||
}
|
}
|
||||||
$usevirtualstock = 0;
|
|
||||||
|
$usevirtualstock = !empty($conf->global->STOCK_USE_VIRTUAL_STOCK);
|
||||||
|
if ($mode == 'physical') $usevirtualstock = 0;
|
||||||
if ($mode == 'virtual') $usevirtualstock = 1;
|
if ($mode == 'virtual') $usevirtualstock = 1;
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
|
|||||||
@ -38,8 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
$langs->loadLangs(array('products', 'stocks', 'orders'));
|
$langs->loadLangs(array('products', 'stocks', 'orders'));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->socid) $socid=$user->socid;
|
if ($user->socid) $socid = $user->socid;
|
||||||
$result=restrictedArea($user, 'produit|service');
|
$result = restrictedArea($user, 'produit|service');
|
||||||
|
|
||||||
$sall = GETPOST('search_all', 'alphanohtml');
|
$sall = GETPOST('search_all', 'alphanohtml');
|
||||||
$sref = GETPOST('search_ref', 'alpha');
|
$sref = GETPOST('search_ref', 'alpha');
|
||||||
@ -53,7 +53,7 @@ $search_datemonth = GETPOST('search_datemonth', 'int');
|
|||||||
$search_dateday = GETPOST('search_dateday', 'int');
|
$search_dateday = GETPOST('search_dateday', 'int');
|
||||||
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
|
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
|
||||||
|
|
||||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
if (!$sortorder) $sortorder = 'DESC';
|
if (!$sortorder) $sortorder = 'DESC';
|
||||||
@ -69,16 +69,16 @@ $offset = $limit * $page;
|
|||||||
|
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$sall="";
|
$sall = "";
|
||||||
$sref="";
|
$sref = "";
|
||||||
$snom="";
|
$snom = "";
|
||||||
$suser="";
|
$suser = "";
|
||||||
$sttc="";
|
$sttc = "";
|
||||||
$search_date='';
|
$search_date = '';
|
||||||
$search_datemonth='';
|
$search_datemonth = '';
|
||||||
$search_dateday='';
|
$search_dateday = '';
|
||||||
$search_dateyear='';
|
$search_dateyear = '';
|
||||||
$sproduct=0;
|
$sproduct = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -109,40 +109,40 @@ dol_fiche_head($head, 'replenishorders', '', -1, '');
|
|||||||
$commandestatic = new CommandeFournisseur($db);
|
$commandestatic = new CommandeFournisseur($db);
|
||||||
|
|
||||||
$sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,';
|
$sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,';
|
||||||
$sql.= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,';
|
$sql .= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,';
|
||||||
$sql.= ' u.login';
|
$sql .= ' u.login';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande_fournisseur as cf';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande_fournisseur as cf';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON cf.fk_user_author = u.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON cf.fk_user_author = u.rowid';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) {
|
if (!$user->rights->societe->client->voir && !$socid) {
|
||||||
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
|
$sql .= ', '.MAIN_DB_PREFIX.'societe_commerciaux as sc';
|
||||||
}
|
}
|
||||||
$sql.= ' WHERE cf.fk_soc = s.rowid ';
|
$sql .= ' WHERE cf.fk_soc = s.rowid ';
|
||||||
$sql.= ' AND cf.entity = ' . $conf->entity;
|
$sql .= ' AND cf.entity = '.$conf->entity;
|
||||||
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
|
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
|
||||||
$sql .= ' AND cf.fk_statut < 3';
|
$sql .= ' AND cf.fk_statut < 3';
|
||||||
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||||
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
|
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
|
||||||
} else {
|
} else {
|
||||||
$sql .= ' AND cf.fk_statut < 5';
|
$sql .= ' AND cf.fk_statut < 5';
|
||||||
}
|
}
|
||||||
if (!$user->rights->societe->client->voir && !$socid) {
|
if (!$user->rights->societe->client->voir && !$socid) {
|
||||||
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
|
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = '.$user->id;
|
||||||
}
|
}
|
||||||
if ($sref) $sql .= natural_search('cf.ref', $sref);
|
if ($sref) $sql .= natural_search('cf.ref', $sref);
|
||||||
if ($snom) $sql .= natural_search('s.nom', $snom);
|
if ($snom) $sql .= natural_search('s.nom', $snom);
|
||||||
if ($suser) $sql .= natural_search('u.login', $suser);
|
if ($suser) $sql .= natural_search('u.login', $suser);
|
||||||
if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
|
if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
|
||||||
$sql.= dolSqlDateFilter('cf.date_creation', $search_dateday, $search_datemonth, $search_dateyear);
|
$sql .= dolSqlDateFilter('cf.date_creation', $search_dateday, $search_datemonth, $search_dateyear);
|
||||||
if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall);
|
if ($sall) $sql .= natural_search(array('cf.ref', 'cf.note'), $sall);
|
||||||
if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid;
|
if (!empty($socid)) $sql .= ' AND s.rowid = '.$socid;
|
||||||
if (GETPOST('statut', 'int')) {
|
if (GETPOST('statut', 'int')) {
|
||||||
$sql .= ' AND fk_statut = ' . GETPOST('statut', 'int');
|
$sql .= ' AND fk_statut = '.GETPOST('statut', 'int');
|
||||||
}
|
}
|
||||||
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
|
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
|
||||||
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
|
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
if (! $sproduct) {
|
if (!$sproduct) {
|
||||||
$sql .= $db->plimit($limit+1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -155,17 +155,17 @@ if ($resql)
|
|||||||
|
|
||||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');
|
print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');
|
||||||
|
|
||||||
$param='';
|
$param = '';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
if ($sref) $param.='&search_ref='.urlencode($sref);
|
if ($sref) $param .= '&search_ref='.urlencode($sref);
|
||||||
if ($snom) $param.='&search_nom='.urlencode($snom);
|
if ($snom) $param .= '&search_nom='.urlencode($snom);
|
||||||
if ($suser) $param.='&search_user='.urlencode($suser);
|
if ($suser) $param .= '&search_user='.urlencode($suser);
|
||||||
if ($sttc) $param.='&search_ttc='.urlencode($sttc);
|
if ($sttc) $param .= '&search_ttc='.urlencode($sttc);
|
||||||
if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear);
|
if ($search_dateyear) $param .= '&search_dateyear='.urlencode($search_dateyear);
|
||||||
if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth);
|
if ($search_datemonth) $param .= '&search_datemonth='.urlencode($search_datemonth);
|
||||||
if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday);
|
if ($search_dateday) $param .= '&search_dateday='.urlencode($search_dateday);
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||||
|
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
|
||||||
@ -174,16 +174,16 @@ if ($resql)
|
|||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre">'.
|
print '<td class="liste_titre">'.
|
||||||
'<input type="text" class="flat" name="search_ref" value="' . dol_escape_htmltag($sref) . '">'.
|
'<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($sref).'">'.
|
||||||
'</td>'.
|
'</td>'.
|
||||||
'<td class="liste_titre">'.
|
'<td class="liste_titre">'.
|
||||||
'<input type="text" class="flat" name="search_nom" value="' . dol_escape_htmltag($snom) . '">'.
|
'<input type="text" class="flat" name="search_nom" value="'.dol_escape_htmltag($snom).'">'.
|
||||||
'</td>'.
|
'</td>'.
|
||||||
'<td class="liste_titre">'.
|
'<td class="liste_titre">'.
|
||||||
'<input type="text" class="flat" name="search_user" value="' . dol_escape_htmltag($suser) . '">'.
|
'<input type="text" class="flat" name="search_user" value="'.dol_escape_htmltag($suser).'">'.
|
||||||
'</td>'.
|
'</td>'.
|
||||||
'<td class="liste_titre">'.
|
'<td class="liste_titre">'.
|
||||||
'<input type="text" class="flat" name="search_ttc" value="' . dol_escape_htmltag($sttc) . '">'.
|
'<input type="text" class="flat" name="search_ttc" value="'.dol_escape_htmltag($sttc).'">'.
|
||||||
'</td>'.
|
'</td>'.
|
||||||
'<td class="liste_titre">'.
|
'<td class="liste_titre">'.
|
||||||
$form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, '').
|
$form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, '').
|
||||||
@ -260,7 +260,7 @@ if ($resql)
|
|||||||
|
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
while ($i < min($num, $sproduct?$num:$conf->liste_limit))
|
while ($i < min($num, $sproduct ? $num : $conf->liste_limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
@ -276,11 +276,11 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
$href = DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid;
|
$href = DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid;
|
||||||
print '<td>'.
|
print '<td>'.
|
||||||
'<a href="' . $href .'">'.
|
'<a href="'.$href.'">'.
|
||||||
img_object($langs->trans('ShowCompany'), 'company'). ' '.
|
img_object($langs->trans('ShowCompany'), 'company').' '.
|
||||||
$obj->name . '</a></td>';
|
$obj->name.'</a></td>';
|
||||||
|
|
||||||
// Author
|
// Author
|
||||||
$userstatic->id = $obj->fk_user_author;
|
$userstatic->id = $obj->fk_user_author;
|
||||||
@ -288,7 +288,7 @@ if ($resql)
|
|||||||
if ($userstatic->id) {
|
if ($userstatic->id) {
|
||||||
$txt = $userstatic->getLoginUrl(1);
|
$txt = $userstatic->getLoginUrl(1);
|
||||||
} else {
|
} else {
|
||||||
$txt = ' ';
|
$txt = ' ';
|
||||||
}
|
}
|
||||||
print '<td>'.$txt.'</td>';
|
print '<td>'.$txt.'</td>';
|
||||||
// Amount
|
// Amount
|
||||||
@ -296,9 +296,9 @@ if ($resql)
|
|||||||
|
|
||||||
// Date
|
// Date
|
||||||
if ($obj->dc) {
|
if ($obj->dc) {
|
||||||
$date = dol_print_date($db->jdate($obj->dc), 'dayhour');
|
$date = dol_print_date($db->jdate($obj->dc), 'dayhour');
|
||||||
} else {
|
} else {
|
||||||
$date = '-';
|
$date = '-';
|
||||||
}
|
}
|
||||||
print '<td>'.$date.'</td>';
|
print '<td>'.$date.'</td>';
|
||||||
// Statut
|
// Statut
|
||||||
|
|||||||
@ -30,19 +30,19 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
|||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result=restrictedArea($user, 'stock');
|
$result = restrictedArea($user, 'stock');
|
||||||
|
|
||||||
$sref=GETPOST("sref", 'alpha');
|
$sref = GETPOST("sref", 'alpha');
|
||||||
$snom=GETPOST("snom", 'alpha');
|
$snom = GETPOST("snom", 'alpha');
|
||||||
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
if (! $sortfield) $sortfield="e.ref";
|
if (!$sortfield) $sortfield = "e.ref";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (!$sortorder) $sortorder = "ASC";
|
||||||
$page = $_GET["page"];
|
$page = $_GET["page"];
|
||||||
if ($page < 0) $page = 0;
|
if ($page < 0) $page = 0;
|
||||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
$year = strftime("%Y", time());
|
$year = strftime("%Y", time());
|
||||||
@ -53,23 +53,23 @@ $year = strftime("%Y", time());
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
|
$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
|
||||||
$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
|
$sql .= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
|
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
|
||||||
$sql.= " WHERE e.entity IN (".getEntity('stock').")";
|
$sql .= " WHERE e.entity IN (".getEntity('stock').")";
|
||||||
if ($sref) $sql.= natural_search("e.ref", $sref);
|
if ($sref) $sql .= natural_search("e.ref", $sref);
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
$sql.= " AND (e.ref LIKE '%".$db->escape($sall)."%'";
|
$sql .= " AND (e.ref LIKE '%".$db->escape($sall)."%'";
|
||||||
$sql.= " OR e.description LIKE '%".$db->escape($sall)."%'";
|
$sql .= " OR e.description LIKE '%".$db->escape($sall)."%'";
|
||||||
$sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
|
$sql .= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
|
||||||
$sql.= " OR e.address LIKE '%".$db->escape($sall)."%'";
|
$sql .= " OR e.address LIKE '%".$db->escape($sall)."%'";
|
||||||
$sql.= " OR e.town LIKE '%".$db->escape($sall)."%')";
|
$sql .= " OR e.town LIKE '%".$db->escape($sall)."%')";
|
||||||
}
|
}
|
||||||
$sql.= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
|
$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
$sql.= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -78,7 +78,7 @@ if ($result)
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||||
llxHeader("", $langs->trans("EnhancedValueOfWarehouses"), $help_url);
|
llxHeader("", $langs->trans("EnhancedValueOfWarehouses"), $help_url);
|
||||||
|
|
||||||
print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
|
print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
|
||||||
@ -94,9 +94,9 @@ if ($result)
|
|||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$entrepot=new Entrepot($db);
|
$entrepot = new Entrepot($db);
|
||||||
$total = $totalsell = 0;
|
$total = $totalsell = 0;
|
||||||
$var=false;
|
$var = false;
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
@ -136,17 +136,17 @@ if ($result)
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$file='entrepot-'.$year.'.png';
|
$file = 'entrepot-'.$year.'.png';
|
||||||
if (file_exists($conf->stock->dir_temp.'/'.$file))
|
if (file_exists($conf->stock->dir_temp.'/'.$file))
|
||||||
{
|
{
|
||||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
|
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
|
||||||
print '<img src="'.$url.'">';
|
print '<img src="'.$url.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$file='entrepot-'.($year-1).'.png';
|
$file = 'entrepot-'.($year - 1).'.png';
|
||||||
if (file_exists($conf->stock->dir_temp.'/'.$file))
|
if (file_exists($conf->stock->dir_temp.'/'.$file))
|
||||||
{
|
{
|
||||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
|
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file;
|
||||||
print '<br><img src="'.$url.'">';
|
print '<br><img src="'.$url.'">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1985,7 +1985,7 @@ class Task extends CommonObject
|
|||||||
$sql .= " WHERE p.entity IN (".getEntity('project', 0).')';
|
$sql .= " WHERE p.entity IN (".getEntity('project', 0).')';
|
||||||
$sql .= " AND p.fk_statut = 1";
|
$sql .= " AND p.fk_statut = 1";
|
||||||
$sql .= " AND t.fk_projet = p.rowid";
|
$sql .= " AND t.fk_projet = p.rowid";
|
||||||
$sql .= " AND t.progress < 100"; // tasks to do
|
$sql .= " AND (t.progress IS NULL OR t.progress < 100)"; // tasks to do
|
||||||
if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")";
|
if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")";
|
||||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
|
|||||||
@ -36,34 +36,34 @@ $ref = GETPOST('ref', 'alpha');
|
|||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", "alpha");
|
$sortfield = GETPOST("sortfield", "alpha");
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST("page", 'int');
|
||||||
$page = is_numeric($page) ? $page : 0;
|
$page = is_numeric($page) ? $page : 0;
|
||||||
$page = $page == -1 ? 0 : $page;
|
$page = $page == -1 ? 0 : $page;
|
||||||
if (! $sortfield) $sortfield="a.datep,a.id";
|
if (!$sortfield) $sortfield = "a.datep,a.id";
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (!$sortorder) $sortorder = "DESC";
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
if (GETPOST('actioncode', 'array'))
|
if (GETPOST('actioncode', 'array'))
|
||||||
{
|
{
|
||||||
$actioncode=GETPOST('actioncode', 'array', 3);
|
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||||
if (! count($actioncode)) $actioncode='0';
|
if (!count($actioncode)) $actioncode = '0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||||
}
|
}
|
||||||
$search_agenda_label=GETPOST('search_agenda_label');
|
$search_agenda_label = GETPOST('search_agenda_label');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = GETPOST("id", 'int');
|
$id = GETPOST("id", 'int');
|
||||||
$socid=0;
|
$socid = 0;
|
||||||
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||||
$result=restrictedArea($user, 'projet', $id, '');
|
$result = restrictedArea($user, 'projet', $id, '');
|
||||||
|
|
||||||
if (!$user->rights->projet->lire) accessforbidden();
|
if (!$user->rights->projet->lire) accessforbidden();
|
||||||
|
|
||||||
@ -149,20 +149,20 @@ dol_fiche_end();
|
|||||||
|
|
||||||
// Actions buttons
|
// Actions buttons
|
||||||
|
|
||||||
$out='';
|
$out = '';
|
||||||
$permok=$user->rights->agenda->myactions->create;
|
$permok = $user->rights->agenda->myactions->create;
|
||||||
if ($permok)
|
if ($permok)
|
||||||
{
|
{
|
||||||
$out.='&projectid='.$object->id;
|
$out .= '&projectid='.$object->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//print '<div class="tabsAction">';
|
//print '<div class="tabsAction">';
|
||||||
$morehtmlcenter='';
|
$morehtmlcenter = '';
|
||||||
if (! empty($conf->agenda->enabled))
|
if (!empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
$addActionBtnRight = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create);
|
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
|
||||||
$morehtmlcenter.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
|
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '</div>';
|
//print '</div>';
|
||||||
|
|||||||
@ -50,56 +50,56 @@ $extrafields = new ExtraFields($db);
|
|||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
if (! is_array($search_array_options)) $search_array_options = array();
|
if (!is_array($search_array_options)) $search_array_options = array();
|
||||||
$search_ref=GETPOST("search_ref");
|
$search_ref = GETPOST("search_ref");
|
||||||
$search_type=GETPOST("search_type");
|
$search_type = GETPOST("search_type");
|
||||||
|
|
||||||
$filter=array();
|
$filter = array();
|
||||||
|
|
||||||
if ($search_ref != ''){
|
if ($search_ref != '') {
|
||||||
$param.='&search_ref='.$search_ref;
|
$param .= '&search_ref='.$search_ref;
|
||||||
$filter['t.ref']=$search_ref;
|
$filter['t.ref'] = $search_ref;
|
||||||
}
|
}
|
||||||
if ($search_type != ''){
|
if ($search_type != '') {
|
||||||
$param.='&search_type='.$search_type;
|
$param .= '&search_type='.$search_type;
|
||||||
$filter['ty.label']=$search_type;
|
$filter['ty.label'] = $search_type;
|
||||||
}
|
}
|
||||||
if ($search_label != '') $param.='&search_label='.$search_label;
|
if ($search_label != '') $param .= '&search_label='.$search_label;
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
{
|
{
|
||||||
$crit=$val;
|
$crit = $val;
|
||||||
$tmpkey=preg_replace('/search_options_/', '', $key);
|
$tmpkey = preg_replace('/search_options_/', '', $key);
|
||||||
$typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey];
|
$typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey];
|
||||||
if ($val != '') {
|
if ($val != '') {
|
||||||
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
$param .= '&search_options_'.$tmpkey.'='.urlencode($val);
|
||||||
}
|
}
|
||||||
$mode_search=0;
|
$mode_search = 0;
|
||||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
if (in_array($typ, array('int', 'double', 'real'))) $mode_search = 1; // Search on a numeric
|
||||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int
|
||||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
|
if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1'))
|
||||||
{
|
{
|
||||||
$filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
$filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||||
|
|
||||||
|
|
||||||
$hookmanager->initHooks(array('resourcelist'));
|
$hookmanager->initHooks(array('resourcelist'));
|
||||||
|
|
||||||
if (empty($sortorder)) $sortorder="ASC";
|
if (empty($sortorder)) $sortorder = "ASC";
|
||||||
if (empty($sortfield)) $sortfield="t.ref";
|
if (empty($sortfield)) $sortfield = "t.ref";
|
||||||
if (empty($arch)) $arch = 0;
|
if (empty($arch)) $arch = 0;
|
||||||
|
|
||||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
if( ! $user->rights->resource->read) {
|
if (!$user->rights->resource->read) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
$arrayfields = array(
|
$arrayfields = array(
|
||||||
@ -115,10 +115,10 @@ $arrayfields = array(
|
|||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
|||||||
@ -27,20 +27,20 @@
|
|||||||
|
|
||||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
|
||||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
|
||||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
|
||||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||||
if (! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
||||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
|
||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||||
|
|
||||||
|
|
||||||
define('ISLOADEDBYSTEELSHEET', '1');
|
define('ISLOADEDBYSTEELSHEET', '1');
|
||||||
|
|
||||||
|
|
||||||
require __DIR__ . '/theme_vars.inc.php';
|
require __DIR__.'/theme_vars.inc.php';
|
||||||
if (defined('THEME_ONLY_CONSTANT')) return;
|
if (defined('THEME_ONLY_CONSTANT')) return;
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|||||||
|
|
||||||
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
|
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
|
||||||
// and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile.
|
// and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile.
|
||||||
if (empty($user->id) && ! empty($_SESSION['dol_login']))
|
if (empty($user->id) && !empty($_SESSION['dol_login']))
|
||||||
{
|
{
|
||||||
$user->fetch('', $_SESSION['dol_login'], '', 1);
|
$user->fetch('', $_SESSION['dol_login'], '', 1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
@ -64,147 +64,147 @@ top_httphead('text/css');
|
|||||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
||||||
else header('Cache-Control: no-cache');
|
else header('Cache-Control: no-cache');
|
||||||
|
|
||||||
if (GETPOST('theme', 'alpha')) $conf->theme=GETPOST('theme', 'alpha'); // If theme was forced on URL
|
if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
|
||||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
||||||
|
|
||||||
$langs->load("main", 0, 1);
|
$langs->load("main", 0, 1);
|
||||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
||||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
|
||||||
|
|
||||||
$path=''; // This value may be used in future for external module to overwrite theme
|
$path = ''; // This value may be used in future for external module to overwrite theme
|
||||||
$theme='eldy'; // Value of theme
|
$theme = 'eldy'; // Value of theme
|
||||||
if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; }
|
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES; }
|
||||||
|
|
||||||
// Define image path files and other constants
|
// Define image path files and other constants
|
||||||
$fontlist='roboto,arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif';
|
$fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif';
|
||||||
//$fontlist='"open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;';
|
//$fontlist='"open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;';
|
||||||
$img_head='';
|
$img_head = '';
|
||||||
$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
||||||
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
$dol_hide_topmenu = $conf->dol_hide_topmenu;
|
||||||
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
$dol_hide_leftmenu = $conf->dol_hide_leftmenu;
|
||||||
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
$dol_optimize_smallscreen = $conf->dol_optimize_smallscreen;
|
||||||
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
$dol_no_mouse_hover = $conf->dol_no_mouse_hover;
|
||||||
|
|
||||||
//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
||||||
//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
||||||
//var_dump($user->conf->THEME_ELDY_RGB);
|
//var_dump($user->conf->THEME_ELDY_RGB);
|
||||||
|
|
||||||
$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:0);
|
$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0);
|
||||||
$borderwidth=1;
|
$borderwidth = 1;
|
||||||
|
|
||||||
// Case of option always editable
|
// Case of option always editable
|
||||||
if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody;
|
if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody;
|
||||||
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1;
|
if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
|
||||||
if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1;
|
if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1;
|
||||||
if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1;
|
if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1;
|
||||||
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover;
|
if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover;
|
||||||
if (! isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED=$colorbacklinepairchecked;
|
if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked;
|
||||||
if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak;
|
if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak;
|
||||||
if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab;
|
if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab;
|
||||||
if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink;
|
if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
|
||||||
|
|
||||||
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||||
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||||
{
|
{
|
||||||
$conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card
|
$conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card
|
||||||
$conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234';
|
$conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234';
|
||||||
$conf->global->THEME_ELDY_TEXT='0,0,0';
|
$conf->global->THEME_ELDY_TEXT = '0,0,0';
|
||||||
$conf->global->THEME_ELDY_FONT_SIZE1=$fontsize;
|
$conf->global->THEME_ELDY_FONT_SIZE1 = $fontsize;
|
||||||
$conf->global->THEME_ELDY_FONT_SIZE2='0.75em';
|
$conf->global->THEME_ELDY_FONT_SIZE2 = '0.75em';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
|
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||||
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
|
$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1);
|
||||||
$colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1);
|
$colorbackvmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $conf->global->THEME_ELDY_VERMENU_BACK1) : (empty($user->conf->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $user->conf->THEME_ELDY_VERMENU_BACK1);
|
||||||
$colortopbordertitle1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$conf->global->THEME_ELDY_TOPBORDER_TITLE1) :(empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$user->conf->THEME_ELDY_TOPBORDER_TITLE1);
|
$colortopbordertitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $conf->global->THEME_ELDY_TOPBORDER_TITLE1) : (empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $user->conf->THEME_ELDY_TOPBORDER_TITLE1);
|
||||||
$colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1);
|
$colorbacktitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $conf->global->THEME_ELDY_BACKTITLE1) : (empty($user->conf->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $user->conf->THEME_ELDY_BACKTITLE1);
|
||||||
$colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1);
|
$colorbacktabcard1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $conf->global->THEME_ELDY_BACKTABCARD1) : (empty($user->conf->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $user->conf->THEME_ELDY_BACKTABCARD1);
|
||||||
$colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE);
|
$colorbacktabactive = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $conf->global->THEME_ELDY_BACKTABACTIVE) : (empty($user->conf->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $user->conf->THEME_ELDY_BACKTABACTIVE);
|
||||||
$colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR1) ?$colorbacklineimpair1:$conf->global->THEME_ELDY_LINEIMPAIR1):(empty($user->conf->THEME_ELDY_LINEIMPAIR1)?$colorbacklineimpair1:$user->conf->THEME_ELDY_LINEIMPAIR1);
|
$colorbacklineimpair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $conf->global->THEME_ELDY_LINEIMPAIR1) : (empty($user->conf->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $user->conf->THEME_ELDY_LINEIMPAIR1);
|
||||||
$colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2);
|
$colorbacklineimpair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $conf->global->THEME_ELDY_LINEIMPAIR2) : (empty($user->conf->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $user->conf->THEME_ELDY_LINEIMPAIR2);
|
||||||
$colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1);
|
$colorbacklinepair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $conf->global->THEME_ELDY_LINEPAIR1) : (empty($user->conf->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $user->conf->THEME_ELDY_LINEPAIR1);
|
||||||
$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2);
|
$colorbacklinepair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $conf->global->THEME_ELDY_LINEPAIR2) : (empty($user->conf->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $user->conf->THEME_ELDY_LINEPAIR2);
|
||||||
$colorbacklinebreak =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEBREAK) ?$colorbacklinebreak:$conf->global->THEME_ELDY_LINEBREAK) :(empty($user->conf->THEME_ELDY_LINEBREAK)?$colorbacklinebreak:$user->conf->THEME_ELDY_LINEBREAK);
|
$colorbacklinebreak = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $conf->global->THEME_ELDY_LINEBREAK) : (empty($user->conf->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $user->conf->THEME_ELDY_LINEBREAK);
|
||||||
$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY);
|
$colorbackbody = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKBODY) ? $colorbackbody : $conf->global->THEME_ELDY_BACKBODY) : (empty($user->conf->THEME_ELDY_BACKBODY) ? $colorbackbody : $user->conf->THEME_ELDY_BACKBODY);
|
||||||
$colortexttitlenotab =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$conf->global->THEME_ELDY_TEXTTITLENOTAB) :(empty($user->conf->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$user->conf->THEME_ELDY_TEXTTITLENOTAB);
|
$colortexttitlenotab = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $conf->global->THEME_ELDY_TEXTTITLENOTAB) : (empty($user->conf->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $user->conf->THEME_ELDY_TEXTTITLENOTAB);
|
||||||
$colortexttitle =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE) ?$colortexttitle:$conf->global->THEME_ELDY_TEXTTITLE) :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE);
|
$colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $conf->global->THEME_ELDY_TEXTTITLE) : (empty($user->conf->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $user->conf->THEME_ELDY_TEXTTITLE);
|
||||||
$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT);
|
$colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXT) ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT);
|
||||||
$colortextlink =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTLINK) ?$colortextlink:$conf->global->THEME_ELDY_TEXTLINK) :(empty($user->conf->THEME_ELDY_TEXTLINK)?$colortextlink:$user->conf->THEME_ELDY_TEXTLINK);
|
$colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTLINK) ? $colortextlink : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK);
|
||||||
$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1);
|
$fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE1) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1);
|
||||||
$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2);
|
$fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE2) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE2) : (empty($user->conf->THEME_ELDY_FONT_SIZE2) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE2);
|
||||||
|
|
||||||
// Hover color
|
// Hover color
|
||||||
$colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'e6edf0':$conf->global->THEME_ELDY_USE_HOVER));
|
$colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_HOVER));
|
||||||
$colorbacklinepairchecked=((! isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255')?'':($conf->global->THEME_ELDY_USE_CHECKED === '1'?'e6edf0':$conf->global->THEME_ELDY_USE_CHECKED));
|
$colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_CHECKED));
|
||||||
if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||||
{
|
{
|
||||||
$colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'e6edf0':$user->conf->THEME_ELDY_USE_HOVER));
|
$colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_HOVER));
|
||||||
$colorbacklinepairchecked=((! isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0')?'':($user->conf->THEME_ELDY_USE_CHECKED === '1'?'e6edf0':$user->conf->THEME_ELDY_USE_CHECKED));
|
$colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0') ? '' : ($user->conf->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set text color to black or white
|
// Set text color to black or white
|
||||||
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
|
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbackhmenu1);
|
$tmppart = explode(',', $colorbackhmenu1);
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
|
if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF';
|
||||||
else $colortextbackhmenu='000000';
|
else $colortextbackhmenu = '000000';
|
||||||
|
|
||||||
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
|
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbackvmenu1);
|
$tmppart = explode(',', $colorbackvmenu1);
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
|
if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; }
|
||||||
else { $colortextbackvmenu='000000'; }
|
else { $colortextbackvmenu = '000000'; }
|
||||||
|
|
||||||
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
|
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbacktitle1);
|
$tmppart = explode(',', $colorbacktitle1);
|
||||||
if ($colortexttitle == '')
|
if ($colortexttitle == '')
|
||||||
{
|
{
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
|
if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; }
|
||||||
else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; }
|
else { $colortexttitle = '000000'; $colorshadowtitle = 'FFFFFF'; }
|
||||||
}
|
}
|
||||||
else $colorshadowtitle='888888';
|
else $colorshadowtitle = '888888';
|
||||||
|
|
||||||
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbacktabcard1);
|
$tmppart = explode(',', $colorbacktabcard1);
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
|
if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; }
|
||||||
else { $colortextbacktab='000000'; }
|
else { $colortextbacktab = '000000'; }
|
||||||
|
|
||||||
|
|
||||||
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
|
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
|
||||||
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1));
|
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1));
|
||||||
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1));
|
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1));
|
||||||
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1));
|
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1));
|
||||||
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1));
|
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1));
|
||||||
$colorbacktabactive=join(',', colorStringToArray($colorbacktabactive));
|
$colorbacktabactive = join(',', colorStringToArray($colorbacktabactive));
|
||||||
$colorbacklineimpair1=join(',', colorStringToArray($colorbacklineimpair1));
|
$colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1));
|
||||||
$colorbacklineimpair2=join(',', colorStringToArray($colorbacklineimpair2));
|
$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2));
|
||||||
$colorbacklinepair1=join(',', colorStringToArray($colorbacklinepair1));
|
$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1));
|
||||||
$colorbacklinepair2=join(',', colorStringToArray($colorbacklinepair2));
|
$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2));
|
||||||
if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',', colorStringToArray($colorbacklinepairhover));
|
if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
|
||||||
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',', colorStringToArray($colorbacklinepairchecked));
|
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
|
||||||
$colorbackbody=join(',', colorStringToArray($colorbackbody));
|
$colorbackbody = join(',', colorStringToArray($colorbackbody));
|
||||||
$colortexttitlenotab=join(',', colorStringToArray($colortexttitlenotab));
|
$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab));
|
||||||
$colortexttitle=join(',', colorStringToArray($colortexttitle));
|
$colortexttitle = join(',', colorStringToArray($colortexttitle));
|
||||||
$colortext=join(',', colorStringToArray($colortext));
|
$colortext = join(',', colorStringToArray($colortext));
|
||||||
$colortextlink=join(',', colorStringToArray($colortextlink));
|
$colortextlink = join(',', colorStringToArray($colortextlink));
|
||||||
|
|
||||||
$nbtopmenuentries=$menumanager->showmenu('topnb');
|
$nbtopmenuentries = $menumanager->showmenu('topnb');
|
||||||
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
|
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
|
||||||
|
|
||||||
|
|
||||||
$minwidthtmenu=66; /* minimum width for one top menu entry */
|
$minwidthtmenu = 66; /* minimum width for one top menu entry */
|
||||||
$heightmenu=48; /* height of top menu, part with image */
|
$heightmenu = 48; /* height of top menu, part with image */
|
||||||
$heightmenu2=49; /* height of top menu, part with login */
|
$heightmenu2 = 49; /* height of top menu, part with login */
|
||||||
$disableimages = 0;
|
$disableimages = 0;
|
||||||
$maxwidthloginblock = 180;
|
$maxwidthloginblock = 180;
|
||||||
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu=0; }
|
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; }
|
||||||
|
|
||||||
|
|
||||||
if(!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)){ $maxwidthloginblock = $maxwidthloginblock + 55; }
|
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
|
||||||
if(! empty($conf->bookmark->enabled) && !empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
|
if (!empty($conf->bookmark->enabled) && !empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
|
||||||
|
|
||||||
|
|
||||||
print '/*'."\n";
|
print '/*'."\n";
|
||||||
@ -241,7 +241,7 @@ print '*/'."\n";
|
|||||||
|
|
||||||
|
|
||||||
// Include the global.inc.php that include the badges, btn, info-box, dropdown, progress...
|
// Include the global.inc.php that include the badges, btn, info-box, dropdown, progress...
|
||||||
require __DIR__ . '/global.inc.php';
|
require __DIR__.'/global.inc.php';
|
||||||
|
|
||||||
|
|
||||||
if (is_object($db)) $db->close();
|
if (is_object($db)) $db->close();
|
||||||
|
|||||||
@ -27,77 +27,77 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
|
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
|
||||||
$theme_bordercolor = array(235,235,224);
|
$theme_bordercolor = array(235, 235, 224);
|
||||||
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
|
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||||
if (! defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
|
if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
|
||||||
{
|
{
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php
|
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php
|
||||||
{
|
{
|
||||||
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
|
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
|
||||||
{
|
{
|
||||||
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0, 166, 90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
|
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// for now we use the same configuration for all types of color blind
|
// for now we use the same configuration for all types of color blind
|
||||||
$theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85,135,150), array(150,135,80), array(150,80,150));
|
$theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4'));
|
$theme_bgcolor = array(hexdec('F4'), hexdec('F4'), hexdec('F4'));
|
||||||
$theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC'));
|
$theme_bgcoloronglet = array(hexdec('DE'), hexdec('E7'), hexdec('EC'));
|
||||||
|
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
$colorbackhmenu1='90,50,120'; // topmenu
|
$colorbackhmenu1 = '90,50,120'; // topmenu
|
||||||
$colorbackvmenu1='255,255,255'; // vmenu
|
$colorbackvmenu1 = '255,255,255'; // vmenu
|
||||||
$colortopbordertitle1=''; // top border of tables-lists title. not defined = default to colorbackhmenu1
|
$colortopbordertitle1 = ''; // top border of tables-lists title. not defined = default to colorbackhmenu1
|
||||||
$colorbacktitle1='240,240,240'; // title of tables-lists
|
$colorbacktitle1 = '240,240,240'; // title of tables-lists
|
||||||
$colorbacktabcard1='255,255,255'; // card
|
$colorbacktabcard1 = '255,255,255'; // card
|
||||||
$colorbacktabactive='234,234,234';
|
$colorbacktabactive = '234,234,234';
|
||||||
$colorbacklineimpair1='255,255,255'; // line impair
|
$colorbacklineimpair1 = '255,255,255'; // line impair
|
||||||
$colorbacklineimpair2='255,255,255'; // line impair
|
$colorbacklineimpair2 = '255,255,255'; // line impair
|
||||||
$colorbacklinepair1='248,248,248'; // line pair
|
$colorbacklinepair1 = '248,248,248'; // line pair
|
||||||
$colorbacklinepair2='246,246,246'; // line pair
|
$colorbacklinepair2 = '246,246,246'; // line pair
|
||||||
$colorbacklinepairhover='230,237,244'; // line hover
|
$colorbacklinepairhover = '230,237,244'; // line hover
|
||||||
$colorbacklinepairchecked='230,237,244'; // line checked
|
$colorbacklinepairchecked = '230,237,244'; // line checked
|
||||||
$colorbacklinebreak='214,218,220';
|
$colorbacklinebreak = '214,218,220';
|
||||||
$colorbackbody='248,248,248';
|
$colorbackbody = '248,248,248';
|
||||||
$colortexttitlenotab='90,90,90';
|
$colortexttitlenotab = '90,90,90';
|
||||||
$colortexttitle='20,20,20';
|
$colortexttitle = '20,20,20';
|
||||||
$colortext='0,0,0';
|
$colortext = '0,0,0';
|
||||||
$colortextlink='0,0,120';
|
$colortextlink = '0,0,120';
|
||||||
$fontsize = '14';
|
$fontsize = '14';
|
||||||
$fontsizesmaller='11';
|
$fontsizesmaller = '11';
|
||||||
|
|
||||||
// text color
|
// text color
|
||||||
$textSuccess ='#28a745';
|
$textSuccess = '#28a745';
|
||||||
$colorblind_deuteranopes_textSuccess ='#37de5d';
|
$colorblind_deuteranopes_textSuccess = '#37de5d';
|
||||||
$textDanger ='#dc3545';
|
$textDanger = '#dc3545';
|
||||||
$textWarning ='#f39c12';
|
$textWarning = '#f39c12';
|
||||||
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
|
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
|
||||||
|
|
||||||
// Badges colors
|
// Badges colors
|
||||||
$badgePrimary ='#007bff';
|
$badgePrimary = '#007bff';
|
||||||
$badgeSecondary ='#999999';
|
$badgeSecondary = '#999999';
|
||||||
$badgeSuccess ='#28a745';
|
$badgeSuccess = '#28a745';
|
||||||
$badgeDanger ='#8c4446';
|
$badgeDanger = '#8c4446';
|
||||||
$badgeWarning ='#ffc107';
|
$badgeWarning = '#ffc107';
|
||||||
$badgeInfo ='#17a2b8';
|
$badgeInfo = '#17a2b8';
|
||||||
$badgeDark ='#343a40';
|
$badgeDark = '#343a40';
|
||||||
$badgeLight ='#f8f9fa';
|
$badgeLight = '#f8f9fa';
|
||||||
|
|
||||||
/* default color for status : After a quick check, somme status can have oposite function according to objects
|
/* default color for status : After a quick check, somme status can have oposite function according to objects
|
||||||
* So this badges status uses default value according to theme eldy status img
|
* So this badges status uses default value according to theme eldy status img
|
||||||
* TODO: use color definition vars above for define badges color status X -> expemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive ....
|
* TODO: use color definition vars above for define badges color status X -> expemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive ....
|
||||||
*/
|
*/
|
||||||
$badgeStatus0='#cbd3d3';
|
$badgeStatus0 = '#cbd3d3';
|
||||||
$badgeStatus1='#bc9526';
|
$badgeStatus1 = '#bc9526';
|
||||||
$badgeStatus2='#e6f0f0';
|
$badgeStatus2 = '#e6f0f0';
|
||||||
$badgeStatus3='#bca52b';
|
$badgeStatus3 = '#bca52b';
|
||||||
$badgeStatus4='#277d1e';
|
$badgeStatus4 = '#277d1e';
|
||||||
$badgeStatus5='#cad2d2';
|
$badgeStatus5 = '#cad2d2';
|
||||||
$badgeStatus6='#cad2d2';
|
$badgeStatus6 = '#cad2d2';
|
||||||
$badgeStatus7='#baa32b';
|
$badgeStatus7 = '#baa32b';
|
||||||
$badgeStatus8='#be3013';
|
$badgeStatus8 = '#be3013';
|
||||||
$badgeStatus9='#e7f0f0';
|
$badgeStatus9 = '#e7f0f0';
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
// Protection to avoid direct call of template
|
// Protection to avoid direct call of template
|
||||||
if (empty($conf) || ! is_object($conf))
|
if (empty($conf) || !is_object($conf))
|
||||||
{
|
{
|
||||||
print "Error, template page can't be called as URL";
|
print "Error, template page can't be called as URL";
|
||||||
exit;
|
exit;
|
||||||
@ -36,18 +36,18 @@ $langs->load('ticket');
|
|||||||
|
|
||||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'datec', 'desc', 0, 0, 1);
|
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'datec', 'desc', 0, 0, 1);
|
||||||
|
|
||||||
$total=0;
|
$total = 0;
|
||||||
$ilink=0;
|
$ilink = 0;
|
||||||
foreach($linkedObjectBlock as $key => $objectlink)
|
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||||
{
|
{
|
||||||
$ilink++;
|
$ilink++;
|
||||||
|
|
||||||
$trclass='oddeven';
|
$trclass = 'oddeven';
|
||||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $trclass; ?>" >
|
<tr class="<?php echo $trclass; ?>" >
|
||||||
<td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?>
|
<td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?>
|
||||||
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
|
<?php if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||||
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
|
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||||
@ -61,7 +61,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
<td class="linkedcol-action right">
|
<td class="linkedcol-action right">
|
||||||
<?php
|
<?php
|
||||||
// For now, shipments must stay linked to order, so link is not deletable
|
// For now, shipments must stay linked to order, so link is not deletable
|
||||||
if($object->element != 'shipping') {
|
if ($object->element != 'shipping') {
|
||||||
?>
|
?>
|
||||||
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
|
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
|
||||||
<?php
|
<?php
|
||||||
@ -74,7 +74,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
if (count($linkedObjectBlock) > 1)
|
if (count($linkedObjectBlock) > 1)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
|
||||||
<td><?php echo $langs->trans("Total"); ?></td>
|
<td><?php echo $langs->trans("Total"); ?></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td align="center"></td>
|
<td align="center"></td>
|
||||||
|
|||||||
@ -34,42 +34,42 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|||||||
// Load translation files required by page
|
// Load translation files required by page
|
||||||
$langs->loadLangs(array('users', 'other'));
|
$langs->loadLangs(array('users', 'other'));
|
||||||
|
|
||||||
$action=GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm = GETPOST('confirm');
|
||||||
$id=(GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('id', 'int'));
|
$id = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('id', 'int'));
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userdoc'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userdoc'; // To manage different context of search
|
||||||
|
|
||||||
// Define value to know what current user can do on users
|
// Define value to know what current user can do on users
|
||||||
$canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
|
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||||
$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire);
|
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
|
||||||
$canedituser=(! empty($user->admin) || $user->rights->user->user->creer);
|
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||||
$candisableuser=(! empty($user->admin) || $user->rights->user->user->supprimer);
|
$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
|
||||||
$canreadgroup=$canreaduser;
|
$canreadgroup = $canreaduser;
|
||||||
$caneditgroup=$canedituser;
|
$caneditgroup = $canedituser;
|
||||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||||
{
|
{
|
||||||
$canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read);
|
$canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
|
||||||
$caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write);
|
$caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
|
||||||
}
|
}
|
||||||
// Define value to know what current user can do on properties of edited user
|
// Define value to know what current user can do on properties of edited user
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
// $user est le user qui edite, $id est l'id de l'utilisateur edite
|
// $user est le user qui edite, $id est l'id de l'utilisateur edite
|
||||||
$caneditfield=((($user->id == $id) && $user->rights->user->self->creer)
|
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|
||||||
|| (($user->id != $id) && $user->rights->user->user->creer));
|
|| (($user->id != $id) && $user->rights->user->user->creer));
|
||||||
$caneditpassword=((($user->id == $id) && $user->rights->user->self->password)
|
$caneditpassword = ((($user->id == $id) && $user->rights->user->self->password)
|
||||||
|| (($user->id != $id) && $user->rights->user->user->password));
|
|| (($user->id != $id) && $user->rights->user->user->password));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid = 0;
|
||||||
if ($user->socid > 0) $socid = $user->socid;
|
if ($user->socid > 0) $socid = $user->socid;
|
||||||
$feature2='user';
|
$feature2 = 'user';
|
||||||
|
|
||||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||||
|
|
||||||
if ($user->id <> $id && ! $canreaduser) accessforbidden();
|
if ($user->id <> $id && !$canreaduser) accessforbidden();
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
@ -79,29 +79,29 @@ if (empty($page) || $page == -1) { $page = 0; }
|
|||||||
$offset = $conf->liste_limit * $page;
|
$offset = $conf->liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (!$sortorder) $sortorder = "ASC";
|
||||||
if (! $sortfield) $sortfield="position_name";
|
if (!$sortfield) $sortfield = "position_name";
|
||||||
|
|
||||||
$object = new User($db);
|
$object = new User($db);
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || !empty($ref))
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id, $ref, '', 1);
|
$result = $object->fetch($id, $ref, '', 1);
|
||||||
$object->getrights();
|
$object->getrights();
|
||||||
//$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ;
|
//$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ;
|
||||||
// For users, the upload_dir is always $conf->user->entity for the moment
|
// For users, the upload_dir is always $conf->user->entity for the moment
|
||||||
$upload_dir = $conf->user->dir_output. "/" . $object->id ;
|
$upload_dir = $conf->user->dir_output."/".$object->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('usercard','userdoc','globalcard'));
|
$hookmanager->initHooks(array('usercard', 'userdoc', 'globalcard'));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$parameters=array('id'=>$socid);
|
$parameters = array('id'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
@ -122,10 +122,10 @@ if ($object->id)
|
|||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
||||||
$head = user_prepare_head($object);
|
$head = user_prepare_head($object);
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
dol_fiche_head($head, 'document', $langs->trans("User"), -1, 'user');
|
dol_fiche_head($head, 'document', $langs->trans("User"), -1, 'user');
|
||||||
|
|
||||||
@ -140,11 +140,11 @@ if ($object->id)
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
// Build file list
|
// Build file list
|
||||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
|
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||||
$totalsize=0;
|
$totalsize = 0;
|
||||||
foreach($filearray as $key => $file)
|
foreach ($filearray as $key => $file)
|
||||||
{
|
{
|
||||||
$totalsize+=$file['size'];
|
$totalsize += $file['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ if ($object->id)
|
|||||||
$modulepart = 'user';
|
$modulepart = 'user';
|
||||||
$permission = $user->rights->user->user->creer;
|
$permission = $user->rights->user->user->creer;
|
||||||
$permtoedit = $user->rights->user->user->creer;
|
$permtoedit = $user->rights->user->user->creer;
|
||||||
$param = '&id=' . $object->id;
|
$param = '&id='.$object->id;
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -495,6 +495,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
|||||||
* [...]
|
* [...]
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
|
* @param User $user Object user
|
||||||
* @param Product $product Parent product
|
* @param Product $product Parent product
|
||||||
* @param array $combinations Attribute and value combinations.
|
* @param array $combinations Attribute and value combinations.
|
||||||
* @param array $variations Price and weight variations
|
* @param array $variations Price and weight variations
|
||||||
@ -503,9 +504,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
|||||||
* @param bool|float $forced_weightvar If the weight variation is forced
|
* @param bool|float $forced_weightvar If the weight variation is forced
|
||||||
* @return int <0 KO, >0 OK
|
* @return int <0 KO, >0 OK
|
||||||
*/
|
*/
|
||||||
public function createProductCombination(Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false)
|
public function createProductCombination(User $user, Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false)
|
||||||
{
|
{
|
||||||
global $db, $user, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
|
||||||
@ -660,11 +661,12 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
|||||||
/**
|
/**
|
||||||
* Copies all product combinations from the origin product to the destination product
|
* Copies all product combinations from the origin product to the destination product
|
||||||
*
|
*
|
||||||
|
* @param User $user Object user
|
||||||
* @param int $origProductId Origin product id
|
* @param int $origProductId Origin product id
|
||||||
* @param Product $destProduct Destination product
|
* @param Product $destProduct Destination product
|
||||||
* @return int >0 OK <0 KO
|
* @return int >0 OK <0 KO
|
||||||
*/
|
*/
|
||||||
public function copyAll($origProductId, Product $destProduct)
|
public function copyAll(User $user, $origProductId, Product $destProduct)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
|
||||||
|
|
||||||
@ -686,6 +688,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->createProductCombination(
|
if ($this->createProductCombination(
|
||||||
|
$user,
|
||||||
$destProduct,
|
$destProduct,
|
||||||
$variations,
|
$variations,
|
||||||
array(),
|
array(),
|
||||||
|
|||||||
@ -141,7 +141,7 @@ if ($_POST) {
|
|||||||
|
|
||||||
if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features))
|
if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features))
|
||||||
{
|
{
|
||||||
$result = $prodcomb->createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact);
|
$result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
@ -268,7 +268,7 @@ if ($action === 'confirm_deletecombination') {
|
|||||||
if ($prodstatic->fetch('', $dest_product) > 0) {
|
if ($prodstatic->fetch('', $dest_product) > 0) {
|
||||||
//To prevent from copying to the same product
|
//To prevent from copying to the same product
|
||||||
if ($prodstatic->ref != $object->ref) {
|
if ($prodstatic->ref != $object->ref) {
|
||||||
if ($prodcomb->copyAll($object->id, $prodstatic) > 0) {
|
if ($prodcomb->copyAll($user, $object->id, $prodstatic) > 0) {
|
||||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
|
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -110,7 +110,7 @@ if ($_POST)
|
|||||||
$cartesianarray = cartesianArray($adapted_values);
|
$cartesianarray = cartesianArray($adapted_values);
|
||||||
foreach ($cartesianarray as $currcomb)
|
foreach ($cartesianarray as $currcomb)
|
||||||
{
|
{
|
||||||
$res = $combination->createProductCombination($product, $currcomb, $sanitized_values, $price_var_percent);
|
$res = $combination->createProductCombination($user, $product, $currcomb, $sanitized_values, $price_var_percent);
|
||||||
if ($res < 0) {
|
if ($res < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($combination->error, $combination->errors, 'errors');
|
setEventMessages($combination->error, $combination->errors, 'errors');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user