Fix: strict mode... far away
This commit is contained in:
parent
812d02ebe0
commit
c6cd17cf3f
@ -1084,21 +1084,28 @@ class Categorie
|
|||||||
*/
|
*/
|
||||||
function get_all_ways ()
|
function get_all_ways ()
|
||||||
{
|
{
|
||||||
$ways = array ();
|
$ways = array();
|
||||||
|
|
||||||
foreach ($this->get_meres() as $mere)
|
$parents=$this->get_meres();
|
||||||
|
if (! empty($parents))
|
||||||
{
|
{
|
||||||
foreach ($mere->get_all_ways() as $way)
|
foreach ($parents as $parent)
|
||||||
{
|
{
|
||||||
$w = $way;
|
$allways=$parent->get_all_ways();
|
||||||
$w[] = $this;
|
if (! empty($allways))
|
||||||
|
{
|
||||||
$ways[] = $w;
|
foreach ($allways as $way)
|
||||||
|
{
|
||||||
|
$w = $way;
|
||||||
|
$w[] = $this;
|
||||||
|
$ways[] = $w;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (count($ways) == 0)
|
if (count($ways) == 0)
|
||||||
$ways[0][0] = $this;
|
$ways[0][0] = $this;
|
||||||
|
}
|
||||||
|
|
||||||
return $ways;
|
return $ways;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2055,7 +2055,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (count($this->array_options) > 0)
|
if (! empty($this->array_options))
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
$langs->load('admin');
|
$langs->load('admin');
|
||||||
|
|||||||
@ -700,7 +700,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
if (!$this->db->query($sql2)) return -1;
|
if (!$this->db->query($sql2)) return -1;
|
||||||
}
|
}
|
||||||
else
|
else if (isset($this->multilangs["$key"]))
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result)) // si aucune ligne dans la base
|
if ($this->db->num_rows($result)) // si aucune ligne dans la base
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,23 +34,24 @@ require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/extrafields.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/extrafields.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
||||||
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
if (! empty($conf->propal->enabled)) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||||
if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
if (! empty($conf->facture->enabled)) require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||||
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
if ($conf->stock->enabled) $langs->load("stocks");
|
if (! empty($conf->stock->enabled)) $langs->load("stocks");
|
||||||
if ($conf->facture->enabled) $langs->load("bills");
|
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||||
|
|
||||||
$mesg=''; $error=0; $errors=array();
|
$mesg=''; $error=0; $errors=array(); $_error=0;
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id=GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref=GETPOST('ref', 'alpha');
|
||||||
|
$type=GETPOST('type','int');
|
||||||
$action=(GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view');
|
$action=(GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$socid=GETPOST('socid','int');
|
$socid=GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
|
|
||||||
$object = new Product($db);
|
$object = new Product($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
@ -58,6 +59,7 @@ $extrafields = new ExtraFields($db);
|
|||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
$object->getCanvas($id,$ref);
|
$object->getCanvas($id,$ref);
|
||||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||||
|
$objcanvas='';
|
||||||
if (! empty($canvas))
|
if (! empty($canvas))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||||
@ -91,7 +93,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setfk_product_type' && $user->rights->produit->creer)
|
if ($action == 'setfk_product_type' && $user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setValueFrom('fk_product_type', $_POST['fk_product_type']);
|
$result = $object->setValueFrom('fk_product_type', GETPOST('fk_product_type'));
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -100,7 +102,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setfk_barcode_type' && $user->rights->barcode->creer)
|
if ($action == 'setfk_barcode_type' && $user->rights->barcode->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setValueFrom('fk_barcode_type', $_POST['fk_barcode_type']);
|
$result = $object->setValueFrom('fk_barcode_type', GETPOST('fk_barcode_type'));
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -110,7 +112,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
//Todo: ajout verification de la validite du code barre en fonction du type
|
//Todo: ajout verification de la validite du code barre en fonction du type
|
||||||
$result = $object->setValueFrom('barcode', $_POST['barcode']);
|
$result = $object->setValueFrom('barcode', GETPOST('barcode'));
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -118,7 +120,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setaccountancy_code_buy')
|
if ($action == 'setaccountancy_code_buy')
|
||||||
{
|
{
|
||||||
$object->fetch($id,$ref);
|
$object->fetch($id,$ref);
|
||||||
$result = $object->setValueFrom('accountancy_code_buy', $_POST['accountancy_code_buy']);
|
$result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg=join(',',$object->errors);
|
$mesg=join(',',$object->errors);
|
||||||
@ -129,7 +131,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setaccountancy_code_sell')
|
if ($action == 'setaccountancy_code_sell')
|
||||||
{
|
{
|
||||||
$object->fetch($id,$ref);
|
$object->fetch($id,$ref);
|
||||||
$result = $object->setValueFrom('accountancy_code_sell', $_POST['accountancy_code_sell']);
|
$result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg=join(',',$object->errors);
|
$mesg=join(',',$object->errors);
|
||||||
@ -142,63 +144,59 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (empty($_POST["libelle"]))
|
if (GETPOST('libelle'))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'</div>';
|
||||||
$action = "create";
|
$action = "create";
|
||||||
$_GET["canvas"] = $_POST["canvas"];
|
|
||||||
$_GET["type"] = $_POST["type"];
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($ref))
|
if (empty($ref))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'</div>';
|
||||||
$action = "create";
|
$action = "create";
|
||||||
$_GET["canvas"] = $_POST["canvas"];
|
|
||||||
$_GET["type"] = $_POST["type"];
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->ref = $ref;
|
$object->ref = $ref;
|
||||||
$object->libelle = $_POST["libelle"];
|
$object->libelle = GETPOST('libelle');
|
||||||
$object->price_base_type = $_POST["price_base_type"];
|
$object->price_base_type = GETPOST('price_base_type');
|
||||||
if ($object->price_base_type == 'TTC') $object->price_ttc = $_POST["price"];
|
if ($object->price_base_type == 'TTC') $object->price_ttc = GETPOST('price');
|
||||||
else $object->price = $_POST["price"];
|
else $object->price = GETPOST('price');
|
||||||
if ($object->price_base_type == 'TTC') $object->price_min_ttc = $_POST["price_min"];
|
if ($object->price_base_type == 'TTC') $object->price_min_ttc = GETPOST('price_min');
|
||||||
else $object->price_min = $_POST["price_min"];
|
else $object->price_min = GETPOST('price_min');
|
||||||
$object->tva_tx = str_replace('*','',$_POST['tva_tx']);
|
$object->tva_tx = str_replace('*','',GETPOST('tva_tx'));
|
||||||
$object->tva_npr = preg_match('/\*/',$_POST['tva_tx'])?1:0;
|
$object->tva_npr = preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
||||||
|
|
||||||
// local taxes.
|
// local taxes.
|
||||||
$object->localtax1_tx = get_localtax($object->tva_tx,1);
|
$object->localtax1_tx = get_localtax($object->tva_tx,1);
|
||||||
$object->localtax2_tx = get_localtax($object->tva_tx,2);
|
$object->localtax2_tx = get_localtax($object->tva_tx,2);
|
||||||
|
|
||||||
$object->type = $_POST["type"];
|
$object->type = $type;
|
||||||
$object->status = $_POST["statut"];
|
$object->status = GETPOST('statut');
|
||||||
$object->status_buy = $_POST["statut_buy"];
|
$object->status_buy = GETPOST('statut_buy');
|
||||||
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
|
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
|
||||||
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
$object->note = dol_htmlcleanlastbr(GETPOST('note'));
|
||||||
$object->customcode = $_POST["customcode"];
|
$object->customcode = GETPOST('customcode');
|
||||||
$object->country_id = $_POST["country_id"];
|
$object->country_id = GETPOST('country_id');
|
||||||
$object->duration_value = $_POST["duration_value"];
|
$object->duration_value = GETPOST('duration_value');
|
||||||
$object->duration_unit = $_POST["duration_unit"];
|
$object->duration_unit = GETPOST('duration_unit');
|
||||||
$object->seuil_stock_alerte = $_POST["seuil_stock_alerte"]?$_POST["seuil_stock_alerte"]:0;
|
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0;
|
||||||
$object->canvas = $_POST["canvas"];
|
$object->canvas = GETPOST('canvas');
|
||||||
$object->weight = $_POST["weight"];
|
$object->weight = GETPOST('weight');
|
||||||
$object->weight_units = $_POST["weight_units"];
|
$object->weight_units = GETPOST('weight_units');
|
||||||
$object->length = $_POST["size"];
|
$object->length = GETPOST('size');
|
||||||
$object->length_units = $_POST["size_units"];
|
$object->length_units = GETPOST('size_units');
|
||||||
$object->surface = $_POST["surface"];
|
$object->surface = GETPOST('surface');
|
||||||
$object->surface_units = $_POST["surface_units"];
|
$object->surface_units = GETPOST('surface_units');
|
||||||
$object->volume = $_POST["volume"];
|
$object->volume = GETPOST('volume');
|
||||||
$object->volume_units = $_POST["volume_units"];
|
$object->volume_units = GETPOST('volume_units');
|
||||||
$object->finished = $_POST["finished"];
|
$object->finished = GETPOST('finished');
|
||||||
$object->hidden = $_POST["hidden"]=='yes'?1:0;
|
$object->hidden = GETPOST('hidden')=='yes'?1:0;
|
||||||
|
|
||||||
// MultiPrix
|
// MultiPrix
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
{
|
{
|
||||||
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
{
|
{
|
||||||
@ -234,7 +232,6 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
||||||
$action = "create";
|
$action = "create";
|
||||||
$_GET["type"] = $_POST["type"];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,7 +239,7 @@ if (empty($reshook))
|
|||||||
// Update a product or service
|
// Update a product or service
|
||||||
if ($action == 'update' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'update' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
if (! empty($_POST["cancel"]))
|
if (GETPOST('cancel'))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -253,27 +250,27 @@ if (empty($reshook))
|
|||||||
$object->oldcopy=dol_clone($object);
|
$object->oldcopy=dol_clone($object);
|
||||||
|
|
||||||
$object->ref = $ref;
|
$object->ref = $ref;
|
||||||
$object->libelle = $_POST["libelle"];
|
$object->libelle = GETPOST('libelle');
|
||||||
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
|
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
|
||||||
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
$object->note = dol_htmlcleanlastbr(GETPOST('note'));
|
||||||
$object->customcode = $_POST["customcode"];
|
$object->customcode = GETPOST('customcode');
|
||||||
$object->country_id = $_POST["country_id"];
|
$object->country_id = GETPOST('country_id');
|
||||||
$object->status = $_POST["statut"];
|
$object->status = GETPOST('statut');
|
||||||
$object->status_buy = $_POST["statut_buy"];
|
$object->status_buy = GETPOST('statut_buy');
|
||||||
$object->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
|
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
||||||
$object->duration_value = $_POST["duration_value"];
|
$object->duration_value = GETPOST('duration_value');
|
||||||
$object->duration_unit = $_POST["duration_unit"];
|
$object->duration_unit = GETPOST('duration_unit');
|
||||||
$object->canvas = $_POST["canvas"];
|
$object->canvas = GETPOST('canvas');
|
||||||
$object->weight = $_POST["weight"];
|
$object->weight = GETPOST('weight');
|
||||||
$object->weight_units = $_POST["weight_units"];
|
$object->weight_units = GETPOST('weight_units');
|
||||||
$object->length = $_POST["size"];
|
$object->length = GETPOST('size');
|
||||||
$object->length_units = $_POST["size_units"];
|
$object->length_units = GETPOST('size_units');
|
||||||
$object->surface = $_POST["surface"];
|
$object->surface = GETPOST('surface');
|
||||||
$object->surface_units = $_POST["surface_units"];
|
$object->surface_units = GETPOST('surface_units');
|
||||||
$object->volume = $_POST["volume"];
|
$object->volume = GETPOST('volume');
|
||||||
$object->volume_units = $_POST["volume_units"];
|
$object->volume_units = GETPOST('volume_units');
|
||||||
$object->finished = $_POST["finished"];
|
$object->finished = GETPOST('finished');
|
||||||
$object->hidden = $_POST["hidden"]=='yes'?1:0;
|
$object->hidden = GETPOST('hidden')=='yes'?1:0;
|
||||||
|
|
||||||
// Get extra fields
|
// Get extra fields
|
||||||
foreach($_POST as $key => $value)
|
foreach($_POST as $key => $value)
|
||||||
@ -348,7 +345,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
$_error = 1;
|
$_error++;
|
||||||
$action = "";
|
$action = "";
|
||||||
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorProductAlreadyExists",$object->ref);
|
$mesg='<div class="error">'.$langs->trans("ErrorProductAlreadyExists",$object->ref);
|
||||||
@ -403,7 +400,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'addinpropal')
|
if ($action == 'addinpropal')
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$result=$propal->fetch($_POST["propalid"]);
|
$result=$propal->fetch(GETPOST('propalid'));
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$propal->error);
|
dol_print_error($db,$propal->error);
|
||||||
@ -462,12 +459,12 @@ if (empty($reshook))
|
|||||||
$propal->id,
|
$propal->id,
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
$_POST["qty"],
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx, // localtax1
|
$localtax1_tx, // localtax1
|
||||||
$localtax2_tx, // localtax2
|
$localtax2_tx, // localtax2
|
||||||
$prod->id,
|
$prod->id,
|
||||||
$_POST["remise_percent"],
|
GETPOST('remise_percent'),
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
$pu_ttc
|
$pu_ttc
|
||||||
);
|
);
|
||||||
@ -484,7 +481,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'addincommande')
|
if ($action == 'addincommande')
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
$result=$commande->fetch($_POST["commandeid"]);
|
$result=$commande->fetch(GETPOST('commandeid'));
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$commande->error);
|
dol_print_error($db,$commande->error);
|
||||||
@ -544,12 +541,12 @@ if (empty($reshook))
|
|||||||
$commande->id,
|
$commande->id,
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
$_POST["qty"],
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx, // localtax1
|
$localtax1_tx, // localtax1
|
||||||
$localtax2_tx, // localtax2
|
$localtax2_tx, // localtax2
|
||||||
$prod->id,
|
$prod->id,
|
||||||
$_POST["remise_percent"],
|
GETPOST('remise_percent'),
|
||||||
'',
|
'',
|
||||||
'', // TODO voir si fk_remise_except est encore valable car n'apparait plus dans les propales
|
'', // TODO voir si fk_remise_except est encore valable car n'apparait plus dans les propales
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
@ -567,7 +564,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'addinfacture' && $user->rights->facture->creer)
|
if ($action == 'addinfacture' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$facture = New Facture($db);
|
$facture = New Facture($db);
|
||||||
$result=$facture->fetch($_POST["factureid"]);
|
$result=$facture->fetch(GETPOST('factureid'));
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$facture->error);
|
dol_print_error($db,$facture->error);
|
||||||
@ -626,12 +623,12 @@ if (empty($reshook))
|
|||||||
$facture->id,
|
$facture->id,
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
$_POST["qty"],
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx,
|
$localtax1_tx,
|
||||||
$localtax2_tx,
|
$localtax2_tx,
|
||||||
$prod->id,
|
$prod->id,
|
||||||
$_POST["remise_percent"],
|
GETPOST('remise_percent'),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@ -697,9 +694,9 @@ else
|
|||||||
print '<form action="fiche.php" method="post">';
|
print '<form action="fiche.php" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="type" value="'.$_GET["type"].'">'."\n";
|
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
||||||
|
|
||||||
if ($_GET["type"]==1) $title=$langs->trans("NewService");
|
if ($type==1) $title=$langs->trans("NewService");
|
||||||
else $title=$langs->trans("NewProduct");
|
else $title=$langs->trans("NewProduct");
|
||||||
print_fiche_titre($title);
|
print_fiche_titre($title);
|
||||||
|
|
||||||
@ -708,32 +705,32 @@ else
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$ref.'">';
|
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$ref.'">';
|
||||||
if ($_error == 1)
|
if ($_error)
|
||||||
{
|
{
|
||||||
print $langs->trans("RefAlreadyExists");
|
print $langs->trans("RefAlreadyExists");
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$_POST["libelle"].'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.GETPOST('libelle').'"></td></tr>';
|
||||||
|
|
||||||
// On sell
|
// On sell
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||||
print $form->selectarray('statut',$statutarray,$_POST["statut"]);
|
print $form->selectarray('statut',$statutarray,GETPOST('statut'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// To buy
|
// To buy
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||||
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
||||||
print $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
|
print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy"'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Stock min level
|
// Stock min level
|
||||||
if ($_GET["type"] != 1 && $conf->stock->enabled)
|
if ($type != 1 && $conf->stock->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
||||||
print '<input name="seuil_stock_alerte" size="4" value="'.$_POST["seuil_stock_alerte"].'">';
|
print '<input name="seuil_stock_alerte" size="4" value="'.GETPOST('seuil_stock_alerte').'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -745,24 +742,24 @@ else
|
|||||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('desc',$_POST["desc"],'',160,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90);
|
$doleditor=new DolEditor('desc',GETPOST('desc'),'',160,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Nature
|
// Nature
|
||||||
if ($_GET["type"] != 1)
|
if ($type != 1)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
|
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
|
||||||
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||||
print $form->selectarray('finished',$statutarray,$_POST["finished"]);
|
print $form->selectarray('finished',$statutarray,GETPOST('finished'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if ($_GET["type"] == 1)
|
if ($type == 1)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Duration").'</td><td><input name="duration_value" size="6" maxlength="5" value="'.$object->duree.'"> ';
|
print '<tr><td>'.$langs->trans("Duration").'</td><td><input name="duration_value" size="6" maxlength="5" value="'.GETPOST('duration_value').'"> ';
|
||||||
print '<input name="duration_unit" type="radio" value="h">'.$langs->trans("Hour").' ';
|
print '<input name="duration_unit" type="radio" value="h">'.$langs->trans("Hour").' ';
|
||||||
print '<input name="duration_unit" type="radio" value="d">'.$langs->trans("Day").' ';
|
print '<input name="duration_unit" type="radio" value="d">'.$langs->trans("Day").' ';
|
||||||
print '<input name="duration_unit" type="radio" value="w">'.$langs->trans("Week").' ';
|
print '<input name="duration_unit" type="radio" value="w">'.$langs->trans("Week").' ';
|
||||||
@ -771,36 +768,36 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["type"] != 1) // Le poids et le volume ne concerne que les produits et pas les services
|
if ($type != 1) // Le poids et le volume ne concerne que les produits et pas les services
|
||||||
{
|
{
|
||||||
// Weight
|
// Weight
|
||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
print '<input name="weight" size="4" value="'.$_POST["weight"].'">';
|
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
|
||||||
print $formproduct->select_measuring_units("weight_units","weight");
|
print $formproduct->select_measuring_units("weight_units","weight");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// Length
|
// Length
|
||||||
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
||||||
print '<input name="size" size="4" value="'.$_POST["size"].'">';
|
print '<input name="size" size="4" value="'.GETPOST('size').'">';
|
||||||
print $formproduct->select_measuring_units("size_units","size");
|
print $formproduct->select_measuring_units("size_units","size");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// Surface
|
// Surface
|
||||||
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||||
print '<input name="surface" size="4" value="'.$_POST["surface"].'">';
|
print '<input name="surface" size="4" value="'.GETPOST('surface').'">';
|
||||||
print $formproduct->select_measuring_units("surface_units","surface");
|
print $formproduct->select_measuring_units("surface_units","surface");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// Volume
|
// Volume
|
||||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||||
print '<input name="volume" size="4" value="'.$_POST["volume"].'">';
|
print '<input name="volume" size="4" value="'.GETPOST('volume').'">';
|
||||||
print $formproduct->select_measuring_units("volume_units","volume");
|
print $formproduct->select_measuring_units("volume_units","volume");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customs code
|
// Customs code
|
||||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$_POST["customcode"].'"></td></tr>';
|
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.GETPOST('customcode').'"></td></tr>';
|
||||||
|
|
||||||
// Origin country
|
// Origin country
|
||||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td>';
|
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||||
print $form->select_country($_POST["country_id"],'country_id');
|
print $form->select_country(GETPOST('country_id','int'),'country_id');
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -811,7 +808,7 @@ else
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
$value=(GETPOST('options_'.$key)?GETPOST('options_'.$key):$object->array_options["options_".$key]);
|
||||||
print '<tr><td>'.$label.'</td><td colspan="3">';
|
print '<tr><td>'.$label.'</td><td colspan="3">';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
@ -821,7 +818,7 @@ else
|
|||||||
// Note (private, no output on invoices, propales...)
|
// Note (private, no output on invoices, propales...)
|
||||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
|
$doleditor=new DolEditor('note',GETPOST('note'),'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -27,7 +27,8 @@ require("../main.inc.php");
|
|||||||
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."/core/class/html.formother.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
if ($conf->categorie->enabled) require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
if (! empty($conf->categorie->enabled))
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
@ -43,6 +44,7 @@ $search_categ = GETPOST("search_categ",'int');
|
|||||||
$tosell = GETPOST("tosell");
|
$tosell = GETPOST("tosell");
|
||||||
$tobuy = GETPOST("tobuy");
|
$tobuy = GETPOST("tobuy");
|
||||||
$fourn_id = GETPOST("fourn_id",'int');
|
$fourn_id = GETPOST("fourn_id",'int');
|
||||||
|
$catid = GETPOST('catid','int');
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
@ -59,7 +61,8 @@ $limit = $conf->liste_limit;
|
|||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
//$object->getCanvas($id);
|
//$object->getCanvas($id);
|
||||||
$canvas = GETPOST("canvas");
|
$canvas=GETPOST("canvas");
|
||||||
|
$objcanvas='';
|
||||||
if (! empty($canvas))
|
if (! empty($canvas))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||||
@ -85,12 +88,6 @@ if (isset($_POST["button_removefilter_x"]))
|
|||||||
$search_categ=0;
|
$search_categ=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->categorie->enabled && GETPOST('catid'))
|
|
||||||
{
|
|
||||||
$catid = GETPOST('catid','int');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -108,7 +105,7 @@ else
|
|||||||
{
|
{
|
||||||
$title=$langs->trans("ProductsAndServices");
|
$title=$langs->trans("ProductsAndServices");
|
||||||
|
|
||||||
if (isset($_GET["type"]))
|
if (isset($type))
|
||||||
{
|
{
|
||||||
if ($type==1)
|
if ($type==1)
|
||||||
{
|
{
|
||||||
@ -129,7 +126,7 @@ else
|
|||||||
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
|
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
|
||||||
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||||
if ($search_categ || $catid) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
|
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||||
if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
||||||
@ -146,7 +143,7 @@ else
|
|||||||
if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
||||||
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||||
if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid;
|
if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid;
|
||||||
if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL";
|
if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL";
|
||||||
if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$search_categ;
|
if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$search_categ;
|
||||||
if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL";
|
if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL";
|
||||||
if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id;
|
if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id;
|
||||||
@ -173,13 +170,16 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
$helpurl='';
|
$helpurl='';
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 0)
|
if (isset($type))
|
||||||
{
|
{
|
||||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
if ($type == 0)
|
||||||
}
|
{
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 1)
|
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||||
{
|
}
|
||||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
else if ($type == 1)
|
||||||
|
{
|
||||||
|
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader('',$title,$helpurl,'');
|
llxHeader('',$title,$helpurl,'');
|
||||||
@ -193,16 +193,16 @@ else
|
|||||||
$param.=isset($type)?"&type=".$type:"";
|
$param.=isset($type)?"&type=".$type:"";
|
||||||
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
||||||
|
|
||||||
if (isset($catid))
|
if (! empty($catid))
|
||||||
{
|
{
|
||||||
print "<div id='ways'>";
|
print "<div id='ways'>";
|
||||||
$c = new Categorie($db, $catid);
|
$c = new Categorie($db);
|
||||||
$ways = $c->print_all_ways(' > ','product/liste.php');
|
$ways = $c->print_all_ways(' > ','product/liste.php');
|
||||||
print " > ".$ways[0]."<br>\n";
|
print " > ".$ways[0]."<br>\n";
|
||||||
print "</div><br>";
|
print "</div><br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET["canvas"]) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/actions_card_'.$_GET["canvas"].'.class.php'))
|
if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php'))
|
||||||
{
|
{
|
||||||
$fieldlist = $object->field_list;
|
$fieldlist = $object->field_list;
|
||||||
$datas = $object->list_datas;
|
$datas = $object->list_datas;
|
||||||
@ -211,14 +211,14 @@ else
|
|||||||
$title_text = $title;
|
$title_text = $title;
|
||||||
|
|
||||||
// Default templates directory
|
// Default templates directory
|
||||||
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/tpl/';
|
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/';
|
||||||
// Check if a custom template is present
|
// Check if a custom template is present
|
||||||
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/list.tpl.php'))
|
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php'))
|
||||||
{
|
{
|
||||||
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/';
|
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
include($template_dir.'list.tpl.php'); // Include native PHP templates
|
include($template_dir.'list.tpl.php'); // Include native PHP templates
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -233,7 +233,7 @@ else
|
|||||||
|
|
||||||
// Filter on categories
|
// Filter on categories
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
if ($conf->categorie->enabled)
|
if (! empty($conf->categorie->enabled))
|
||||||
{
|
{
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ',1);
|
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ',1);
|
||||||
@ -251,12 +251,12 @@ else
|
|||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
|
||||||
if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder);
|
if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
|
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans("BuyingPriceMinShort").'</td>';
|
print '<td class="liste_titre" align="right">'.$langs->trans("BuyingPriceMinShort").'</td>';
|
||||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
||||||
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -269,7 +269,7 @@ else
|
|||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" name="snom" size="12" value="'.$snom.'">';
|
print '<input class="flat" type="text" name="snom" size="12" value="'.$snom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($conf->barcode->enabled)
|
if (! empty($conf->barcode->enabled))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
|
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
|
||||||
@ -280,7 +280,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if ($conf->service->enabled && $type != 0)
|
if (! empty($conf->service->enabled) && $type != 0)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -301,7 +301,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Stock
|
// Stock
|
||||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -328,7 +328,7 @@ else
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||||
{
|
{
|
||||||
$sql = "SELECT label";
|
$sql = "SELECT label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||||
@ -340,7 +340,7 @@ else
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$objtp = $db->fetch_object($result);
|
$objtp = $db->fetch_object($result);
|
||||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ else
|
|||||||
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
||||||
|
|
||||||
// Barcode
|
// Barcode
|
||||||
if ($conf->barcode->enabled)
|
if (! empty($conf->barcode->enabled))
|
||||||
{
|
{
|
||||||
print '<td>'.$objp->barcode.'</td>';
|
print '<td>'.$objp->barcode.'</td>';
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ else
|
|||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datem),'day')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($objp->datem),'day')."</td>\n";
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if ($conf->service->enabled && $type != 0)
|
if (! empty($conf->service->enabled) && $type != 0)
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||||
@ -406,7 +406,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Show stock
|
// Show stock
|
||||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1)
|
||||||
{
|
{
|
||||||
if ($objp->fk_product_type != 1)
|
if ($objp->fk_product_type != 1)
|
||||||
{
|
{
|
||||||
@ -435,7 +435,7 @@ else
|
|||||||
|
|
||||||
if ($num > $conf->liste_limit)
|
if ($num > $conf->liste_limit)
|
||||||
{
|
{
|
||||||
if ($sref || $snom || $sall || $sbarcode || $_POST["search"])
|
if ($sref || $snom || $sall || $sbarcode || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||||
}
|
}
|
||||||
@ -458,7 +458,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -27,13 +27,15 @@
|
|||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
||||||
|
|
||||||
|
$type=GETPOST("type","int");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'produit|service');
|
$result=restrictedArea($user,'produit|service');
|
||||||
|
|
||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = $_GET["page"];
|
$page = GETPOST("page",'int');
|
||||||
if ($page < 0) $page = 0;
|
if ($page < 0) $page = 0;
|
||||||
if (! $sortfield) $sortfield="c";
|
if (! $sortfield) $sortfield="c";
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
@ -51,22 +53,22 @@ $staticproduct=new Product($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$helpurl='';
|
$helpurl='';
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 0)
|
if ($type == 0)
|
||||||
{
|
{
|
||||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||||
}
|
}
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 1)
|
else if ($type == 1)
|
||||||
{
|
{
|
||||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader('',$title,$helpurl,'');
|
llxHeader('','',$helpurl);
|
||||||
|
|
||||||
//On n'affiche le lien page suivante que s'il y a une page suivante ...
|
//On n'affiche le lien page suivante que s'il y a une page suivante ...
|
||||||
$sql = "SELECT count(*) as c";
|
$sql = "SELECT count(*) as c";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
$sql.= ' WHERE entity IN ('.getEntity('product', 1).')';
|
$sql.= ' WHERE entity IN ('.getEntity('product', 1).')';
|
||||||
if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type'];
|
if (isset($type)) $sql.= " AND fk_product_type = ".$type;
|
||||||
|
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -77,11 +79,11 @@ if ($result)
|
|||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
$title = $langs->trans("ListProductServiceByPopularity");
|
$title = $langs->trans("ListProductServiceByPopularity");
|
||||||
if (isset($_GET['type']))
|
if (isset($type))
|
||||||
{
|
{
|
||||||
$param = '&type='.$_GET['type'];
|
$param = '&type='.$type;
|
||||||
$title = $langs->trans("ListProductByPopularity");
|
$title = $langs->trans("ListProductByPopularity");
|
||||||
if ($_GET['type'] == 1) $title = $langs->trans("ListServiceByPopularity");
|
if ($type == 1) $title = $langs->trans("ListServiceByPopularity");
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($title, $page, "popuprop.php",$param,"","","",$num);
|
print_barre_liste($title, $page, "popuprop.php",$param,"","","",$num);
|
||||||
@ -101,7 +103,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd";
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||||
$sql.= " AND p.rowid = pd.fk_product";
|
$sql.= " AND p.rowid = pd.fk_product";
|
||||||
if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type'];
|
if (isset($type)) $sql.= " AND fk_product_type = ".$type;
|
||||||
$sql.= " GROUP BY (p.rowid)";
|
$sql.= " GROUP BY (p.rowid)";
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit, $offset);
|
$sql.= $db->plimit($limit, $offset);
|
||||||
@ -109,52 +111,54 @@ $sql.= $db->plimit($limit, $offset);
|
|||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||||
{
|
{
|
||||||
$sql = "SELECT label";
|
$sql = "SELECT label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||||
$sql.= " WHERE fk_product=".$objp->rowid;
|
$sql.= " WHERE fk_product=".$objp->rowid;
|
||||||
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
||||||
$sql.= " LIMIT 1";
|
$sql.= " LIMIT 1";
|
||||||
|
|
||||||
$resultp = $db->query($sql);
|
$resultp = $db->query($sql);
|
||||||
if ($resultp)
|
if ($resultp)
|
||||||
{
|
{
|
||||||
$objtp = $db->fetch_object($resultp);
|
$objtp = $db->fetch_object($resultp);
|
||||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$objp->rowid.'">';
|
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$objp->rowid.'">';
|
||||||
if ($objp->type==1) print img_object($langs->trans("ShowService"),"service");
|
if ($objp->type==1) print img_object($langs->trans("ShowService"),"service");
|
||||||
else print img_object($langs->trans("ShowProduct"),"product");
|
else print img_object($langs->trans("ShowProduct"),"product");
|
||||||
print " ";
|
print " ";
|
||||||
print $objp->ref.'</a></td>';
|
print $objp->ref.'</a></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->type==1) print $langs->trans("ShowService");
|
if ($objp->type==1) print $langs->trans("ShowService");
|
||||||
else print $langs->trans("ShowProduct");
|
else print $langs->trans("ShowProduct");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$objp->label.'</td>';
|
print '<td>'.$objp->label.'</td>';
|
||||||
print '<td align="right">'.$objp->c.'</td>';
|
print '<td align="right">'.$objp->c.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free();
|
|
||||||
|
$db->free();
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,30 +36,41 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
$result=restrictedArea($user,'produit|service');
|
$result=restrictedArea($user,'produit|service');
|
||||||
|
|
||||||
|
|
||||||
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
$action=GETPOST('action','alpha');
|
||||||
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
|
$sref=GETPOST("sref");
|
||||||
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
|
$snom=GETPOST("snom");
|
||||||
$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
|
$sall=GETPOST("sall");
|
||||||
$sref=trim($sref);
|
$type=GETPOST("type","int");
|
||||||
$snom=trim($snom);
|
$sbarcode=GETPOST("sbarcode");
|
||||||
$sall=trim($sall);
|
$catid=GETPOST('catid','int');
|
||||||
$type=trim($type);
|
$toolowstock=GETPOST('toolowstock');
|
||||||
|
$tosell = GETPOST("tosell");
|
||||||
|
$tobuy = GETPOST("tobuy");
|
||||||
|
$fourn_id = GETPOST("fourn_id",'int');
|
||||||
|
|
||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
if (! $sortfield) $sortfield="stock_physique";
|
if (! $sortfield) $sortfield="stock_physique";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
$page = $_GET["page"];
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
$catid=GETPOST('catid');
|
|
||||||
$toolowstock=GETPOST('toolowstock');
|
|
||||||
|
|
||||||
// Load sale and categ filters
|
// Load sale and categ filters
|
||||||
$search_sale = GETPOST("search_sale");
|
$search_sale = GETPOST("search_sale");
|
||||||
$search_categ = GETPOST("search_categ");
|
$search_categ = GETPOST("search_categ");
|
||||||
|
|
||||||
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
|
//$object->getCanvas($id);
|
||||||
|
$canvas=GETPOST("canvas");
|
||||||
|
$objcanvas='';
|
||||||
|
if (! empty($canvas))
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||||
|
$objcanvas = new Canvas($db,$action);
|
||||||
|
$objcanvas->getCanvas('product','list',$canvas);
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($_POST["button_removefilter_x"]))
|
if (! empty($_POST["button_removefilter_x"]))
|
||||||
{
|
{
|
||||||
$sref="";
|
$sref="";
|
||||||
@ -118,15 +129,15 @@ if (dol_strlen($type))
|
|||||||
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
||||||
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
||||||
if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'";
|
if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'";
|
||||||
if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0)
|
if (! empty($tosell))
|
||||||
{
|
{
|
||||||
$sql.= " AND p.tosell = ".$_GET["tosell"];
|
$sql.= " AND p.tosell = ".$tosell;
|
||||||
}
|
}
|
||||||
if (isset($_GET["tobuy"]) && dol_strlen($_GET["tobuy"]) > 0)
|
if (! empty($tobuy))
|
||||||
{
|
{
|
||||||
$sql.= " AND p.tobuy = ".$_GET["tobuy"];
|
$sql.= " AND p.tobuy = ".$tobuy;
|
||||||
}
|
}
|
||||||
if (dol_strlen($canvas) > 0)
|
if (! empty($canvas))
|
||||||
{
|
{
|
||||||
$sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
$sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||||
}
|
}
|
||||||
@ -164,21 +175,10 @@ if ($resql)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["tosell"]) || isset($_POST["tosell"]))
|
|
||||||
{
|
|
||||||
$tosell = (isset($_GET["tosell"])?$_GET["tosell"]:$_POST["tosell"]);
|
|
||||||
}
|
|
||||||
if (isset($_GET["tobuy"]) || isset($_POST["tobuy"]))
|
|
||||||
{
|
|
||||||
$tobuy = (isset($_GET["tobuy"])?$_GET["tobuy"]:$_POST["tobuy"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$helpurl='';
|
$helpurl='';
|
||||||
$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||||
|
|
||||||
if (isset($_GET["type"]) || isset($_POST["type"]))
|
if (isset($type))
|
||||||
{
|
{
|
||||||
if ($type==1) { $texte = $langs->trans("Services"); }
|
if ($type==1) { $texte = $langs->trans("Services"); }
|
||||||
else { $texte = $langs->trans("Products"); }
|
else { $texte = $langs->trans("Products"); }
|
||||||
@ -190,16 +190,16 @@ if ($resql)
|
|||||||
|
|
||||||
llxHeader("",$title,$helpurl,$texte);
|
llxHeader("",$title,$helpurl,$texte);
|
||||||
|
|
||||||
if ($sref || $snom || $sall || $_POST["search"])
|
if ($sref || $snom || $sall || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$_POST["tosell"]."&tobuy=".$_POST["tobuy"], $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($catid)
|
if (! empty($catid))
|
||||||
{
|
{
|
||||||
print "<div id='ways'>";
|
print "<div id='ways'>";
|
||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
@ -219,7 +219,7 @@ if ($resql)
|
|||||||
|
|
||||||
// Filter on categories
|
// Filter on categories
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
if ($conf->categorie->enabled)
|
if (! empty($conf->categorie->enabled))
|
||||||
{
|
{
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
||||||
@ -258,7 +258,7 @@ if ($resql)
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($conf->service->enabled && $type == 1)
|
if (! empty($conf->service->enabled) && $type == 1)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -282,7 +282,7 @@ if ($resql)
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||||
{
|
{
|
||||||
$sql = "SELECT label";
|
$sql = "SELECT label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||||
@ -294,7 +294,7 @@ if ($resql)
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$objtp = $db->fetch_object($result);
|
$objtp = $db->fetch_object($result);
|
||||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$objp->label.'</td>';
|
print '<td>'.$objp->label.'</td>';
|
||||||
|
|
||||||
if ($conf->service->enabled && $type == 1)
|
if (! empty($conf->service->enabled) && $type == 1)
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||||
@ -335,7 +335,7 @@ if ($resql)
|
|||||||
|
|
||||||
if ($num > $conf->liste_limit)
|
if ($num > $conf->liste_limit)
|
||||||
{
|
{
|
||||||
if ($sref || $snom || $sall || $_POST["search"])
|
if ($sref || $snom || $sall || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, '');
|
print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, '');
|
||||||
}
|
}
|
||||||
@ -354,7 +354,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user