Uniformize code for liste_array
Fix visibility of elements into product page (manage external users)
This commit is contained in:
parent
f04abccdf3
commit
52952c6fce
@ -441,12 +441,12 @@ if ($id > 0)
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
//print "</td>\n";
|
||||
//print '<td valign="top" width="50%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
|
||||
// Nbre max d'elements des petites listes
|
||||
$MAXLIST=4;
|
||||
$tableaushown=1;
|
||||
@ -469,10 +469,6 @@ if ($id > 0)
|
||||
{
|
||||
$propal_static = new Propal($db);
|
||||
|
||||
$proposals = $propal_static->liste_array(0, 0, 0, $object->id, $MAXLIST);
|
||||
|
||||
//var_dump($proposals);
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
|
||||
$sql.= " p.datep as dp, p.fin_validite as datelimite";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
|
||||
@ -307,8 +307,8 @@ class Propal extends CommonObject
|
||||
* @param int $fk_fournprice Id supplier price
|
||||
* @param int $pa_ht Buying price without tax
|
||||
* @param string $label ???
|
||||
* @param timestamp $date_start Start date of the line
|
||||
* @param timestamp $date_end End date of the line
|
||||
* @param timestamp $date_start Start date of the line
|
||||
* @param timestamp $date_end End date of the line
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @see add_product
|
||||
@ -403,7 +403,7 @@ class Propal extends CommonObject
|
||||
$this->line->product_type=$type;
|
||||
$this->line->special_code=$special_code;
|
||||
$this->line->fk_parent_line=$fk_parent_line;
|
||||
|
||||
|
||||
$this->line->date_start=$date_start;
|
||||
$this->line->date_end=$date_end;
|
||||
|
||||
@ -470,8 +470,8 @@ class Propal extends CommonObject
|
||||
* @param int $pa_ht Price (without tax) of product when it was bought
|
||||
* @param string $label ???
|
||||
* @param int $type 0/1=Product/service
|
||||
* @param timestamp $date_start Start date of the line
|
||||
* @param timestamp $date_end End date of the line
|
||||
* @param timestamp $date_start Start date of the line
|
||||
* @param timestamp $date_end End date of the line
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='')
|
||||
@ -552,7 +552,7 @@ class Propal extends CommonObject
|
||||
// infos marge
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
|
||||
$this->line->date_start=$date_start;
|
||||
$this->line->date_end=$date_end;
|
||||
|
||||
@ -830,7 +830,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
@ -1164,7 +1164,7 @@ class Propal extends CommonObject
|
||||
$line->product_label = $objp->product_label;
|
||||
$line->product_desc = $objp->product_desc; // Description produit
|
||||
$line->fk_product_type = $objp->fk_product_type;
|
||||
|
||||
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
|
||||
@ -1195,7 +1195,7 @@ class Propal extends CommonObject
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$this->array_options['options_'.$key]=$label;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1209,7 +1209,7 @@ class Propal extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update value of extrafields on the proposal
|
||||
*
|
||||
@ -1235,7 +1235,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
return 1;
|
||||
@ -1244,7 +1244,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1262,16 +1262,16 @@ class Propal extends CommonObject
|
||||
$now=dol_now();
|
||||
|
||||
if ($user->rights->propale->valider)
|
||||
{
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Numbering module definition
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->socid);
|
||||
|
||||
|
||||
// Class of company linked to propal
|
||||
$result=$soc->set_as_client();
|
||||
|
||||
|
||||
// Define new ref
|
||||
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
|
||||
{
|
||||
@ -1648,7 +1648,7 @@ class Propal extends CommonObject
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
// Define output language
|
||||
@ -1674,7 +1674,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
// Define output language
|
||||
@ -1688,7 +1688,7 @@ class Propal extends CommonObject
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
@ -1769,9 +1769,9 @@ class Propal extends CommonObject
|
||||
/**
|
||||
* Return list of proposal (eventually filtered on user) into an array
|
||||
*
|
||||
* @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref)
|
||||
* @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name)
|
||||
* @param int $draft 0=not draft, 1=draft
|
||||
* @param int $notcurrentuser 0=current user, 1=not current user
|
||||
* @param int $notcurrentuser 0=all user, 1=not current user
|
||||
* @param int $socid Id third pary
|
||||
* @param int $limit For pagination
|
||||
* @param int $offset For pagination
|
||||
@ -1785,15 +1785,22 @@ class Propal extends CommonObject
|
||||
|
||||
$ga = array();
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql.= " p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
|
||||
$sql.= " p.datep as dp, p.fin_validite as datelimite";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.fk_statut = c.id";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if ($draft) $sql.= " AND p.fk_statut = 0";
|
||||
if ($notcurrentuser) $sql.= " AND p.fk_user_author <> ".$user->id;
|
||||
if ($notcurrentuser > 0) $sql.= " AND p.fk_user_author <> ".$user->id;
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
$sql.= $this->db->plimit($limit,$offset);
|
||||
|
||||
@ -1808,14 +1815,19 @@ class Propal extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
if ($shortlist)
|
||||
if ($shortlist == 1)
|
||||
{
|
||||
$ga[$obj->propalid] = $obj->ref;
|
||||
}
|
||||
else
|
||||
else if ($shortlist == 2)
|
||||
{
|
||||
$ga[$obj->propalid] = $obj->ref.' ('.$obj->name.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ga[$i]['id'] = $obj->propalid;
|
||||
$ga[$i]['ref'] = $obj->ref;
|
||||
$ga[$i]['name'] = $obj->name;
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -2640,7 +2652,7 @@ class PropaleLigne
|
||||
var $localtax2_tx;
|
||||
var $total_localtax1;
|
||||
var $total_localtax2;
|
||||
|
||||
|
||||
var $date_start;
|
||||
var $date_end;
|
||||
|
||||
@ -2713,7 +2725,7 @@ class PropaleLigne
|
||||
$this->libelle = $objp->product_label; // deprecated
|
||||
$this->product_label = $objp->product_label;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ if (! $sortfield) $sortfield='p.datep';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid, s.client, ';
|
||||
$sql = 'SELECT s.rowid, s.nom, s.client, ';
|
||||
$sql.= 'p.rowid as propalid, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= ' u.login';
|
||||
|
||||
@ -761,7 +761,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
@ -933,7 +933,7 @@ class Commande extends CommonOrder
|
||||
$line->rang = $object->lines[$i]->rang;
|
||||
$line->special_code = $object->lines[$i]->special_code;
|
||||
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
|
||||
|
||||
|
||||
$line->date_start = $object->lines[$i]->date_start;
|
||||
$line->date_end = $object->lines[$i]->date_end;
|
||||
|
||||
@ -1972,23 +1972,38 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Return list of orders (eventuelly filtered on a user) into an array
|
||||
*
|
||||
* @param int $brouillon 0=non brouillon, 1=brouillon
|
||||
* @param User $user Objet user de filtre
|
||||
* @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name)
|
||||
* @param int $draft 0=not draft, 1=draft
|
||||
* @param User $excluser Objet user to exclude
|
||||
* @param int $socid Id third pary
|
||||
* @param int $limit For pagination
|
||||
* @param int $offset For pagination
|
||||
* @param string $sortfield Sort criteria
|
||||
* @param string $sortorder Sort order
|
||||
* @return int -1 if KO, array with result if OK
|
||||
*/
|
||||
function liste_array($brouillon=0, $user='')
|
||||
function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC')
|
||||
{
|
||||
global $conf;
|
||||
global $conf,$user;
|
||||
|
||||
$ga = array();
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid, c.ref";
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql.= " c.rowid as cid, c.ref";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
if ($brouillon) $sql.= " AND c.fk_statut = 0";
|
||||
if ($user) $sql.= " AND c.fk_user_author <> ".$user->id;
|
||||
$sql .= " ORDER BY c.date_commande DESC";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if ($draft) $sql.= " AND c.fk_statut = 0";
|
||||
if (is_object($excluser)) $sql.= " AND c.fk_user_author <> ".$excluser->id;
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
$sql.= $this->db->plimit($limit,$offset);
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
@ -2001,7 +2016,20 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$ga[$obj->rowid] = $obj->ref;
|
||||
if ($shortlist == 1)
|
||||
{
|
||||
$ga[$obj->cid] = $obj->ref;
|
||||
}
|
||||
else if ($shortlist == 2)
|
||||
{
|
||||
$ga[$obj->cid] = $obj->ref.' ('.$obj->name.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ga[$i]['id'] = $obj->cid;
|
||||
$ga[$i]['ref'] = $obj->ref;
|
||||
$ga[$i]['name'] = $obj->name;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -2781,7 +2809,7 @@ class Commande extends CommonOrder
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update value of extrafields on the proposal
|
||||
*
|
||||
@ -2807,7 +2835,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
return 1;
|
||||
@ -2816,7 +2844,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/commande/fiche.php
|
||||
* \ingroup commande
|
||||
* \brief Page to show customer order
|
||||
*/
|
||||
* \ingroup commande
|
||||
* \brief Page to show customer order
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
@ -1302,7 +1302,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
|
||||
|
||||
$num=count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
@ -2664,6 +2664,80 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of invoices (eventually filtered on a user) into an array
|
||||
*
|
||||
* @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name)
|
||||
* @param int $draft 0=not draft, 1=draft
|
||||
* @param User $excluser Objet user to exclude
|
||||
* @param int $socid Id third pary
|
||||
* @param int $limit For pagination
|
||||
* @param int $offset For pagination
|
||||
* @param string $sortfield Sort criteria
|
||||
* @param string $sortorder Sort order
|
||||
* @return int -1 if KO, array with result if OK
|
||||
*/
|
||||
function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC')
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
$ga = array();
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql.= " f.rowid as fid, f.facnumber as ref, f.datef as df";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if ($draft) $sql.= " AND f.fk_statut = 0";
|
||||
if (is_object($excluser)) $sql.= " AND f.fk_user_author <> ".$excluser->id;
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
$sql.= $this->db->plimit($limit,$offset);
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$numc = $this->db->num_rows($result);
|
||||
if ($numc)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $numc)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
if ($shortlist == 1)
|
||||
{
|
||||
$ga[$obj->fid] = $obj->ref;
|
||||
}
|
||||
else if ($shortlist == 2)
|
||||
{
|
||||
$ga[$obj->fid] = $obj->ref.' ('.$obj->name.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ga[$i]['id'] = $obj->fid;
|
||||
$ga[$i]['ref'] = $obj->ref;
|
||||
$ga[$i]['name'] = $obj->name;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $ga;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi liste des factures remplacables
|
||||
* Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee
|
||||
|
||||
@ -117,7 +117,7 @@ class HookManager
|
||||
* @param Object &$object Object to use hooks on
|
||||
* @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
|
||||
* @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
|
||||
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Must always return an int and things to print into ->resprints.
|
||||
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints.
|
||||
* Can also return some values into an array ->results.
|
||||
* $this->error or this->errors are also defined by class called by this function if error.
|
||||
*/
|
||||
@ -131,7 +131,7 @@ class HookManager
|
||||
// Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated.
|
||||
$hooktype='output';
|
||||
if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
|
||||
if (in_array($method,array('doActions','formObjectOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices'))) $hooktype='addreplace';
|
||||
if (in_array($method,array('doActions','formObjectOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices','printSearchForm'))) $hooktype='addreplace';
|
||||
|
||||
// Loop on each hook to qualify modules that declared context
|
||||
$modulealreadyexecuted=array();
|
||||
|
||||
@ -542,8 +542,6 @@ class FormFile
|
||||
{
|
||||
if (empty($noform)) $out.= '</form>'."\n";
|
||||
}
|
||||
|
||||
$out.='</div>';
|
||||
}
|
||||
$out.= '<!-- End show_document -->'."\n";
|
||||
//return ($i?$i:$headershown);
|
||||
|
||||
@ -50,20 +50,24 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
|
||||
|
||||
print '<body style="margin: 10px; text-align: center">'."\n";
|
||||
print '<center><br>';
|
||||
print '<body style="margin: 30px; height: 100%;">'."\n";
|
||||
//print '<br>';
|
||||
|
||||
$nbofsearch=0;
|
||||
|
||||
// Define $searchform
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("companies");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
|
||||
$nbofsearch++;
|
||||
}
|
||||
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("companies");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
|
||||
$nbofsearch++;
|
||||
}
|
||||
|
||||
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
||||
@ -71,6 +75,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em
|
||||
{
|
||||
$langs->load("products");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
|
||||
$nbofsearch++;
|
||||
}
|
||||
|
||||
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
||||
@ -78,27 +83,35 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em
|
||||
{
|
||||
$langs->load("products");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/liste.php', DOL_URL_ROOT.'/fourn/product/liste.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier');
|
||||
$nbofsearch++;
|
||||
}
|
||||
|
||||
if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire)
|
||||
{
|
||||
$langs->load("members");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall');
|
||||
$nbofsearch++;
|
||||
}
|
||||
|
||||
// Execute hook printSearchForm
|
||||
$parameters=array();
|
||||
$searchform.=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('printSearchForm',$parameters);
|
||||
if (empty($reshook)) $searchform.=$hookmanager->resPrint;
|
||||
else $searchform=$hookmanager->resPrint;
|
||||
|
||||
print '<style>.menu_titre { padding-top: 10px; }</style>';
|
||||
|
||||
print "\n";
|
||||
print "<!-- Begin SearchForm -->\n";
|
||||
print '<div id="blockvmenusearch" class="blockvmenusearch">'."\n";
|
||||
print '<div class="center">';
|
||||
//print '<div id="distance"></div><div id="container" class="center">';
|
||||
print '<div id="blockvmenusearch">'."\n";
|
||||
print $searchform;
|
||||
print '</div>'."\n";
|
||||
//print '</div></div>';
|
||||
print '</div>';
|
||||
print "<!-- End SearchForm -->\n";
|
||||
|
||||
print '</center>';
|
||||
print '</body></html>'."\n";
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -85,7 +85,7 @@ ProductsAndServicesArea=Espace Produits et Services
|
||||
ProductsArea=Espace Produits
|
||||
ServicesArea=Espace Services
|
||||
AddToMyProposals=Ajouter à mes propositions
|
||||
AddToOtherProposals=Ajouter aux autres propositions
|
||||
AddToOtherProposals=Ajouter propositions brouillons
|
||||
AddToMyBills=Ajouter à mes factures
|
||||
AddToOtherBills=Ajouter aux autres factures
|
||||
CorrectStock=Corriger stock
|
||||
|
||||
@ -53,7 +53,7 @@ PropalsToBill=Propositions commerciales signées à facturer
|
||||
ListOfProposals=Liste des devis/propositions commerciales
|
||||
ActionsOnPropal=Événements sur la proposition
|
||||
NoOpenedPropals=Pas de proposition ouverte
|
||||
NoOtherOpenedPropals=Pas d'autre proposition ouverte
|
||||
NoOtherOpenedPropals=Pas d'autre proposition brouillon
|
||||
RefProposal=Réf proposition commerciale
|
||||
SendPropalByMail=Envoi proposition commerciale par mail
|
||||
FileNotUploaded=Le fichier n'a pas été téléchargé
|
||||
|
||||
@ -1316,6 +1316,7 @@ print "\n</div><br>\n";
|
||||
if ($object->id && ($action == '' || $action == 'view') && $object->status)
|
||||
{
|
||||
print '<table width="100%" class="noborder">';
|
||||
//print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
// Propals
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->creer)
|
||||
@ -1324,113 +1325,41 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
|
||||
|
||||
$langs->load("propal");
|
||||
|
||||
print '<tr class="liste_titre"><td width="50%" class="liste_titre">';
|
||||
print $langs->trans("AddToMyProposals") . '</td>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AddToOtherProposals").'</td>';
|
||||
print '</tr><tr>';
|
||||
print '<td valign="top">';
|
||||
|
||||
if ($user->rights->societe->client->voir)
|
||||
$var=true;
|
||||
$otherprop = $propal->liste_array(2,1,0);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($otherprop) && count($otherprop))
|
||||
{
|
||||
print '<td width="50%" class="liste_titre">';
|
||||
print $langs->trans("AddToOtherProposals").'</td>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
print '<input type="hidden" name="action" value="addinpropal">';
|
||||
print $langs->trans("Proposals").'</td><td colspan="2">';
|
||||
print $form->selectarray("propalid", $otherprop, 0, 1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="50%" class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Liste de "Mes propals"
|
||||
print '<tr><td'.($user->rights->societe->client->voir?' width="50%"':'').' valign="top">';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.ref, p.datep as dp";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_statut = 0";
|
||||
$sql.= " AND p.fk_user_author = ".$user->id;
|
||||
$sql.= " ORDER BY p.datec DESC, p.tms DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=true;
|
||||
$num = $db->num_rows($result);
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addinpropal">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">';
|
||||
print "<a href=\"../comm/propal.php?id=".$objp->propalid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a></td>\n";
|
||||
print "<td><a href=\"../comm/fiche.php?socid=".$objp->socid."\">".dol_trunc($objp->nom,18)."</a></td>\n";
|
||||
print "<td nowrap=\"nowrap\">".dol_print_date($objp->dp,"%d %b")."</td>\n";
|
||||
print '<td><input type="hidden" name="propalid" value="'.$objp->propalid.'">';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
if (isset($object->stock_proposition)) print " ".$object->stock_proposition;
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOpenedPropals");
|
||||
print "</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherOpenedPropals");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->societe->client->voir)
|
||||
{
|
||||
// Liste de "Other propals"
|
||||
print '<td width="50%" valign="top">';
|
||||
|
||||
$var=true;
|
||||
$otherprop = $propal->liste_array(1,1,1);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($otherprop) && count($otherprop))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="3">';
|
||||
print '<input type="hidden" name="action" value="addinpropal">';
|
||||
print $langs->trans("OtherPropals").'</td><td>';
|
||||
print $form->selectarray("propalid", $otherprop);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap" colspan="2">'.$langs->trans("Qty");
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherOpenedPropals");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1441,261 +1370,87 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
|
||||
|
||||
$langs->load("orders");
|
||||
|
||||
print '<tr class="liste_titre"><td width="50%" class="liste_titre">';
|
||||
print $langs->trans("AddToMyOrders").'</td>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
|
||||
print '</tr><tr>';
|
||||
print '<td valign="top">';
|
||||
|
||||
if ($user->rights->societe->client->voir)
|
||||
$var=true;
|
||||
$othercom = $commande->liste_array(2, 1, null);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($othercom) && count($othercom))
|
||||
{
|
||||
print '<td width="50%" class="liste_titre">';
|
||||
print $langs->trans("AddToOtherOrders").'</td>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
print '<input type="hidden" name="action" value="addincommande">';
|
||||
print $langs->trans("Orders").'</td><td colspan="2">';
|
||||
print $form->selectarray("commandeid", $othercom, 0, 1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="50%" class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Liste de "Mes commandes"
|
||||
print '<tr><td'.($user->rights->societe->client->voir?' width="50%"':'').' valign="top">';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, c.rowid as commandeid, c.ref, c.date_commande as dc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 0";
|
||||
$sql.= " AND c.fk_user_author = ".$user->id;
|
||||
$sql.= " ORDER BY c.date_creation DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objc = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addincommande">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">';
|
||||
print "<a href=\"../commande/fiche.php?id=".$objc->commandeid."\">".img_object($langs->trans("ShowOrder"),"order")." ".$objc->ref."</a></td>\n";
|
||||
print "<td><a href=\"../comm/fiche.php?socid=".$objc->socid."\">".dol_trunc($objc->nom,18)."</a></td>\n";
|
||||
print "<td nowrap=\"nowrap\">".dol_print_date($db->jdate($objc->dc),"%d %b")."</td>\n";
|
||||
print '<td><input type="hidden" name="commandeid" value="'.$objc->commandeid.'">';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
if (isset($object->stock_proposition)) print " ".$object->stock_proposition;
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOpenedOrders");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherOpenedOrders");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->societe->client->voir)
|
||||
{
|
||||
// Liste de "Other orders"
|
||||
print '<td width="50%" valign="top">';
|
||||
|
||||
$var=true;
|
||||
$othercom = $commande->liste_array(1, $user);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($othercom) && count($othercom))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="3">';
|
||||
print '<input type="hidden" name="action" value="addincommande">';
|
||||
print $langs->trans("OtherOrders").'</td><td>';
|
||||
print $form->selectarray("commandeid", $othercom);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("Qty");
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherOpenedOrders");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Factures
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
||||
{
|
||||
print '<tr class="liste_titre"><td width="50%" class="liste_titre">';
|
||||
print $langs->trans("AddToMyBills").'</td>';
|
||||
$invoice = new Facture($db);
|
||||
|
||||
if ($user->rights->societe->client->voir)
|
||||
{
|
||||
print '<td width="50%" class="liste_titre">';
|
||||
print $langs->trans("AddToOtherBills").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="50%" class="liste_titre"> </td>';
|
||||
}
|
||||
$langs->load("bills");
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Liste de Mes factures
|
||||
print '<tr><td'.($user->rights->societe->client->voir?' width="50%"':'').' valign="top">';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_statut = 0";
|
||||
$sql.= " AND f.fk_user_author = ".$user->id;
|
||||
$sql.= " ORDER BY f.datec DESC, f.rowid DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addinfacture">';
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td nowrap>";
|
||||
print "<a href=\"../compta/facture.php?facid=".$objp->factureid."\">".img_object($langs->trans("ShowBills"),"bill")." ".$objp->facnumber."</a></td>\n";
|
||||
print "<td><a href=\"../comm/fiche.php?socid=".$objp->socid."\">".dol_trunc($objp->nom,18)."</a></td>\n";
|
||||
print "<td nowrap=\"nowrap\">".dol_print_date($db->jdate($objp->df),"%d %b")."</td>\n";
|
||||
print '<td><input type="hidden" name="factureid" value="'.$objp->factureid.'">';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoDraftBills");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->societe->client->voir)
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
|
||||
print '<td width="50%" valign="top">';
|
||||
|
||||
// Liste de Autres factures
|
||||
$var=true;
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_statut = 0";
|
||||
$sql.= " AND f.fk_user_author <> ".$user->id;
|
||||
$sql.= " ORDER BY f.datec DESC, f.rowid DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addinfacture">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td><a href=\"../compta/facture.php?facid=".$objp->factureid."\">$objp->facnumber</a></td>\n";
|
||||
print "<td><a href=\"../comm/fiche.php?socid=".$objp->socid."\">".dol_trunc($objp->nom,24)."</a></td>\n";
|
||||
print "<td colspan=\"2\">".$langs->trans("Qty");
|
||||
print "</td>";
|
||||
print '<td><input type="hidden" name="factureid" value="'.$objp->factureid.'">';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherDraftBills");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
|
||||
print '</tr><tr>';
|
||||
print '<td valign="top">';
|
||||
|
||||
$var=true;
|
||||
$otherinvoice = $invoice->liste_array(2, 1, null);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($otherinvoice) && count($otherinvoice))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
print '<input type="hidden" name="action" value="addinfacture">';
|
||||
print $langs->trans("Invoice").'</td><td colspan="2">';
|
||||
print $form->selectarray("factureid", $otherinvoice, 0, 1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherDraftBills");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user