Fix: remove unused old files

This commit is contained in:
Regis Houssin
2011-05-06 13:35:15 +00:00
parent 030ee2113b
commit e3cf646a7d
10 changed files with 43 additions and 838 deletions

View File

@@ -2469,15 +2469,14 @@ class Commande extends CommonObject
*/
function getNomUrl($withpicto=0,$option=0)
{
global $langs;
global $conf, $langs;
$result='';
$urlOption='';
if ($option == 3) $urlOption = '/compta';
if ($option == 4) $urlOption = '/expedition';
$urlOption = '/commande/fiche.php';
if ($conf->expedition->enabled && ($option == 1 || $option == 2)) $urlOption = '/expedition/shipment.php';
$lien = '<a href="'.DOL_URL_ROOT.$urlOption.'/commande/fiche.php?id='.$this->id.'">';
$lien = '<a href="'.DOL_URL_ROOT.$urlOption.'?id='.$this->id.'">';
$lienfin='</a>';
$picto='order';

View File

@@ -1,612 +0,0 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/compta/commande/fiche.php
* \ingroup commande
* \brief Fiche commande
* \version $Id$
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/sendings.lib.php");
require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
if (! $user->rights->commande->lire) accessforbidden();
$langs->load("orders");
$langs->load("companies");
$langs->load("bills");
$langs->load('deliveries');
$langs->load('sendings');
$id=empty($_GET['id']) ? 0 : intVal($_GET['id']);
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action'];
// Security check
$socid=0;
$comid = isset($_GET["id"])?$_GET["id"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'commande',$comid,'');
/*
* Actions
*/
// Categorisation dans projet
if ($_POST['action'] == 'classin')
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
$commande->setProject($_POST['projectid']);
}
if ($_GET["action"] == 'facturee')
{
$commande = new Commande($db);
$commande->fetch($_GET["id"]);
$commande->classer_facturee();
}
// Positionne ref commande client
if ($_POST['action'] == 'set_ref_client' && $user->rights->commande->creer)
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
$commande->set_ref_client($user, $_POST['ref_client']);
}
if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer)
{
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datelivraison=dol_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
$commande = new Commande($db);
$commande->fetch($_GET['id']);
$result=$commande->set_date_livraison($user,$datelivraison);
if ($result < 0)
{
$mesg='<div class="error">'.$commande->error.'</div>';
}
}
if ($_POST['action'] == 'setaddress' && $user->rights->commande->creer)
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
$commande->set_adresse_livraison($user,$_POST['adresse_livraison_id']);
}
if ($_POST['action'] == 'setmode' && $user->rights->commande->creer)
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
$result=$commande->mode_reglement($_POST['mode_reglement_id']);
if ($result < 0) dol_print_error($db,$commande->error);
}
if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer)
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
$result=$commande->cond_reglement($_POST['cond_reglement_id']);
if ($result < 0) dol_print_error($db,$commande->error);
}
/*
* View
*/
llxHeader('',$langs->trans("OrderCard"),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
$html = new Form($db);
$formfile = new FormFile($db);
$id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
$product_static=new Product($db);
$commande = new Commande($db);
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
$author = new User($db);
$author->fetch($commande->user_author_id);
$head = commande_prepare_head($commande);
dol_fiche_head($head, 'accountancy', $langs->trans("CustomerOrder"), 0, 'order');
/*
* Commande
*/
$nbrow=7;
if ($conf->projet->enabled) $nbrow++;
//Local taxes
if ($mysoc->pays_code=='ES')
{
if($mysoc->localtax1_assuj=="1") $nbrow++;
if($mysoc->localtax2_assuj=="1") $nbrow++;
}
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
// Ref commande client
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>';
if ($_GET['action'] != 'RefCustomerOrder' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=RefCustomerOrder&amp;id='.$commande->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder')
{
print '<form action="fiche.php?id='.$id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_ref_client">';
print '<input type="text" class="flat" size="20" name="ref_client" value="'.$commande->ref_client.'">';
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
print $commande->ref_client;
}
print '</td>';
print '</tr>';
// Third party
print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>';
print '</tr>';
// Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
$absolute_discount=price2num($absolute_discount,'MT');
$absolute_creditnote=price2num($absolute_creditnote,'MT');
if ($absolute_discount)
{
if ($commande->statut > 0)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
}
else
{
// Remise dispo de type non avoir
$filter='fk_facture_source IS NULL';
print '<br>';
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter);
}
}
if ($absolute_creditnote)
{
print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>';
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
if ($commande->source == 0 && $conf->propal->enabled && $commande->propale_id)
{
// Si source = propal
$propal = new Propal($db);
$propal->fetch($commande->propale_id);
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$propal->id.'">'.$propal->ref.'</a>';
}
print '</td>';
print '</tr>';
// Delivery date planed
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DateDeliveryPlanned');
print '</td>';
if (1 == 2 && $_GET['action'] != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editdate_livraison')
{
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setdate_livraison">';
$html->select_date($commande->date_livraison>0?$commande->date_livraison:-1,'liv_','','','',"setdate_livraison");
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
print dol_print_date($commande->date_livraison,'daytext');
}
print '</td>';
print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans('NotePublic').' :<br>';
print nl2br($commande->note_public);
print '</td>';
print '</tr>';
// Delivery address
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS)
{
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryAddress');
print '</td>';
if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&amp;socid='.$commande->socid.'&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editdelivery_adress')
{
$html->form_address($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'adresse_livraison_id','commande',$commande->id);
}
else
{
$html->form_address($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'none','commande',$commande->id);
}
print '</td></tr>';
}
// Conditions et modes de reglement
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($_GET['action'] != 'editconditions' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editconditions')
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id');
}
else
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none');
}
print '</td></tr>';
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($_GET['action'] != 'editmode' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editmode')
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id');
}
else
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none');
}
print '</td></tr>';
// Projet
if ($conf->projet->enabled)
{
$langs->load('projects');
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project');
print '</td>';
if ($_GET['action'] != 'classer') print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classer&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetProject')).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'classer')
{
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid');
}
else
{
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none');
}
print '</td></tr>';
}
// Lignes de 3 colonnes
// Total HT
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Total TVA
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right">'.price($commande->total_tva).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Amount Local Taxes
if ($mysoc->pays_code=='ES')
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td>';
print '<td align="right">'.price($commande->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td>';
print '<td align="right">'.price($commande->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
}
}
// Total TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right">'.price($commande->total_ttc).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Statut
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td colspan="2">'.$commande->getLibStatut(4).'</td>';
print '</tr>';
print '</table>';
/*
* Lines
*/
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.description, l.price, l.qty, l.tva_tx, l.fk_remise_except, l.remise_percent, l.subprice,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
$sql.= ' l.date_start,';
$sql.= ' l.date_end,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
$sql.= ' p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX."commandedet as l";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= " WHERE l.fk_commande = ".$commande->id;
$sql.= " ORDER BY l.rang, l.rowid";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0; $total = 0;
if ($num) print '<br>';
print '<table class="noborder" width="100%">';
if ($num)
{
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td width="48" colspan="3">&nbsp;</td>';
print "</tr>\n";
}
$var=true;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
// Show product and description
$type=$objp->product_type?$objp->product_type:$objp->fk_product_type;
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (! empty($objp->date_start)) $type=1;
if (! empty($objp->date_end)) $type=1;
print '<tr '.$bc[$var].'>';
if ($objp->fk_product > 0)
{
print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
// Show product and description
$product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref;
$product_static->libelle=$objp->product_label;
$text=$product_static->getNomUrl(1);
$text.= ' - '.$objp->product_label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
print $html->textwithtooltip($text,$description,3,'','',$i);
// Show range
print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end));
// Add description in form
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print ($objp->description && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
}
print '</td>';
}
else
{
print '<td>';
if (($objp->info_bits & 2) == 2)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$commande->socid.'">';
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
print '</a>';
if ($objp->description)
{
if ($objp->description == '(CREDIT_NOTE)')
{
require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php');
$discount=new DiscountAbsolute($db);
$discount->fetch($objp->fk_remise_except);
print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
}
else
{
print ' - '.nl2br($objp->description);
}
}
}
else
{
if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($objp->description);
// Show range
print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end));
}
print "</td>\n";
}
print '<td align="right" nowrap="nowrap">'.vatrate($objp->tva_tx).'%</td>';
print '<td align="right" nowrap="nowrap">'.price($objp->subprice)."</td>\n";
print '<td align="right">';
if (($objp->info_bits & 2) != 2)
{
print $objp->qty;
}
else print '&nbsp;';
print '</td>';
if ($objp->remise_percent > 0)
{
print '<td align="right">'.$objp->remise_percent."%</td>\n";
}
else
{
print '<td>&nbsp;</td>';
}
print '<td align="right" nowrap="nowrap">'.price($objp->total_ht)."</td>\n";
print '<td colspan="3">&nbsp;</td>';
print '</tr>';
$total = $total + ($objp->qty * $objp->price);
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
print '</table>';
print '</div>';
/*
* Boutons actions
*/
if (! $user->societe_id && ! $commande->facturee)
{
print "<div class=\"tabsAction\">\n";
if ($commande->statut > 0 && $user->rights->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$commande->element.'&amp;originid='.$commande->id.'&amp;socid='.$commande->socid.'">'.$langs->trans("CreateBill").'</a>';
}
if ($commande->statut > 0 && $user->rights->commande->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=facturee&amp;id='.$commande->id.'">'.$langs->trans("ClassifyBilled").'</a>';
}
print '</div>';
}
print '<table width="100%"><tr><td width="50%" valign="top">';
/*
* Documents generes
*
*/
$comref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref.'/'.$comref.'.pdf';
$filedir = $conf->commande->dir_output . '/' . $comref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id;
$genallowed=0;
$delallowed=0;
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/*
* Linked object block
*/
$commande->load_object_linked($commande->id,$commande->element);
foreach($commande->linked_object as $linked_object => $linked_objectid)
{
if($conf->$linked_object->enabled && $linked_object != $commande->element)
{
$somethingshown=$commande->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
}
}
print '</td><td valign="top" width="50%">';
// List of actions on element
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($commande,'order',$socid);
print "</td></tr></table>";
show_list_sending_receive('commande',$commande->id);
}
else
{
// Commande non trouvee
print "Commande inexistante";
}
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@@ -1,205 +0,0 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/**
* \file htdocs/compta/commande/liste.php
* \ingroup commande
* \brief Page liste des commandes
* \version $Revision$
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
$langs->load('companies');
// Security check
$orderid = GETPOST("orderid",'int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande',$orderid,'');
// Assign and check variable
$year=GETPOST('year','int');
$month=GETPOST('month','int');
$status=GETPOST('status','int');
$onbill=GETPOST('afacturer','int');
$page=GETPOST('page','int');
$sf_ref=GETPOST('sf_ref','',2);
$sortorder=GETPOST('sortorder','alpha');
$sortfield=GETPOST('sortfield','alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="c.rowid";
if (! $sortorder) $sortorder="DESC";
$limit = $conf->liste_limit;
$html = new Form($db);
$formfile = new FormFile($db);
/*
* View
*/
$now=gmmktime();
llxHeader();
$sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " c.rowid, c.ref, c.total_ht, c.date_commande as date_commande,";
$sql.= " c.fk_statut, c.facture";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($month > 0)
{
$sql.= " AND date_format(c.date_commande, '%Y-%m') = '".$year."-".$month."'";
}
if ($year > 0)
{
$sql.= " AND date_format(c.date_commande, '%Y') = '".$year."'";
}
if ($status)
{
$sql.= " AND fk_statut = ".$status;
}
if ($onbill == 1)
{
$sql.= " AND fk_statut >=1 AND c.facture = 0";
}
if (dol_strlen($sf_ref) > 0)
{
$sql.= " AND c.ref like '%".$sf_ref . "%'";
}
$sql.= " ORDER BY $sortfield $sortorder";
$sql.= $db->plimit($limit + 1,$offset);
$resql = $db->query($sql);
if ($resql)
{
if ($socid)
{
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans("ListOfOrders") . " - ".$soc->nom;
}
else
{
$title = $langs->trans("ListOfOrders");
}
// Si page des commandes a facturer
$link=DOL_URL_ROOT."/compta/commande/fiche.php";
$title.=" - ".$langs->trans("StatusOrderToBill");
$param="&amp;socid=".$socid."&amp;year=".$year."&amp;month=".$month;
$num = $db->num_rows($resql);
print_barre_liste($title, $page, "liste.php",$param,$sortfield,$sortorder,'',$num);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"liste.php","c.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),"liste.php","c.date_commande","",$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"liste.php","c.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=True;
$generic_commande = new Commande($db);
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td width="20%" nowrap="nowrap">';
$generic_commande->id=$objp->rowid;
$generic_commande->ref=$objp->ref;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding" nowrap="nowrap">';
print $generic_commande->getNomUrl(1);
print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
if (($db->jdate($objp->date_commande) < ($now - $conf->commande->client->warning_delay)) && $objp->statutid == 1 ) print img_picto($langs->trans("Late"),"warning");
print '</td>';
print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
print "<td><a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid."\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom."</a>";
print "</td>";
print "<td align=\"center\">";
$y = dol_print_date($db->jdate($objp->date_commande),"%Y");
$m = dol_print_date($db->jdate($objp->date_commande),"%m");
$mt = dol_print_date($db->jdate($objp->date_commande),"%b");
$d = dol_print_date($db->jdate($objp->date_commande),"%d");
print $d."\n";
print " <a href=\"liste.php?year=$y&amp;month=$m\">";
print $mt."</a>\n";
print " <a href=\"liste.php?year=$y\">";
print $y."</a></td>\n";
print '<td align="right">'.$generic_commande->LibStatut($objp->fk_statut,$objp->facture,5).'</td>';
print "</tr>\n";
$total = $total + $objp->price;
$subtotal = $subtotal + $objp->price;
$i++;
}
print "</table>";
$db->free($resql);
}
else
{
print dol_print_error($db);
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@@ -700,7 +700,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
$i = 0;
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<td colspan="2">'.$langs->trans("OrdersToBill").' <a href="'.DOL_URL_ROOT.'/compta/commande/liste.php?status=3&afacturer=1">('.$num.')</a></td>';
print '<td colspan="2">'.$langs->trans("OrdersToBill").' <a href="'.DOL_URL_ROOT.'/commande/liste.php?status=3&afacturer=1">('.$num.')</a></td>';
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("ToBill").'</td>';

View File

@@ -1452,12 +1452,43 @@ class CommonObject
* @param $objectid
* @param $somethingshown
*/
function showLinkedObjectBlock($objecttype,$objectid,$somethingshown=0)
function showLinkedObjectBlock($somethingshown=0)
{
global $langs,$bc;
$this->fetch_object_linked();
$num = sizeof($this->linkedObjects);
foreach($this->linkedObjects as $objecttype => $objects)
{
$tplpath = $element = $subelement = $objecttype;
if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
{
$element = $regs[1];
$subelement = $regs[2];
$tplpath = $element.'/'.$subelement;
}
// To work with non standard path
if ($objecttype == 'facture') { $tplpath = 'compta/'.$element; }
if ($objecttype == 'propal') { $tplpath = 'comm/'.$element; }
if ($objecttype == 'shipping') { $tplpath = 'expedition'; }
if ($objecttype == 'delivery') { $tplpath = 'livraison'; }
if ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; }
if ($objecttype == 'order_supplier') { $tplpath = 'fourn/commande'; }
$this->linkedObjectBlock = $objects;
dol_include_once('/'.$tplpath.'/tpl/linkedobjectblock.tpl.php');
}
return $num;
//print 'objecttype='.$objecttype.'<br>';
/*
$this->objectid = $objectid;
$num = sizeof($this->objectid);
@@ -1496,6 +1527,7 @@ class CommonObject
return $num;
}
*/
}

