Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2014-10-03 01:48:28 +02:00
commit 7fb2d4d1c9
14 changed files with 195 additions and 197 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
@ -243,6 +243,7 @@ if ($user->rights->categorie->creer)
print $form->select_all_categories($type, $catorigin); print $form->select_all_categories($type, $catorigin);
print '</td></tr>'; print '</td></tr>';
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) if (empty($reshook))
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com> /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012-2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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
@ -117,7 +117,7 @@ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAI
$sql.= " WHERE u.rowid = d.fk_user"; $sql.= " WHERE u.rowid = d.fk_user";
$sql.= " AND d.entity = ".$conf->entity; $sql.= " AND d.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND d.fk_soc = ".$socid; if (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid; // FIXME $socid is not defined
$sql.= $db->order("d.tms","DESC"); $sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);

View File

@ -210,7 +210,8 @@ class modProduct extends DolibarrModules
{ {
// Exports product multiprice // Exports product multiprice
$r++; $r++;
$this->export_code[$r]=$this->rights_class.'_'.$key; //$this->export_code[$r]=$this->rights_class.'_'.$key; // FIXME $key is not defined
$this->export_code[$r]=$this->rights_class;
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export")); $this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref", $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* *
@ -468,6 +468,7 @@ class ProductFournisseur extends Product
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
$sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,"; $sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,";
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.unitcharges"; $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.unitcharges";
$sql.= " pfp.remise, pfp.remise_percent";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND pfp.fk_product = ".$prodid; $sql.= " AND pfp.fk_product = ".$prodid;

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
@ -53,22 +53,33 @@ $id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'expedition',$id,'livraison','livraison'); $result=restrictedArea($user,'expedition',$id,'livraison','livraison');
$object = new Livraison($db);
// Load object
if ($id > 0 || ! empty($ref)) {
$ret = $object->fetch($id, $ref);
if ($ret > 0)
$ret = $object->fetch_thirdparty();
if ($ret < 0)
dol_print_error('', $object->error);
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('deliverycard'));
/* /*
* Actions * Actions
*/ */
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($action == 'add') if ($action == 'add')
{ {
$db->begin(); $db->begin();
// Creation de l'objet livraison $object->date_livraison = time();
$delivery = new Livraison($db); $object->note = $_POST["note"];
$object->commande_id = $_POST["commande_id"];
$delivery->date_livraison = time();
$delivery->note = $_POST["note"];
$delivery->commande_id = $_POST["commande_id"];
if (!$conf->expedition_bon->enabled && ! empty($conf->stock->enabled)) if (!$conf->expedition_bon->enabled && ! empty($conf->stock->enabled))
{ {
@ -78,7 +89,7 @@ if ($action == 'add')
// On boucle sur chaque ligne de commande pour completer objet livraison // On boucle sur chaque ligne de commande pour completer objet livraison
// avec qte a livrer // avec qte a livrer
$commande = new Commande($db); $commande = new Commande($db);
$commande->fetch($delivery->commande_id); $commande->fetch($object->commande_id);
$commande->fetch_lines(); $commande->fetch_lines();
$num=count($commande->lines); $num=count($commande->lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
@ -87,20 +98,20 @@ if ($action == 'add')
$idl = "idl".$i; $idl = "idl".$i;
if ($_POST[$qty] > 0) if ($_POST[$qty] > 0)
{ {
$delivery->addline($_POST[$idl],$_POST[$qty]); $object->addline($_POST[$idl],$_POST[$qty]);
} }
} }
$ret=$delivery->create($user); $ret=$object->create($user);
if ($ret > 0) if ($ret > 0)
{ {
$db->commit(); $db->commit();
header("Location: ".$_SERVER['PHP_SELF']."?id=".$delivery->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
else else
{ {
setEventMessage($delivery->error, 'errors'); setEventMessage($object->error, 'errors');
$db->rollback(); $db->rollback();
$_GET["commande_id"]=$_POST["commande_id"]; $_GET["commande_id"]=$_POST["commande_id"];
@ -110,10 +121,6 @@ if ($action == 'add')
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->livraison->valider) else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->livraison->valider)
{ {
$object = new Livraison($db);
$object->fetch($id);
$object->fetch_thirdparty();
$result = $object->valid($user); $result = $object->valid($user);
// Define output language // Define output language
@ -140,10 +147,6 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->livraison->supprimer) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->livraison->supprimer)
{ {
$object = new Livraison($db);
$object->fetch($id);
$object->fetch_thirdparty();
$db->begin(); $db->begin();
$result=$object->delete(); $result=$object->delete();
@ -162,14 +165,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio
if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->creer) if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->creer)
{ {
$object = new Livraison($db);
$object->fetch($id);
$object->fetch_thirdparty();
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int')); $datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int'));
$object->fetch($id);
$result=$object->set_date_livraison($user,$datedelivery); $result=$object->set_date_livraison($user,$datedelivery);
if ($result < 0) if ($result < 0)
{ {
@ -182,10 +178,6 @@ if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->cree
*/ */
if ($action == 'builddoc') // En get ou en post if ($action == 'builddoc') // En get ou en post
{ {
$object = new Livraison($db);
$object->fetch($id);
$object->fetch_thirdparty();
// Save last template used to generate document // Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
@ -216,16 +208,11 @@ elseif ($action == 'remove_file')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$object = new Livraison($db);
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->expedition->dir_output . "/receipt"; $upload_dir = $conf->expedition->dir_output . "/receipt";
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object); $ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
}
} }
@ -256,7 +243,7 @@ if ($action == 'create')
$commande = new Commande($db); $commande = new Commande($db);
$commande->livraison_array(); $commande->livraison_array();
if ($commande->fetch($_GET["commande_id"])) if ($commande->fetch(GETPOST("commande_id")))
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
@ -271,7 +258,7 @@ if ($action == 'create')
/* /*
* Commande * Commande
*/ */
print '<form action="card.php" method="post">'; print '<form action="'.$_SERVER['PHP_SELF'].'" 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="commande_id" value="'.$commande->id.'">'; print '<input type="hidden" name="commande_id" value="'.$commande->id.'">';
@ -461,29 +448,29 @@ else
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
{ {
if ($id > 0) if ($object->id > 0)
{ {
$delivery = new Livraison($db);
$result = $delivery->fetch($id);
$delivery->fetch_thirdparty();
// Origin of a 'livraison' (delivery) is ALWAYS 'expedition' (shipment). // Origin of a 'livraison' (delivery) is ALWAYS 'expedition' (shipment).
// However, origin of shipment in future may differs (commande, proposal, ...) // However, origin of shipment in future may differs (commande, proposal, ...)
// TODO REGIS:
// Je ne suis pas d'accord, beaucoup entreprises n'utilisent pas les bons d'expéditions car ces derniers sont gérés par le transporteur,
// donc les bons de livraisons peuvent avoir une origine différente de 'expedition'
// les bons de livraisons et d'expéditions devraient être considérés comme des objets à part entière, voir des modules différents comme une propal ou autres.
$expedition=new Expedition($db); $expedition=new Expedition($db);
$result = $expedition->fetch($delivery->origin_id); $result = $expedition->fetch($object->origin_id);
$typeobject = $expedition->origin; // example: commande $typeobject = $expedition->origin; // example: commande
if ($delivery->origin_id > 0) if ($object->origin_id > 0)
{ {
$delivery->fetch_origin(); $object->fetch_origin();
} }
if ($delivery->id > 0) if ($object->id > 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($delivery->socid); $soc->fetch($object->socid);
$head=delivery_prepare_head($delivery); $head=delivery_prepare_head($object);
dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending');
/* /*
@ -493,7 +480,7 @@ else
if ($action == 'delete') if ($action == 'delete')
{ {
$expedition_id = GETPOST("expid"); $expedition_id = GETPOST("expid");
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id.'&backtopage='.urlencode($backtopage),$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&expid='.$expedition_id.'&backtopage='.urlencode($backtopage),$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$object->ref),'confirm_delete','','',1);
} }
@ -502,7 +489,7 @@ else
*/ */
if ($action == 'valid') if ($action == 'valid')
{ {
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm",$delivery->ref),'confirm_valid','','',1); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm",$object->ref),'confirm_valid','','',1);
} }
@ -513,7 +500,7 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Shipment // Shipment
if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0) if (($object->origin == 'shipment' || $object->origin == 'expedition') && $object->origin_id > 0)
{ {
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>';
@ -528,7 +515,7 @@ else
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$delivery->ref.'</td></tr>'; print '<td colspan="3">'.$object->ref.'</td></tr>';
// Client // Client
print '<tr><td width="20%">'.$langs->trans("Customer").'</td>'; print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
@ -559,12 +546,12 @@ else
// Ref client // Ref client
print '<tr><td>'.$langs->trans("RefCustomer").'</td>'; print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
print '<td colspan="3">'.$delivery->ref_customer."</a></td>\n"; print '<td colspan="3">'.$object->ref_customer."</a></td>\n";
print '</tr>'; print '</tr>';
// Date // Date
print '<tr><td>'.$langs->trans("DateCreation").'</td>'; print '<tr><td>'.$langs->trans("DateCreation").'</td>';
print '<td colspan="3">'.dol_print_date($delivery->date_creation,'daytext')."</td>\n"; print '<td colspan="3">'.dol_print_date($object->date_creation,'daytext')."</td>\n";
print '</tr>'; print '</tr>';
// Date delivery real / Received // Date delivery real / Received
@ -573,21 +560,21 @@ else
print $langs->trans('DateReceived'); print $langs->trans('DateReceived');
print '</td>'; print '</td>';
if ($action != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$delivery->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>'; if ($action != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">'; print '</td><td colspan="2">';
if ($action == 'editdate_livraison') if ($action == 'editdate_livraison')
{ {
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$delivery->id.'" method="post">'; print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" 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="setdate_livraison">'; print '<input type="hidden" name="action" value="setdate_livraison">';
$form->select_date($delivery->date_delivery?$delivery->date_delivery:-1,'liv_',1,1,'',"setdate_livraison"); $form->select_date($object->date_delivery?$object->date_delivery:-1,'liv_',1,1,'',"setdate_livraison");
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} }
else else
{ {
print $delivery->date_delivery ? dol_print_date($delivery->date_delivery,'dayhourtext') : '&nbsp;'; print $object->date_delivery ? dol_print_date($object->date_delivery,'dayhourtext') : '&nbsp;';
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -595,7 +582,7 @@ else
// Note Public // Note Public
print '<tr><td>'.$langs->trans("NotePublic").'</td>'; print '<tr><td>'.$langs->trans("NotePublic").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print nl2br($delivery->note_public); print nl2br($object->note_public);
/*$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); /*$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);*/ print $doleditor->Create(1);*/
print "</td></tr>"; print "</td></tr>";
@ -603,7 +590,7 @@ else
// Note Private // Note Private
print '<tr><td>'.$langs->trans("NotePrivate").'</td>'; print '<tr><td>'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print nl2br($delivery->note_private); print nl2br($object->note_private);
/*$doleditor = new DolEditor('note_pprivate', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); /*$doleditor = new DolEditor('note_pprivate', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);*/ print $doleditor->Create(1);*/
print "</td></tr>"; print "</td></tr>";
@ -611,14 +598,14 @@ else
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td>'; print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="3">'.$delivery->getLibStatut(4)."</td>\n"; print '<td colspan="3">'.$object->getLibStatut(4)."</td>\n";
print '</tr>'; print '</tr>';
if (!$conf->expedition_bon->enabled && ! empty($conf->stock->enabled)) if (!$conf->expedition_bon->enabled && ! empty($conf->stock->enabled))
{ {
// Entrepot // Entrepot
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
$entrepot->fetch($delivery->entrepot_id); $entrepot->fetch($object->entrepot_id);
print '<tr><td width="20%">'.$langs->trans("Warehouse").'</td>'; print '<tr><td width="20%">'.$langs->trans("Warehouse").'</td>';
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/product/stock/card.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td>'; print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/product/stock/card.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td>';
print '</tr>'; print '</tr>';
@ -630,7 +617,7 @@ else
* Lignes produits * Lignes produits
*/ */
$num_prod = count($delivery->lines); $num_prod = count($object->lines);
$i = 0; $total = 0; $i = 0; $total = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -651,66 +638,65 @@ else
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
if ($delivery->lines[$i]->fk_product > 0) if ($object->lines[$i]->fk_product > 0)
{ {
$product = new Product($db); $product = new Product($db);
$product->fetch($delivery->lines[$i]->fk_product); $product->fetch($object->lines[$i]->fk_product);
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$delivery->fetch_thirdparty();
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$delivery->client->default_lang; if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $delivery->lines[$i]->product_label; $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $object->lines[$i]->product_label;
} }
else else
$label = ( ! empty($delivery->lines[$i]->label)?$delivery->lines[$i]->label:$delivery->lines[$i]->product_label); $label = ( ! empty($object->lines[$i]->label)?$object->lines[$i]->label:$object->lines[$i]->product_label);
print '<td>'; print '<td>';
// Affiche ligne produit // Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$delivery->lines[$i]->fk_product.'">'; $text = '<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$object->lines[$i]->fk_product.'">';
if ($delivery->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); if ($object->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product'); else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$delivery->lines[$i]->product_ref.'</a>'; $text.= ' '.$object->lines[$i]->product_ref.'</a>';
$text.= ' - '.$label; $text.= ' - '.$label;
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($delivery->lines[$i]->description)); $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($object->lines[$i]->description));
//print $description; //print $description;
print $form->textwithtooltip($text,$description,3,'','',$i); print $form->textwithtooltip($text,$description,3,'','',$i);
print_date_range($delivery->lines[$i]->date_start,$delivery->lines[$i]->date_end); print_date_range($object->lines[$i]->date_start,$object->lines[$i]->date_end);
if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
print (! empty($delivery->lines[$i]->description) && $delivery->lines[$i]->description!=$delivery->lines[$i]->product_label)?'<br>'.dol_htmlentitiesbr($delivery->lines[$i]->description):''; print (! empty($object->lines[$i]->description) && $object->lines[$i]->description!=$object->lines[$i]->product_label)?'<br>'.dol_htmlentitiesbr($object->lines[$i]->description):'';
} }
} }
else else
{ {
print "<td>"; print "<td>";
if ($delivery->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); if ($object->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
if (! empty($delivery->lines[$i]->label)) { if (! empty($object->lines[$i]->label)) {
$text.= ' <strong>'.$delivery->lines[$i]->label.'</strong>'; $text.= ' <strong>'.$object->lines[$i]->label.'</strong>';
print $form->textwithtooltip($text,$delivery->lines[$i]->description,3,'','',$i); print $form->textwithtooltip($text,$object->lines[$i]->description,3,'','',$i);
} else { } else {
print $text.' '.nl2br($delivery->lines[$i]->description); print $text.' '.nl2br($object->lines[$i]->description);
} }
print_date_range($objp->date_start,$objp->date_end); print_date_range($objp->date_start,$objp->date_end);
print "</td>\n"; print "</td>\n";
} }
print '<td align="center">'.$delivery->lines[$i]->qty_asked.'</td>'; print '<td align="center">'.$object->lines[$i]->qty_asked.'</td>';
print '<td align="center">'.$delivery->lines[$i]->qty_shipped.'</td>'; print '<td align="center">'.$object->lines[$i]->qty_shipped.'</td>';
print "</tr>"; print "</tr>";
@ -730,20 +716,20 @@ else
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($delivery->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0) if ($object->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
{ {
print '<a class="butAction" href="card.php?id='.$delivery->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
} }
if ($user->rights->expedition->livraison->supprimer) if ($user->rights->expedition->livraison->supprimer)
{ {
if ($conf->expedition_bon->enabled) if ($conf->expedition_bon->enabled)
{ {
print '<a class="butActionDelete" href="card.php?id='.$delivery->id.'&amp;expid='.$delivery->origin_id.'&amp;action=delete&amp;backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$delivery->origin_id).'">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;expid='.$object->origin_id.'&amp;action=delete&amp;backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id).'">'.$langs->trans("Delete").'</a>';
} }
else else
{ {
print '<a class="butActionDelete" href="card.php?id='.$delivery->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
} }
} }
@ -757,22 +743,22 @@ else
* Documents generated * Documents generated
*/ */
$deliveryref = dol_sanitizeFileName($delivery->ref); $objectref = dol_sanitizeFileName($object->ref);
$filedir = $conf->expedition->dir_output . "/receipt/" . $deliveryref; $filedir = $conf->expedition->dir_output . "/receipt/" . $objectref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$delivery->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$user->rights->expedition->livraison->creer; $genallowed=$user->rights->expedition->livraison->creer;
$delallowed=$user->rights->expedition->livraison->supprimer; $delallowed=$user->rights->expedition->livraison->supprimer;
$somethingshown=$formfile->show_documents('livraison',$deliveryref,$filedir,$urlsource,$genallowed,$delallowed,$delivery->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); $somethingshown=$formfile->show_documents('livraison',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
/* /*
* Linked object block (of linked shipment) * Linked object block (of linked shipment)
*/ */
if ($delivery->origin == 'expedition') if ($object->origin == 'expedition')
{ {
$shipment = new Expedition($db); $shipment = new Expedition($db);
$shipment->fetch($delivery->origin_id); $shipment->fetch($object->origin_id);
$somethingshown=$shipment->showLinkedObjectBlock(); $somethingshown=$shipment->showLinkedObjectBlock();
} }

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Auguria SARL <info@auguria.org> * Copyright (C) 2006 Auguria SARL <info@auguria.org>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
@ -48,7 +48,7 @@ $langs->load("products");
$langs->load("other"); $langs->load("other");
if (! empty($conf->stock->enabled)) $langs->load("stocks"); if (! empty($conf->stock->enabled)) $langs->load("stocks");
if (! empty($conf->facture->enabled)) $langs->load("bills"); if (! empty($conf->facture->enabled)) $langs->load("bills");
if ($conf->productbatch->enabled) $langs->load("productbatch"); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
$mesg=''; $error=0; $errors=array(); $_error=0; $mesg=''; $error=0; $errors=array(); $_error=0;
@ -863,7 +863,7 @@ else
print '</td></tr>'; print '</td></tr>';
// Batch number management // Batch number management
if ($conf->productbatch->enabled) if (! empty($conf->productbatch->enabled))
{ {
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Batch").')</td><td colspan="3">'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Batch").')</td><td colspan="3">';
$statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch")); $statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
@ -2856,7 +2856,7 @@ class Product extends CommonObject
{ {
global $langs; global $langs;
$langs->load('products'); $langs->load('products');
if ($conf->productbatch->enabled) $langs->load("productbatch"); if (!empty($conf->productbatch->enabled)) $langs->load("productbatch");
if ($type == 2) if ($type == 2)
{ {

View File

@ -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-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.fr> * Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.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
@ -367,7 +367,8 @@ function activitytrim($product_type)
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$tmpyear=$beginyear; //$tmpyear=$beginyear; // FIXME $beginyear is not defined
$tmpyear=0;
$trim1=0; $trim1=0;
$trim2=0; $trim2=0;
$trim3=0; $trim3=0;

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-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 Simon Tosser <simon@kornog-computing.com> * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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,6 +36,8 @@ $langs->load("stocks");
$langs->load("companies"); $langs->load("companies");
$action=GETPOST('action'); $action=GETPOST('action');
$cancel=GETPOST('cancel');
$confirm=GETPOST('confirm');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -59,17 +61,17 @@ if ($action == 'add' && $user->rights->stock->creer)
{ {
$object = new Entrepot($db); $object = new Entrepot($db);
$object->ref = $_POST["ref"]; $object->ref = GETPOST("ref");
$object->libelle = $_POST["libelle"]; $object->libelle = GETPOST("libelle");
$object->description = $_POST["desc"]; $object->description = GETPOST("desc");
$object->statut = $_POST["statut"]; $object->statut = GETPOST("statut");
$object->lieu = $_POST["lieu"]; $object->lieu = GETPOST("lieu");
$object->address = $_POST["address"]; $object->address = GETPOST("address");
$object->zip = $_POST["zipcode"]; $object->zip = GETPOST("zipcode");
$object->town = $_POST["town"]; $object->town = GETPOST("town");
$object->country_id = $_POST["country_id"]; $object->country_id = GETPOST("country_id");
if ($object->libelle) { if (! empty($object->libelle)) {
$id = $object->create($user); $id = $object->create($user);
if ($id > 0) if ($id > 0)
{ {
@ -87,7 +89,7 @@ if ($action == 'add' && $user->rights->stock->creer)
} }
// Delete warehouse // Delete warehouse
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer)
{ {
$object = new Entrepot($db); $object = new Entrepot($db);
$object->fetch($_REQUEST["id"]); $object->fetch($_REQUEST["id"]);
@ -105,19 +107,19 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->right
} }
// Modification entrepot // Modification entrepot
if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) if ($action == 'update' && $cancel <> $langs->trans("Cancel"))
{ {
$object = new Entrepot($db); $object = new Entrepot($db);
if ($object->fetch($id)) if ($object->fetch($id))
{ {
$object->libelle = $_POST["libelle"]; $object->libelle = GETPOST("libelle");
$object->description = $_POST["desc"]; $object->description = GETPOST("desc");
$object->statut = $_POST["statut"]; $object->statut = GETPOST("statut");
$object->lieu = $_POST["lieu"]; $object->lieu = GETPOST("lieu");
$object->address = $_POST["address"]; $object->address = GETPOST("address");
$object->zip = $_POST["zipcode"]; $object->zip = GETPOST("zipcode");
$object->town = $_POST["town"]; $object->town = GETPOST("town");
$object->country_id = $_POST["country_id"]; $object->country_id = GETPOST("country_id");
if ( $object->update($id, $user) > 0) if ( $object->update($id, $user) > 0)
{ {
@ -136,7 +138,7 @@ if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
} }
} }
if ($_POST["cancel"] == $langs->trans("Cancel")) if ($cancel == $langs->trans("Cancel"))
{ {
$action = ''; $action = '';
} }
@ -162,37 +164,36 @@ if ($action == 'create')
print "<form action=\"card.php\" method=\"post\">\n"; print "<form action=\"card.php\" method=\"post\">\n";
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="'.$type.'">'."\n";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value=""></td></tr>'; print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value=""></td></tr>';
print '<tr><td >'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$object->lieu.'"></td></tr>'; print '<tr><td >'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.(!empty($object->lieu)?$object->lieu:'').'"></td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('desc',$object->description,'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70); $doleditor=new DolEditor('desc',(!empty($object->description)?$object->description:''),'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">'; print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">';
print $object->address; print (!empty($object->address)?$object->address:'');
print '</textarea></td></tr>'; print '</textarea></td></tr>';
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>'; print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print $formcompany->select_ziptown((!empty($object->zip)?$object->zip:''),'zipcode',array('town','selectcountry_id','state_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>'; print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print $formcompany->select_ziptown((!empty($object->town)?$object->town:''),'town',array('zipcode','selectcountry_id','state_id'));
print '</td></tr>'; print '</td></tr>';
// Country // Country
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
print $form->select_country($object->country_id?$object->country_id:$mysoc->country_code,'country_id'); print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>'; print '</td></tr>';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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
@ -39,7 +39,7 @@ $sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder"); $sortorder = GETPOST("sortorder");
if (! $sortfield) $sortfield="e.label"; if (! $sortfield) $sortfield="e.label";
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
$page = $_GET["page"]; $page = GETPOST("page");
if ($page < 0) $page = 0; if ($page < 0) $page = 0;
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$offset = $limit * $page; $offset = $limit * $page;

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2013 Laurent Destaileur <ely@users.sourceforge.net> /* Copyright (C) 2013 Laurent Destaileur <ely@users.sourceforge.net>
* Copyright (C) 2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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
@ -228,7 +229,7 @@ $warehousestatict = new Entrepot($db);
$title = $langs->trans('MassMovement'); $title = $langs->trans('MassMovement');
llxHeader('', $title, $helpurl, ''); llxHeader('', $title);
print_fiche_titre($langs->trans("MassStockMovement")).'<br><br>'; print_fiche_titre($langs->trans("MassStockMovement")).'<br><br>';
@ -249,6 +250,8 @@ print '<input type="hidden" name="action" value="addline">';
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
//print '<div class="tagtable centpercent">'; //print '<div class="tagtable centpercent">';
$param='';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print getTitleFieldOfList($langs->trans('ProductRef'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); print getTitleFieldOfList($langs->trans('ProductRef'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('WarehouseSource'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder); print getTitleFieldOfList($langs->trans('WarehouseSource'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder);

View File

@ -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-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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
@ -406,8 +406,8 @@ if ($resql)
if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref);
if ($search_product) $param.='&search_product='.urlencode($search_product); if ($search_product) $param.='&search_product='.urlencode($search_product);
if ($search_warehouse) $param.='&search_warehouse='.urlencode($search_warehouse); if ($search_warehouse) $param.='&search_warehouse='.urlencode($search_warehouse);
if ($sref) $param.='&sref='.urlencode($sref); if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined
if ($snom) $param.='&snom='.urlencode($snom); if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined
if ($search_user) $param.='&search_user='.urlencode($search_user); if ($search_user) $param.='&search_user='.urlencode($search_user);
if ($idproduct > 0) $param.='&idproduct='.$idproduct; if ($idproduct > 0) $param.='&idproduct='.$idproduct;
if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,''); if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,'');

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> /* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Laurent Destaileur <ely@users.sourceforge.net> * Copyright (C) 2013-2014 Laurent Destaileur <ely@users.sourceforge.net>
* Copyright (C) 2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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
@ -50,6 +51,9 @@ $tobuy = GETPOST('tobuy', 'int');
$salert = GETPOST('salert', 'alpha'); $salert = GETPOST('salert', 'alpha');
$mode = GETPOST('mode','alpha'); $mode = GETPOST('mode','alpha');
$fourn_id = GETPOST('mode','int'); // FIXME $fourn_id is not defined
$texte = ''; // FIXME $texte is not defined
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
@ -197,7 +201,7 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global
$usevirtualstock=-1; $usevirtualstock=-1;
if ($virtualdiffersfromphysical) if ($virtualdiffersfromphysical)
{ {
$usevirtualstock=($conf->global->STOCK_USE_VIRTUAL_STOCK?1:0); $usevirtualstock=(! empty($conf->global->STOCK_USE_VIRTUAL_STOCK)?1:0);
if ($mode=='virtual') $usevirtualstock=1; if ($mode=='virtual') $usevirtualstock=1;
if ($mode=='physical') $usevirtualstock=0; if ($mode=='physical') $usevirtualstock=0;
} }
@ -426,7 +430,7 @@ print '<tr class="liste_titre">'.
if (!empty($conf->service->enabled) && $type == 1) print '<td class="liste_titre">&nbsp;</td>'; if (!empty($conf->service->enabled) && $type == 1) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'. print '<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre" align="right">&nbsp;</td>'. '<td class="liste_titre" align="right">&nbsp;</td>'.
'<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" id="salert" name="salert" ' . $alertchecked . '></td>'. '<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" id="salert" name="salert" ' . (!empty($alertchecked)?$alertchecked:'') . '></td>'.
'<td class="liste_titre" align="right">&nbsp;</td>'. '<td class="liste_titre" align="right">&nbsp;</td>'.
'<td class="liste_titre">&nbsp;</td>'. '<td class="liste_titre">&nbsp;</td>'.
'<td class="liste_titre" align="right">'. '<td class="liste_titre" align="right">'.

View File

@ -1,6 +1,7 @@
<?php <?php
/* /*
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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
@ -44,8 +45,7 @@ $result=restrictedArea($user,'produit|service');
* View * View
*/ */
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|'; $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
$helpurl .= 'ES:M&oacute;dulo_Stocks';
$texte = $langs->trans('ReplenishmentOrders'); $texte = $langs->trans('ReplenishmentOrders');
llxHeader('', $texte, $helpurl, ''); llxHeader('', $texte, $helpurl, '');
@ -132,7 +132,7 @@ if ($sall) {
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
$sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")'; $sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")';
} }
if ($socid) { if (!empty($socid)) {
$sql .= ' AND s.rowid = ' . $socid; $sql .= ' AND s.rowid = ' . $socid;
} }