2005-04-11 18:00:06 +02:00
< ? php
/* Copyright ( C ) 2001 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2012-01-19 09:53:27 +01:00
* Copyright ( C ) 2004 - 2012 Laurent Destailleur < eldy @ users . sourceforge . net >
2018-10-27 14:43:12 +02:00
* Copyright ( C ) 2005 - 2007 Regis Houssin < regis . houssin @ inodbox . com >
2010-08-16 15:13:15 +02:00
* Copyright ( C ) 2010 Juanjo Menent < jmenent @ 2 byte . es >
2012-12-05 19:51:25 +01:00
* Copyright ( C ) 2012 Christophe Battarel < christophe . battarel @ altairis . fr >
2013-09-10 16:43:06 +02:00
* Copyright ( C ) 2013 Cédric Salvador < csalvador @ gpcsolutions . fr >
2005-04-11 18:00:06 +02:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2005-04-11 18:00:06 +02:00
* ( 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
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2005-04-11 18:00:06 +02:00
*/
/**
2014-09-18 20:33:37 +02:00
* \file htdocs / fourn / product / list . php
2010-05-28 20:28:52 +02:00
* \ingroup produit
2016-09-11 14:04:03 +02:00
* \brief Page to list supplier products and services
2010-05-28 20:28:52 +02:00
*/
2005-04-11 18:00:06 +02:00
2012-08-22 23:24:21 +02:00
require '../../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php' ;
2005-04-11 18:00:06 +02:00
2019-11-08 10:53:31 +01:00
$langs -> loadLangs ( array ( " products " , " suppliers " ));
2005-04-11 18:00:06 +02:00
2020-11-05 14:10:46 +01:00
$sref = GETPOST ( 'sref' , 'alphanohtml' );
2013-09-10 16:43:06 +02:00
$sRefSupplier = GETPOST ( 'srefsupplier' );
2020-11-05 14:10:46 +01:00
$snom = GETPOST ( 'snom' , 'alphanohtml' );
$type = GETPOST ( 'type' , 'alphanohtml' );
2019-01-27 11:55:16 +01:00
$optioncss = GETPOST ( 'optioncss' , 'alpha' );
2005-04-11 18:00:06 +02:00
2017-06-07 16:44:04 +02:00
// Load variable for pagination
2019-11-08 10:53:31 +01:00
$limit = GETPOST ( 'limit' , 'int' ) ? GETPOST ( 'limit' , 'int' ) : $conf -> liste_limit ;
2020-09-18 17:13:01 +02:00
$sortfield = GETPOST ( 'sortfield' , 'aZ09comma' );
2020-09-17 14:31:25 +02:00
$sortorder = GETPOST ( 'sortorder' , 'aZ09comma' );
2020-03-13 13:07:11 +01:00
$page = GETPOSTISSET ( 'pageplusone' ) ? ( GETPOST ( 'pageplusone' ) - 1 ) : GETPOST ( " page " , 'int' );
2021-02-25 23:21:30 +01:00
if ( empty ( $page ) || $page == - 1 ) {
$page = 0 ;
} // If $page is not defined, or '' or -1
2017-06-07 16:44:04 +02:00
$offset = $limit * $page ;
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2021-02-25 23:21:30 +01:00
if ( ! $sortfield ) {
$sortfield = " p.ref " ; // Set here default search field
}
if ( ! $sortorder ) {
$sortorder = " ASC " ;
}
2005-04-11 18:00:06 +02:00
2017-06-07 16:44:04 +02:00
$fourn_id = GETPOST ( 'fourn_id' , 'intcomma' );
2021-02-25 23:21:30 +01:00
if ( $user -> socid ) {
$fourn_id = $user -> socid ;
}
2017-12-01 19:29:29 +01:00
2017-06-07 16:44:04 +02:00
$catid = GETPOST ( 'catid' , 'intcomma' );
2006-08-19 01:16:40 +02:00
2017-06-07 16:44:04 +02:00
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager -> initHooks ( array ( 'supplierpricelist' ));
$extrafields = new ExtraFields ( $db );
2005-04-11 18:00:06 +02:00
2022-06-09 11:12:45 +02:00
if ( empty ( $user -> rights -> produit -> lire ) && empty ( $user -> rights -> service -> lire )) {
accessforbidden ();
}
2005-04-11 18:00:06 +02:00
2022-06-09 11:12:45 +02:00
$permissiontoadd = ( $user -> hasRight ( 'produit' , 'lire' ) || $user -> hasRight ( 'service' , 'lire' ));
2005-04-28 22:33:30 +02:00
2005-04-13 16:47:41 +02:00
2017-06-07 16:44:04 +02:00
/*
2022-06-09 11:12:45 +02:00
* Actions
2017-06-07 16:44:04 +02:00
*/
2021-02-25 23:21:30 +01:00
if ( GETPOST ( 'cancel' , 'alpha' )) {
$action = 'list' ; $massaction = '' ;
}
if ( ! GETPOST ( 'confirmmassaction' , 'alpha' ) && $massaction != 'presend' && $massaction != 'confirm_presend' ) {
$massaction = '' ;
}
2017-06-07 16:44:04 +02:00
2019-11-08 10:53:31 +01:00
$parameters = array ();
2019-07-18 18:09:37 +02:00
2019-11-08 10:53:31 +01:00
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2021-02-25 23:21:30 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2008-12-28 21:43:24 +01:00
2021-02-25 23:21:30 +01:00
if ( empty ( $reshook )) {
2020-10-31 14:32:18 +01:00
// Selection of new fields
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php' ;
// Purge search criteria
2021-02-25 23:21:30 +01:00
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) { // All tests are required to be compatible with all browsers
2020-10-31 14:32:18 +01:00
$sref = '' ;
$sRefSupplier = '' ;
$snom = '' ;
$search_field1 = '' ;
$search_field2 = '' ;
$search_date_creation = '' ;
$search_date_update = '' ;
2022-05-08 18:25:22 +02:00
$toselect = array ();
2020-10-31 14:32:18 +01:00
$search_array_options = array ();
}
2017-06-07 16:44:04 +02:00
}
2008-12-28 21:43:24 +01:00
2005-04-11 18:00:06 +02:00
/*
2017-06-07 16:44:04 +02:00
* View
*/
2005-04-11 18:00:06 +02:00
2017-06-07 16:44:04 +02:00
$form = new Form ( $db );
2008-12-28 21:43:24 +01:00
$productstatic = new Product ( $db );
$companystatic = new Societe ( $db );
2021-05-31 10:31:25 +02:00
$title = $langs -> trans ( 'Supplier' ) . " - " . $langs -> trans ( 'ProductsAndServices' );
2005-04-11 18:00:06 +02:00
2021-02-25 23:21:30 +01:00
if ( $fourn_id ) {
2008-08-29 21:01:20 +02:00
$supplier = new Fournisseur ( $db );
$supplier -> fetch ( $fourn_id );
}
2017-06-07 16:44:04 +02:00
2019-11-08 10:53:31 +01:00
$arrayofmassactions = array (
2021-04-14 14:45:55 +02:00
'generate_doc' => img_picto ( '' , 'pdf' , 'class="pictofixedwidth"' ) . $langs -> trans ( " ReGeneratePDF " ),
'builddoc' => img_picto ( '' , 'pdf' , 'class="pictofixedwidth"' ) . $langs -> trans ( " PDFMerge " ),
'presend' => img_picto ( '' , 'email' , 'class="pictofixedwidth"' ) . $langs -> trans ( " SendByMail " ),
2017-06-07 16:44:04 +02:00
);
2021-02-25 23:21:30 +01:00
if ( $user -> rights -> mymodule -> supprimer ) {
2021-04-14 14:45:55 +02:00
$arrayofmassactions [ 'predelete' ] = img_picto ( '' , 'delete' , 'class="pictofixedwidth"' ) . $langs -> trans ( " Delete " );
2021-02-25 23:21:30 +01:00
}
if ( in_array ( $massaction , array ( 'presend' , 'predelete' ))) {
$arrayofmassactions = array ();
}
2019-11-08 10:53:31 +01:00
$massactionbutton = $form -> selectMassAction ( '' , $arrayofmassactions );
2017-06-07 16:44:04 +02:00
2020-11-05 14:10:46 +01:00
$sql = " SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity, p.tosell, p.tobuy, p.barcode, p.fk_barcode_type, " ;
2019-11-08 10:53:31 +01:00
$sql .= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice, " ;
$sql .= " s.rowid as socid, s.nom as name " ;
2019-07-09 18:00:54 +02:00
// Add fields to SELECT from hooks
$parameters = array ();
2019-07-18 18:09:37 +02:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListSelect' , $parameters , $object , $action );
2021-02-25 23:21:30 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2019-07-09 18:00:54 +02:00
$sql .= $hookmanager -> resPrint ;
2019-11-08 10:53:31 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " product as p " ;
2021-02-25 23:21:30 +01:00
if ( $catid ) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " categorie_product as cp ON cp.fk_product = p.rowid " ;
}
2021-06-11 17:40:04 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " product_fournisseur_price as ppf ON p.rowid = ppf.fk_product AND p.entity = ppf.entity " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " societe as s ON ppf.fk_soc = s.rowid AND s.entity IN ( " . getEntity ( 'societe' ) . " ) " ;
2019-11-08 10:53:31 +01:00
$sql .= " WHERE p.entity IN ( " . getEntity ( 'product' ) . " ) " ;
2021-02-25 23:21:30 +01:00
if ( $sRefSupplier ) {
2014-02-17 17:32:25 +01:00
$sql .= natural_search ( 'ppf.ref_fourn' , $sRefSupplier );
2005-04-11 18:00:06 +02:00
}
2021-02-25 23:21:30 +01:00
if ( GETPOST ( 'type' )) {
2019-11-08 10:53:31 +01:00
$sql .= " AND p.fk_product_type = " . GETPOST ( 'type' , 'int' );
2005-04-11 18:00:06 +02:00
}
2021-02-25 23:21:30 +01:00
if ( $sref ) {
2014-02-17 17:32:25 +01:00
$sql .= natural_search ( 'p.ref' , $sref );
}
2021-02-25 23:21:30 +01:00
if ( $snom ) {
2015-12-27 15:12:02 +01:00
$sql .= natural_search ( 'p.label' , $snom );
2014-02-17 17:32:25 +01:00
}
2021-02-25 23:21:30 +01:00
if ( $catid ) {
2021-06-09 15:36:47 +02:00
$sql .= " AND cp.fk_categorie = " . (( int ) $catid );
2013-09-10 16:43:06 +02:00
}
2021-02-25 23:21:30 +01:00
if ( $fourn_id > 0 ) {
2021-06-09 15:36:47 +02:00
$sql .= " AND ppf.fk_soc = " . (( int ) $fourn_id );
2005-04-11 18:00:06 +02:00
}
2018-04-24 11:37:57 +02:00
2019-07-09 18:00:54 +02:00
// Add WHERE filters from hooks
$parameters = array ();
2019-07-18 18:09:37 +02:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListWhere' , $parameters );
2021-02-25 23:21:30 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2019-07-09 18:00:54 +02:00
$sql .= $hookmanager -> resPrint ;
2019-01-27 11:55:16 +01:00
$sql .= $db -> order ( $sortfield , $sortorder );
2018-04-24 11:37:57 +02:00
2014-11-23 00:51:13 +01:00
// Count total nb of records without orderby and limit
2017-01-15 20:49:20 +01:00
$nbtotalofrecords = '' ;
2021-02-25 23:21:30 +01:00
if ( empty ( $conf -> global -> MAIN_DISABLE_FULL_SCANLIST )) {
2020-10-31 14:32:18 +01:00
$result = $db -> query ( $sql );
$nbtotalofrecords = $db -> num_rows ( $result );
2021-02-25 23:21:30 +01:00
if (( $page * $limit ) > $nbtotalofrecords ) { // if total resultset is smaller then paging size (filtering), goto and load page 0
2020-10-31 14:32:18 +01:00
$page = 0 ;
$offset = 0 ;
}
2014-11-23 00:51:13 +01:00
}
2018-04-24 11:37:57 +02:00
2012-01-19 09:53:27 +01:00
$sql .= $db -> plimit ( $limit + 1 , $offset );
2005-04-11 18:00:06 +02:00
2014-09-18 20:33:37 +02:00
dol_syslog ( " fourn/product/list.php: " , LOG_DEBUG );
2011-09-20 15:32:16 +02:00
$resql = $db -> query ( $sql );
2021-02-25 23:21:30 +01:00
if ( $resql ) {
2006-08-07 04:20:57 +02:00
$num = $db -> num_rows ( $resql );
2005-04-11 18:00:06 +02:00
2006-08-07 04:20:57 +02:00
$i = 0 ;
2005-04-13 15:39:51 +02:00
2021-02-25 23:21:30 +01:00
if ( $num == 1 && ( GETPOST ( " mode " ) == 'search' )) {
2006-08-07 04:20:57 +02:00
$objp = $db -> fetch_object ( $resql );
2014-09-18 21:18:25 +02:00
header ( " Location: " . DOL_URL_ROOT . " /product/card.php?id= " . $objp -> rowid );
2006-08-07 04:20:57 +02:00
exit ;
}
2005-06-11 13:34:38 +02:00
2021-02-25 23:21:30 +01:00
if ( ! empty ( $supplier -> id )) {
$texte = $langs -> trans ( " ListOfSupplierProductForSupplier " , $supplier -> name );
} else {
$texte = $langs -> trans ( " List " );
}
2008-08-29 21:01:20 +02:00
2019-01-27 11:55:16 +01:00
llxHeader ( " " , " " , $texte );
2005-04-14 10:22:16 +02:00
2020-11-05 14:10:46 +01:00
$param = " &sref= " . $sref . " &snom= " . $snom . " &fourn_id= " . $fourn_id . ( isset ( $type ) ? " &type= " . $type : " " ) . ( empty ( $sRefSupplier ) ? " " : " &srefsupplier= " . $sRefSupplier );
2021-02-25 23:21:30 +01:00
if ( $optioncss != '' ) {
$param .= '&optioncss=' . $optioncss ;
}
2022-06-09 11:12:45 +02:00
$newcardbutton = '' ;
$newcardbutton .= dolGetButtonTitle ( $langs -> trans ( 'New' ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/product/list.php?action=create&backtopage=' . urlencode ( $_SERVER [ 'PHP_SELF' ]), '' , $permissiontoadd );
print_barre_liste ( $texte , $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , '' , $num , $nbtotalofrecords , 'generic' , 0 , $newcardbutton );
2005-04-11 18:00:06 +02:00
2021-02-25 23:21:30 +01:00
if ( ! empty ( $catid )) {
2006-08-07 04:20:57 +02:00
print " <div id='ways'> " ;
2014-08-01 14:26:13 +02:00
$c = new Categorie ( $db );
2019-01-27 11:55:16 +01:00
$ways = $c -> print_all_ways ( ' > ' , 'fourn/product/list.php' );
2010-03-16 00:54:37 +01:00
print " > " . $ways [ 0 ] . " <br> \n " ;
print " </div><br> " ;
2005-04-14 12:37:39 +02:00
}
2006-08-07 04:20:57 +02:00
2014-02-17 17:32:25 +01:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="post">' ;
2021-02-25 23:21:30 +01:00
if ( $optioncss != '' ) {
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">' ;
}
2019-12-18 23:12:31 +01:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2021-02-25 23:21:30 +01:00
if ( $fourn_id > 0 ) {
print '<input type="hidden" name="fourn_id" value="' . $fourn_id . '">' ;
}
2014-02-17 17:32:25 +01:00
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
2020-10-31 14:32:18 +01:00
print '<input type="hidden" name="page" value="' . $page . '">' ;
2014-02-17 17:32:25 +01:00
print '<input type="hidden" name="type" value="' . $type . '">' ;
2006-08-07 04:20:57 +02:00
2019-11-08 10:53:31 +01:00
$topicmail = " Information " ;
$modelmail = " product " ;
$objecttmp = new Product ( $db );
$trackid = 'prod' . $object -> id ;
2017-11-15 11:39:11 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php' ;
2022-01-14 20:26:56 +01:00
print '<div class="div-table-responsive-no-min">' ;
2019-11-05 21:24:41 +01:00
print '<table class="liste centpercent">' ;
2006-08-07 04:20:57 +02:00
2019-07-05 21:37:25 +02:00
// Fields title search
2006-08-07 04:20:57 +02:00
print '<tr class="liste_titre">' ;
print '<td class="liste_titre">' ;
2020-11-05 14:10:46 +01:00
print '<input class="flat maxwidth100" type="text" name="sref" value="' . $sref . '">' ;
2006-08-07 04:20:57 +02:00
print '</td>' ;
2008-08-29 23:16:34 +02:00
print '<td class="liste_titre">' ;
2020-11-05 14:10:46 +01:00
print '<input class="flat maxwidth100" type="text" name="srefsupplier" value="' . $sRefSupplier . '">' ;
2007-10-26 10:58:36 +02:00
print '</td>' ;
2008-08-29 23:16:34 +02:00
print '<td class="liste_titre">' ;
2020-11-05 14:10:46 +01:00
print '<input class="flat maxwidth100" type="text" name="snom" value="' . $snom . '">' ;
2006-08-07 04:20:57 +02:00
print '</td>' ;
2017-06-07 16:44:04 +02:00
print '<td></td>' ;
print '<td></td>' ;
print '<td></td>' ;
print '<td></td>' ;
2020-10-31 14:32:18 +01:00
// add filters from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldPreListTitle' , $parameters , $object , $action );
2021-02-25 23:21:30 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2020-10-31 14:32:18 +01:00
print $hookmanager -> resPrint ;
2019-05-19 13:51:47 +02:00
print '<td class="liste_titre maxwidthsearch">' ;
2019-11-08 10:53:31 +01:00
$searchpicto = $form -> showFilterButtons ();
2017-06-07 16:44:04 +02:00
print $searchpicto ;
2006-08-07 04:20:57 +02:00
print '</td>' ;
print '</tr>' ;
2019-07-05 21:50:35 +02:00
// Line for title
2017-06-07 16:44:04 +02:00
print '<tr class="liste_titre">' ;
2019-01-27 11:55:16 +01:00
print_liste_field_titre ( " Ref " , $_SERVER [ " PHP_SELF " ], " p.ref " , $param , " " , " " , $sortfield , $sortorder );
print_liste_field_titre ( " RefSupplierShort " , $_SERVER [ " PHP_SELF " ], " ppf.ref_fourn " , $param , " " , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Label " , $_SERVER [ " PHP_SELF " ], " p.label " , $param , " " , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Supplier " , $_SERVER [ " PHP_SELF " ], " ppf.fk_soc " , $param , " " , " " , $sortfield , $sortorder );
2019-03-07 20:46:38 +01:00
print_liste_field_titre ( " BuyingPrice " , $_SERVER [ " PHP_SELF " ], " ppf.price " , $param , " " , '' , $sortfield , $sortorder , 'right ' );
print_liste_field_titre ( " QtyMin " , $_SERVER [ " PHP_SELF " ], " ppf.quantity " , $param , " " , '' , $sortfield , $sortorder , 'right ' );
print_liste_field_titre ( " UnitPrice " , $_SERVER [ " PHP_SELF " ], " ppf.unitprice " , $param , " " , '' , $sortfield , $sortorder , 'right ' );
2019-07-09 18:00:54 +02:00
// add header cells from hooks
2020-10-31 14:32:18 +01:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListTitle' , $parameters , $object , $action );
2021-02-25 23:21:30 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2020-10-31 14:32:18 +01:00
print $hookmanager -> resPrint ;
2019-01-27 11:55:16 +01:00
print_liste_field_titre ( '' , $_SERVER [ " PHP_SELF " ]);
2017-06-07 16:44:04 +02:00
print " </tr> \n " ;
2021-02-25 23:21:30 +01:00
while ( $i < min ( $num , $limit )) {
2006-08-07 04:20:57 +02:00
$objp = $db -> fetch_object ( $resql );
2017-06-07 16:44:04 +02:00
2019-11-08 10:53:31 +01:00
$productstatic -> id = $objp -> rowid ;
$productstatic -> ref = $objp -> ref ;
$productstatic -> type = $objp -> fk_product_type ;
$productstatic -> entity = $objp -> entity ;
2020-09-09 19:01:45 +02:00
$productstatic -> status = $objp -> tosell ;
$productstatic -> status_buy = $objp -> tobuy ;
2020-11-05 14:10:46 +01:00
$productstatic -> barcode = $objp -> barcode ;
$productstatic -> barcode_type = $objp -> fk_barcode_type ;
print '<tr class="oddeven">' ;
print '<td>' ;
2019-01-27 11:55:16 +01:00
print $productstatic -> getNomUrl ( 1 , 'supplier' );
2008-12-28 21:43:24 +01:00
print '</td>' ;
2009-06-08 20:14:37 +02:00
2008-12-28 21:43:24 +01:00
print '<td>' . $objp -> ref_fourn . '</td>' ;
2009-06-08 20:14:37 +02:00
2008-12-28 21:43:24 +01:00
print '<td>' . $objp -> label . '</td>' . " \n " ;
2009-06-08 20:14:37 +02:00
2019-11-08 10:53:31 +01:00
$companystatic -> name = $objp -> name ;
$companystatic -> id = $objp -> socid ;
2013-05-24 18:49:40 +02:00
print '<td>' ;
2021-02-25 23:21:30 +01:00
if ( $companystatic -> id > 0 ) {
print $companystatic -> getNomUrl ( 1 , 'supplier' );
}
2013-05-24 18:49:40 +02:00
print '</td>' ;
2009-06-08 20:14:37 +02:00
2019-03-07 20:46:38 +01:00
print '<td class="right">' . ( isset ( $objp -> price ) ? price ( $objp -> price ) : '' ) . '</td>' ;
2009-06-08 20:14:37 +02:00
2019-03-07 20:46:38 +01:00
print '<td class="right">' . $objp -> qty . '</td>' ;
2009-06-08 20:14:37 +02:00
2019-03-07 20:46:38 +01:00
print '<td class="right">' . ( isset ( $objp -> unitprice ) ? price ( $objp -> unitprice ) : '' ) . '</td>' ;
2009-06-08 20:14:37 +02:00
2019-07-09 18:00:54 +02:00
// add additional columns from hooks
2020-10-31 14:32:18 +01:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListValue' , $parameters , $objp , $action );
2021-02-25 23:21:30 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2020-10-31 14:32:18 +01:00
print $hookmanager -> resPrint ;
2019-07-09 18:00:54 +02:00
2019-03-07 20:46:38 +01:00
print '<td class="right"></td>' ;
2017-06-07 16:44:04 +02:00
2006-08-07 04:20:57 +02:00
print " </tr> \n " ;
$i ++ ;
2005-04-14 12:37:39 +02:00
}
2006-08-07 04:20:57 +02:00
$db -> free ( $resql );
2005-04-14 12:37:39 +02:00
2022-06-09 11:12:45 +02:00
// If no record found
if ( $num == 0 ) {
$colspan = 8 ;
print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs -> trans ( " NoRecordFound " ) . '</span></td></tr>' ;
}
2022-01-14 20:26:56 +01:00
print " </table></div> " ;
2005-04-14 10:22:16 +02:00
2014-02-17 17:32:25 +01:00
print '</form>' ;
2020-05-21 15:05:19 +02:00
} else {
2009-02-20 23:53:15 +01:00
dol_print_error ( $db );
2005-04-11 18:00:06 +02:00
}
2018-08-13 10:20:21 +02:00
// End of page
2011-08-27 16:24:16 +02:00
llxFooter ();
2015-12-11 19:37:12 +01:00
$db -> close ();