View File

@@ -186,7 +186,7 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled && $conf->banque->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
-- Accountancy - Orders to bill
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/commande/liste.php?leftmenu=orders&amp;status=3&amp;afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&amp;status=3&amp;afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
-- Donations
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&amp;mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&amp;mainmenu=accountancy&amp;action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);

View File

@@ -185,7 +185,7 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled && $conf->banque->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
-- Accountancy - Orders to bill
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/commande/liste.php?leftmenu=orders&amp;status=3&amp;afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&amp;status=3&amp;afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
-- Donations
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&amp;mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&amp;mainmenu=accountancy&amp;action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);

View File

@@ -931,7 +931,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
if ($conf->commande->enabled)
{
$langs->load("orders");
if ($conf->facture->enabled) $newmenu->add("/compta/commande/liste.php?leftmenu=orders&amp;status=3&amp;afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
if ($conf->facture->enabled) $newmenu->add("/commande/liste.php?leftmenu=orders&amp;status=3&amp;afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
// if ($leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
}

View File

@@ -54,16 +54,7 @@ function commande_prepare_head($object)
$head[$h][2] = 'shipping';
$h++;
}
/*
// Commande a facturer
if ($conf->facture->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("AccountancyCard");
$head[$h][2] = 'accountancy';
$h++;
}
*/
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$object->id;