29require 
'../main.inc.php';
 
   30require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
 
   31require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
 
   32require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
 
   33require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
 
   34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
 
   35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
 
   36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
 
   37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
 
   39$langs->loadLangs(array(
"sendings", 
"receptions", 
"deliveries", 
'companies', 
'bills', 
'orders'));
 
   41$socid = 
GETPOST(
'socid', 
'int');
 
   42$massaction = 
GETPOST(
'massaction', 
'alpha');
 
   43$toselect = 
GETPOST(
'toselect', 
'array');
 
   45$diroutputmassaction = $conf->reception->dir_output.
'/temp/massgeneration/'.$user->id;
 
   47$search_ref_rcp = 
GETPOST(
"search_ref_rcp");
 
   48$search_ref_liv = 
GETPOST(
'search_ref_liv');
 
   49$search_ref_supplier = 
GETPOST(
'search_ref_supplier');
 
   50$search_company = 
GETPOST(
"search_company");
 
   51$search_town = 
GETPOST(
'search_town', 
'alpha');
 
   52$search_zip = 
GETPOST(
'search_zip', 
'alpha');
 
   53$search_state = 
GETPOST(
"search_state");
 
   54$search_country = 
GETPOST(
"search_country", 
'int');
 
   55$search_type_thirdparty = 
GETPOST(
"search_type_thirdparty", 
'int');
 
   56$search_date_delivery_startday = 
GETPOST(
'search_date_delivery_startday', 
'int');
 
   57$search_date_delivery_startmonth = 
GETPOST(
'search_date_delivery_startmonth', 
'int');
 
   58$search_date_delivery_startyear = 
GETPOST(
'search_date_delivery_startyear', 
'int');
 
   59$search_date_delivery_endday = 
GETPOST(
'search_date_delivery_endday', 
'int');
 
   60$search_date_delivery_endmonth = 
GETPOST(
'search_date_delivery_endmonth', 
'int');
 
   61$search_date_delivery_endyear = 
GETPOST(
'search_date_delivery_endyear', 
'int');
 
   62$search_date_delivery_start = 
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); 
 
   63$search_date_delivery_end = 
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
 
   64$search_date_create_startday = 
GETPOST(
'search_date_create_startday', 
'int');
 
   65$search_date_create_startmonth = 
GETPOST(
'search_date_create_startmonth', 
'int');
 
   66$search_date_create_startyear = 
GETPOST(
'search_date_create_startyear', 
'int');
 
   67$search_date_create_endday = 
GETPOST(
'search_date_create_endday', 
'int');
 
   68$search_date_create_endmonth = 
GETPOST(
'search_date_create_endmonth', 
'int');
 
   69$search_date_create_endyear = 
GETPOST(
'search_date_create_endyear', 
'int');
 
   70$search_date_create_start = 
dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); 
 
   71$search_date_create_end = 
dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear);
 
   72$search_billed = 
GETPOST(
"search_billed", 
'int');
 
   73$sall = 
GETPOST(
'sall', 
'alphanohtml');
 
   74$optioncss = 
GETPOST(
'optioncss', 
'alpha');
 
   76$limit = 
GETPOST(
'limit', 
'int') ?
GETPOST(
'limit', 
'int') : $conf->liste_limit;
 
   77$sortfield = 
GETPOST(
'sortfield', 
'aZ09comma');
 
   78$sortorder = 
GETPOST(
'sortorder', 
'aZ09comma');
 
   79$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
   86if (empty($page) || $page == -1) {
 
   89$offset = $limit * $page;
 
   94$contextpage = 
'receptionlist';
 
   96$search_status = 
GETPOST(
'search_status', 
'intcomma');
 
  101$hookmanager->initHooks(array(
'receptionlist'));
 
  105$extrafields->fetch_name_optionals_label($object->table_element);
 
  106$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, 
'', 
'search_');
 
  109$fieldstosearchall = array(
 
  111  's.nom'=>
"ThirdParty",
 
  112  'e.note_public'=>
'NotePublic',
 
  114if (empty($user->socid)) {
 
  115  $fieldstosearchall[
"e.note_private"] = 
"NotePrivate";
 
  118$checkedtypetiers = 0;
 
  120  'e.ref'=>array(
'label'=>$langs->trans(
"Ref"), 
'checked'=>1),
 
  121  'e.ref_supplier'=>array(
'label'=>$langs->trans(
"RefSupplier"), 
'checked'=>1),
 
  122  's.nom'=>array(
'label'=>$langs->trans(
"ThirdParty"), 
'checked'=>1),
 
  123  's.town'=>array(
'label'=>$langs->trans(
"Town"), 
'checked'=>1),
 
  124  's.zip'=>array(
'label'=>$langs->trans(
"Zip"), 
'checked'=>1),
 
  125  'state.nom'=>array(
'label'=>$langs->trans(
"StateShort"), 
'checked'=>0),
 
  126  'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"), 
'checked'=>0),
 
  127  'typent.code'=>array(
'label'=>$langs->trans(
"ThirdPartyType"), 
'checked'=>$checkedtypetiers),
 
  128  'e.date_delivery'=>array(
'label'=>$langs->trans(
"DateDeliveryPlanned"), 
'checked'=>1),
 
  129  'e.datec'=>array(
'label'=>$langs->trans(
"DateCreation"), 
'checked'=>0, 
'position'=>500),
 
  130  'e.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"), 
'checked'=>0, 
'position'=>500),
 
  131  'e.fk_statut'=>array(
'label'=>$langs->trans(
"Status"), 
'checked'=>1, 
'position'=>1000),
 
  132  'e.billed'=>array(
'label'=>$langs->trans(
"Billed"), 
'checked'=>1, 
'position'=>1000, 
'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)))
 
  136include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
 
  144$receptionid = 
GETPOST(
'id', 
'int');
 
  146  $socid = $user->socid;
 
  156  $action = 
'list'; $massaction = 
'';
 
  158if (!
GETPOST(
'confirmmassaction') && $massaction != 
'confirm_createbills') {
 
  162$parameters = array(
'socid'=>$socid);
 
  163$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  168include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
 
  171if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) { 
 
  172  $search_ref_supplier = 
'';
 
  173  $search_ref_rcp = 
'';
 
  174  $search_ref_liv = 
'';
 
  175  $search_company = 
'';
 
  179  $search_country = 
'';
 
  180  $search_type_thirdparty = 
'';
 
  181  $search_date_delivery_startday = 
'';
 
  182  $search_date_delivery_startmonth = 
'';
 
  183  $search_date_delivery_startyear = 
'';
 
  184  $search_date_delivery_endday = 
'';
 
  185  $search_date_delivery_endmonth = 
'';
 
  186  $search_date_delivery_endyear = 
'';
 
  187  $search_date_delivery_start = 
'';
 
  188  $search_date_delivery_end = 
'';
 
  189  $search_date_create_startday = 
'';
 
  190  $search_date_create_startmonth = 
'';
 
  191  $search_date_create_startyear = 
'';
 
  192  $search_date_create_endday = 
'';
 
  193  $search_date_create_endmonth = 
'';
 
  194  $search_date_create_endyear = 
'';
 
  195  $search_date_create_start = 
'';
 
  196  $search_date_create_end = 
'';
 
  199  $search_array_options = array();
 
  202if (empty($reshook)) {
 
  204  $objectclass = 
'Reception';
 
  205  $objectlabel = 
'Receptions';
 
  206  $permissiontoread = $user->rights->reception->lire;
 
  207  $permissiontoadd = $user->rights->reception->creer;
 
  208  $permissiontodelete = $user->rights->reception->supprimer;
 
  209  $uploaddir = $conf->reception->multidir_output[$conf->entity];
 
  210  include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
 
  212  if ($massaction == 
'confirm_createbills') {
 
  213    $receptions = 
GETPOST(
'toselect', 
'array');
 
  214    $createbills_onebythird = 
GETPOST(
'createbills_onebythird', 
'int');
 
  215    $validate_invoices = 
GETPOST(
'validate_invoices', 
'int');
 
  220    $TFactThird = array();
 
  221    $TFactThirdNbLines = array();
 
  223    $nb_bills_created = 0;
 
  231    foreach ($receptions as $id_reception) {
 
  234      if ($rcp->fetch($id_reception) <= 0 || $rcp->statut == $rcp::STATUS_DRAFT) {
 
  235        $errors[] = $langs->trans(
'StatusOfRefMustBe', $rcp->ref, $langs->transnoentities(
"StatusReceptionValidatedShort"));
 
  241      if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
 
  243        $objecttmp = $TFactThird[$rcp->socid];
 
  246        $objecttmp->fetchObjectLinked();
 
  247        $rcp->fetchObjectLinked();
 
  248        if (count($rcp->linkedObjectsIds[
'order_supplier']) > 0) {
 
  249          foreach ($rcp->linkedObjectsIds[
'order_supplier'] as $key => $value) {
 
  250            if (empty($objecttmp->linkedObjectsIds[
'order_supplier']) || !in_array($value, $objecttmp->linkedObjectsIds[
'order_supplier'])) { 
 
  251              $objecttmp->add_object_linked(
'order_supplier', $value); 
 
  256        $cond_reglement_id = 0;
 
  257        $mode_reglement_id = 0;
 
  261        $transport_mode_id = 0;
 
  262        if (!empty($rcp->cond_reglement_id)) {
 
  263          $cond_reglement_id = $rcp->cond_reglement_id;
 
  265        if (!empty($rcp->mode_reglement_id)) {
 
  266          $mode_reglement_id = $rcp->mode_reglement_id;
 
  268        if (!empty($rcp->fk_account)) {
 
  269          $fk_account = $rcp->fk_account;
 
  271        if (!empty($rcp->remise_percent)) {
 
  272          $remise_percent = $rcp->remise_percent;
 
  274        if (!empty($rcp->remise_absolue)) {
 
  275          $remise_absolue = $rcp->remise_absolue;
 
  277        if (!empty($rcp->transport_mode_id)) {
 
  278          $transport_mode_id = $rcp->transport_mode_id;
 
  281        if (empty($cond_reglement_id)
 
  282          || empty($mode_reglement_id)
 
  283          || empty($fk_account)
 
  284          || empty($remise_percent)
 
  285          || empty($remise_absolue)
 
  286          || empty($transport_mode_id)
 
  288          if (!isset($rcp->supplier_order)) {
 
  289            $rcp->fetch_origin();
 
  293          if (!empty($rcp->commandeFournisseur)) {
 
  294            $supplierOrder = $rcp->commandeFournisseur;
 
  295            if (empty($cond_reglement_id) && !empty($supplierOrder->cond_reglement_id)) {
 
  296              $cond_reglement_id = $supplierOrder->cond_reglement_id;
 
  298            if (empty($mode_reglement_id) && !empty($supplierOrder->mode_reglement_id)) {
 
  299              $mode_reglement_id = $supplierOrder->mode_reglement_id;
 
  301            if (empty($fk_account) && !empty($supplierOrder->fk_account)) {
 
  302              $fk_account = $supplierOrder->fk_account;
 
  304            if (empty($remise_percent) && !empty($supplierOrder->remise_percent)) {
 
  305              $remise_percent = $supplierOrder->remise_percent;
 
  307            if (empty($remise_absolue) && !empty($supplierOrder->remise_absolue)) {
 
  308              $remise_absolue = $supplierOrder->remise_absolue;
 
  310            if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) {
 
  311              $transport_mode_id = $supplierOrder->transport_mode_id;
 
  316          if (!empty($rcp->thirdparty)) {
 
  317            $soc = $rcp->thirdparty;
 
  318            if (empty($cond_reglement_id) && !empty($soc->cond_reglement_supplier_id)) {
 
  319              $cond_reglement_id = $soc->cond_reglement_supplier_id;
 
  321            if (empty($mode_reglement_id) && !empty($soc->mode_reglement_supplier_id)) {
 
  322              $mode_reglement_id = $soc->mode_reglement_supplier_id;
 
  324            if (empty($fk_account) && !empty($soc->fk_account)) {
 
  325              $fk_account = $soc->fk_account;
 
  327            if (empty($remise_percent) && !empty($soc->remise_supplier_percent)) {
 
  328              $remise_percent = $soc->remise_supplier_percent;
 
  330            if (empty($remise_absolue) && !empty($soc->remise_absolue)) {
 
  331              $remise_absolue = $soc->remise_absolue;
 
  333            if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) {
 
  334              $transport_mode_id = $soc->transport_mode_id;
 
  340        $objecttmp->socid = $rcp->socid;
 
  341        $objecttmp->type = $objecttmp::TYPE_STANDARD;
 
  342        $objecttmp->cond_reglement_id = $cond_reglement_id;
 
  343        $objecttmp->mode_reglement_id = $mode_reglement_id;
 
  344        $objecttmp->fk_account = $fk_account;
 
  345        $objecttmp->remise_percent = $remise_percent;
 
  346        $objecttmp->remise_absolue = $remise_absolue;
 
  347        $objecttmp->transport_mode_id = $transport_mode_id;
 
  350        $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge;
 
  352        $objecttmp->fk_project      = $rcp->fk_project;
 
  354        if (empty($createbills_onebythird)) {
 
  355          $objecttmp->ref_supplier = $rcp->ref;
 
  358          $objecttmp->ref_supplier = $langs->trans(
"Reception").
' '.
dol_print_date(
dol_now(), 
'dayhourlog').
'-'.$rcp->socid;
 
  362        if (empty($datefacture)) {
 
  366        $objecttmp->date = $datefacture;
 
  367        $objecttmp->origin    = 
'reception';
 
  368        $objecttmp->origin_id = $id_reception;
 
  371        if (empty($objecttmp->date_echeance)) {
 
  372          $objecttmp->date_echeance = $objecttmp->calculate_date_lim_reglement();
 
  375        $objecttmp->array_options = $rcp->array_options; 
 
  378        $rcp->fetchObjectLinked();
 
  379        if (count($rcp->linkedObjectsIds[
'order_supplier']) > 0) {
 
  380          foreach ($rcp->linkedObjectsIds[
'order_supplier'] as $key => $value) {
 
  381            $objecttmp->linked_objects[
'order_supplier'] = $value;
 
  385        $res = $objecttmp->create($user);   
 
  390          $lastref = $objecttmp->ref;
 
  391          $lastid = $objecttmp->id;
 
  393          $TFactThird[$rcp->socid] = $objecttmp;
 
  394          $TFactThirdNbLines[$rcp->socid] = 0; 
 
  396          $langs->load(
"errors");
 
  397          $errors[] = $rcp->ref.
' : '.$langs->trans($objecttmp->error);
 
  402      if ($objecttmp->id > 0) {
 
  403        $res = $objecttmp->add_object_linked($objecttmp->origin, $id_reception);
 
  406          $errors[] = $objecttmp->error;
 
  411          $lines = $rcp->lines;
 
  412          if (empty($lines) && method_exists($rcp, 
'fetch_lines')) {
 
  414            $lines = $rcp->lines;
 
  418          $num = count($lines);
 
  420          for ($i = 0; $i < $num; $i++) {
 
  421            $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
 
  423            if (!empty($createbills_onebythird)) {
 
  427            if ($lines[$i]->subprice < 0) {
 
  430              $discount->fk_soc = $objecttmp->socid;
 
  431              $discount->amount_ht = abs($lines[$i]->total_ht);
 
  432              $discount->amount_tva = abs($lines[$i]->total_tva);
 
  433              $discount->amount_ttc = abs($lines[$i]->total_ttc);
 
  434              $discount->tva_tx = $lines[$i]->tva_tx;
 
  435              $discount->fk_user = $user->id;
 
  436              $discount->description = $desc;
 
  437              $discountid = $discount->create($user);
 
  438              if ($discountid > 0) {
 
  439                $result = $objecttmp->insert_discount($discountid);
 
  448              $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
 
  451              if ($lines[$i]->date_debut_prevue) {
 
  452                $date_start = $lines[$i]->date_debut_prevue;
 
  454              if ($lines[$i]->date_debut_reel) {
 
  455                $date_start = $lines[$i]->date_debut_reel;
 
  457              if ($lines[$i]->date_start) {
 
  458                $date_start = $lines[$i]->date_start;
 
  462              if ($lines[$i]->date_fin_prevue) {
 
  463                $date_end = $lines[$i]->date_fin_prevue;
 
  465              if ($lines[$i]->date_fin_reel) {
 
  466                $date_end = $lines[$i]->date_fin_reel;
 
  468              if ($lines[$i]->date_end) {
 
  469                $date_end = $lines[$i]->date_end;
 
  472              if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
 
  477              if (method_exists($lines[$i], 
'fetch_optionals')) {
 
  478                $lines[$i]->fetch_optionals();
 
  479                $array_options = $lines[$i]->array_options;
 
  482              $objecttmp->context[
'createfromclone'];
 
  486              if (!empty($createbills_onebythird))
 
  487                $rang = $TFactThirdNbLines[$rcp->socid];
 
  489              $result = $objecttmp->addline(
 
  491                $lines[$i]->subprice,
 
  493                $lines[$i]->localtax1_tx,
 
  494                $lines[$i]->localtax2_tx,
 
  496                $lines[$i]->fk_product,
 
  497                $lines[$i]->remise_percent,
 
  501                $lines[$i]->info_bits,
 
  510                $lines[$i]->ref_supplier
 
  513              $rcp->add_object_linked(
'facture_fourn_det', $result);
 
  517                if (!empty($createbills_onebythird)) 
 
  518                  $TFactThirdNbLines[$rcp->socid]++;
 
  525              if ($result > 0 && $lines[$i]->product_type == 9) {
 
  526                $fk_parent_line = $result;
 
  535      if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) {
 
  536        $TFactThird[$rcp->socid] = $objecttmp;
 
  538        $TFact[$objecttmp->id] = $objecttmp;
 
  543    $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
 
  546    if (!$error && $validate_invoices) {
 
  547      $massaction = $action = 
'builddoc';
 
  548      foreach ($TAllFact as &$objecttmp) {
 
  549        $result = $objecttmp->validate($user);
 
  556        $id = $objecttmp->id; 
 
  557        $lastref = $objecttmp->ref; 
 
  562        $upload_dir = $conf->fournisseur->facture->dir_output;
 
  563        $permissiontoadd = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
 
  566        $savobject = $object;
 
  567        $object = $objecttmp;
 
  568        include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
 
  569        $object = $savobject;
 
  572      $massaction = $action = 
'confirm_createbills';
 
  578      if ($nb_bills_created == 1) {
 
  579        $texttoshow = $langs->trans(
'BillXCreated', 
'{s1}');
 
  580        $texttoshow = str_replace(
'{s1}', 
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?id='.urlencode($lastid).
'">'.$lastref.
'</a>', $texttoshow);
 
  583        setEventMessages($langs->trans(
'BillCreated', $nb_bills_created), 
null, 
'mesgs');
 
  589      $_GET[
"origin"] = $_POST[
"origin"];
 
  590      $_GET[
"originid"] = $_POST[
"originid"];
 
  602$form = 
new Form($db);
 
  603$companystatic = 
new Societe($db);
 
  609$helpurl = 
'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
 
  610llxHeader(
'', $langs->trans(
'ListOfReceptions'), $helpurl);
 
  612$sql = 
"SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,";
 
  613$sql .= 
' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
 
  614$sql .= 
" typent.code as typent_code,";
 
  615$sql .= 
" state.code_departement as state_code, state.nom as state_name,";
 
  616$sql .= 
' e.date_creation as date_creation, e.tms as date_update';
 
  618if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
 
  619  foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
 
  620    $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] != 
'separate' ? 
", ef.".$key.
" as options_".$key : 
'');
 
  624$parameters = array();
 
  625$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters); 
 
  626$sql .= $hookmanager->resPrint;
 
  630$sql .= 
" FROM ".MAIN_DB_PREFIX.
"reception as e";
 
  631if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
 
  632  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (e.rowid = ef.fk_object)";
 
  634$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
 
  635$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
 
  636$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
 
  637$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
 
  638$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'reception' AND ee.targettype = 'delivery'";
 
  639$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"delivery as l ON l.rowid = ee.fk_target";
 
  640if (empty($user->rights->societe->client->voir) && !$socid) { 
 
  641  $sql .= 
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
 
  644$parameters = array();
 
  645$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object); 
 
  646$sql .= $hookmanager->resPrint;
 
  647$sql .= 
" WHERE e.entity IN (".getEntity(
'reception').
")";
 
  648if (empty($user->rights->societe->client->voir) && !$socid) { 
 
  649  $sql .= 
" AND e.fk_soc = sc.fk_soc";
 
  650  $sql .= 
" AND sc.fk_user = ".((int) $user->id);
 
  653  $sql .= 
" AND e.fk_soc = ".((int) $socid);
 
  655if ($search_status <> 
'' && $search_status >= 0) {
 
  656  $sql .= 
" AND e.fk_statut = ".((int) $search_status);
 
  658if ($search_billed != 
'' && $search_billed >= 0) {
 
  659  $sql .= 
' AND e.billed = '.((int) $search_billed);
 
  670if ($search_country) {
 
  671  $sql .= 
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
 
  673if ($search_type_thirdparty != 
'' && $search_type_thirdparty > 0) {
 
  674  $sql .= 
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
 
  676if ($search_date_delivery_start) {
 
  677  $sql .= 
" AND e.date_delivery >= '".$db->idate($search_date_delivery_start).
"'";
 
  679if ($search_date_delivery_end) {
 
  680  $sql .= 
" AND e.date_delivery <= '".$db->idate($search_date_delivery_end).
"'";
 
  682if ($search_date_create_start) {
 
  683  $sql .= 
" AND e.date_creation >= '".$db->idate($search_date_create_start).
"'";
 
  685if ($search_date_create_end) {
 
  686  $sql .= 
" AND e.date_creation <= '".$db->idate($search_date_create_end).
"'";
 
  688if ($search_ref_rcp) {
 
  691if ($search_ref_liv) {
 
  694if ($search_company) {
 
  697if ($search_ref_supplier) {
 
  705include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
 
  707$parameters = array();
 
  708$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters); 
 
  709$sql .= $hookmanager->resPrint;
 
  711$nbtotalofrecords = 
'';
 
  714  $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields, 
'/').
'/', 
'SELECT COUNT(*) as nbtotalofrecords', $sql);
 
  715  $sqlforcount = preg_replace(
'/GROUP BY .*$/', 
'', $sqlforcount);
 
  716  $resql = $db->query($sqlforcount);
 
  718    $objforcount = $db->fetch_object($resql);
 
  719    $nbtotalofrecords = $objforcount->nbtotalofrecords;
 
  724  if (($page * $limit) > $nbtotalofrecords) { 
 
  732$sql .= $db->order($sortfield, $sortorder);
 
  734  $sql .= $db->plimit($limit + 1, $offset);
 
  738$resql = $db->query($sql);
 
  744$num = $db->num_rows($resql);
 
  748$arrayofselected = is_array($toselect) ? $toselect : array();
 
  751if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
 
  752  $param .= 
'&contextpage='.urlencode($contextpage);
 
  754if ($limit > 0 && $limit != $conf->liste_limit) {
 
  755  $param .= 
'&limit='.((int) $limit);
 
  758  $param .= 
"&sall=".urlencode($sall);
 
  760if ($search_ref_rcp) {
 
  761  $param .= 
"&search_ref_rcp=".urlencode($search_ref_rcp);
 
  763if ($search_ref_liv) {
 
  764  $param .= 
"&search_ref_liv=".urlencode($search_ref_liv);
 
  766if ($search_company) {
 
  767  $param .= 
"&search_company=".urlencode($search_company);
 
  769if ($optioncss != 
'') {
 
  770  $param .= 
'&optioncss='.urlencode($optioncss);
 
  772if ($search_billed != 
'' && $search_billed >= 0) {
 
  773  $param .= 
"&search_billed=".urlencode($search_billed);
 
  776  $param .= 
"&search_town=".urlencode($search_town);
 
  779  $param .= 
"&search_zip=".urlencode($search_zip);
 
  782  $param .= 
"&search_state=".urlencode($search_state);
 
  784if ($search_status != 
'') {
 
  785  $param .= 
"&search_status=".urlencode($search_status);
 
  787if ($search_country) {
 
  788  $param .= 
"&search_country=".urlencode($search_country);
 
  790if ($search_type_thirdparty) {
 
  791  $param .= 
"&search_type_thirdparty=".urlencode($search_type_thirdparty);
 
  793if ($search_date_delivery_startday) {
 
  794  $param .= 
'&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
 
  796if ($search_date_delivery_startmonth) {
 
  797  $param .= 
'&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
 
  799if ($search_date_delivery_startyear) {
 
  800  $param .= 
'&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
 
  802if ($search_date_delivery_endday) {
 
  803  $param .= 
'&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
 
  805if ($search_date_delivery_endmonth) {
 
  806  $param .= 
'&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
 
  808if ($search_date_delivery_endyear) {
 
  809  $param .= 
'&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
 
  811if ($search_date_create_startday) {
 
  812  $param .= 
'&search_date_create_startday='.urlencode($search_date_create_startday);
 
  814if ($search_date_create_startmonth) {
 
  815  $param .= 
'&search_date_create_startmonth='.urlencode($search_date_create_startmonth);
 
  817if ($search_date_create_startyear) {
 
  818  $param .= 
'&search_date_create_startyear='.urlencode($search_date_create_startyear);
 
  820if ($search_date_create_endday) {
 
  821  $param .= 
'&search_date_create_endday='.urlencode($search_date_create_endday);
 
  823if ($search_date_create_endmonth) {
 
  824  $param .= 
'&search_date_create_endmonth='.urlencode($search_date_create_endmonth);
 
  826if ($search_date_create_endyear) {
 
  827  $param .= 
'&search_date_create_endyear='.urlencode($search_date_create_endyear);
 
  829if ($search_ref_supplier) {
 
  830  $param .= 
"&search_ref_supplier=".urlencode($search_ref_supplier);
 
  833if ($search_array_options) {
 
  834  foreach ($search_array_options as $key => $val) {
 
  836    $tmpkey = preg_replace(
'/search_options_/', 
'', $key);
 
  837    if (is_array($val) && array_key_exists(
'start', $val) && array_key_exists(
'end', $val)) {
 
  840      $param .= 
'&search_options_'.$tmpkey.
'_startyear='.
dol_print_date($val[
'start'], 
'%Y');
 
  841      $param .= 
'&search_options_'.$tmpkey.
'_startmonth='.
dol_print_date($val[
'start'], 
'%m');
 
  842      $param .= 
'&search_options_'.$tmpkey.
'_startday='.
dol_print_date($val[
'start'], 
'%d');
 
  843      $param .= 
'&search_options_'.$tmpkey.
'_starthour='.
dol_print_date($val[
'start'], 
'%H');
 
  844      $param .= 
'&search_options_'.$tmpkey.
'_startmin='.
dol_print_date($val[
'start'], 
'%M');
 
  846      $param .= 
'&search_options_'.$tmpkey.
'_endyear='.
dol_print_date($val[
'end'], 
'%Y');
 
  847      $param .= 
'&search_options_'.$tmpkey.
'_endmonth='.
dol_print_date($val[
'end'], 
'%m');
 
  848      $param .= 
'&search_options_'.$tmpkey.
'_endday='.
dol_print_date($val[
'end'], 
'%d');
 
  849      $param .= 
'&search_options_'.$tmpkey.
'_endhour='.
dol_print_date($val[
'end'], 
'%H');
 
  850      $param .= 
'&search_options_'.$tmpkey.
'_endmin='.
dol_print_date($val[
'end'], 
'%M');
 
  854      $param .= 
'&search_options_'.$tmpkey.
'='.urlencode($val);
 
  860$arrayofmassactions = array(
 
  864if ($user->hasRight(
'fournisseur', 
'facture', 
'creer') || $user->rights->supplier_invoice->creer) {
 
  865  $arrayofmassactions[
'createbills'] = $langs->trans(
"CreateInvoiceForThisReceptions");
 
  867if ($massaction == 
'createbills') {
 
  868  $arrayofmassactions = array();
 
  870$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
 
  874print 
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
 
  875if ($optioncss != 
'') {
 
  876  print 
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
 
  878print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  879print 
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
 
  880print 
'<input type="hidden" name="action" value="list">';
 
  881print 
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
 
  882print 
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
 
  884print_barre_liste($langs->trans(
'ListOfReceptions'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 
'dollyrevert', 0, 
'', 
'', $limit, 0, 0, 1);
 
  886if ($massaction == 
'createbills') {
 
  888  print 
'<input type="hidden" name="massaction" value="confirm_createbills">';
 
  890  print 
'<table class="noborder" width="100%" >';
 
  892  print 
'<td class="titlefieldmiddle">';
 
  893  print $langs->trans(
'DateInvoice');
 
  896  print $form->selectDate(
'', 
'', 
'', 
'', 
'', 
'', 1, 1);
 
  901  print $langs->trans(
'CreateOneBillByThird');
 
  904  print $form->selectyesno(
'createbills_onebythird', 
'', 1);
 
  909  print $langs->trans(
'ValidateInvoices');
 
  912  if (isModEnabled(
'stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
 
  913    print $form->selectyesno(
'validate_invoices', 0, 1, 1);
 
  914    print 
' ('.$langs->trans(
"AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").
')';
 
  916    print $form->selectyesno(
'validate_invoices', 0, 1);
 
  923  print 
'<div class="center">';
 
  924  print 
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisReceptions').
'">  ';
 
  925  print 
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
 
  931  foreach ($fieldstosearchall as $key => $val) {
 
  932    $fieldstosearchall[$key] = $langs->trans($val);
 
  934  print $langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall);
 
  938if (!empty($moreforfilter)) {
 
  939  print 
'<div class="liste_titre liste_titre_bydiv centpercent">';
 
  940  print $moreforfilter;
 
  941  $parameters = array(
'type'=>$type);
 
  942  $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters); 
 
  943  print $hookmanager->resPrint;
 
  947$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
 
  948$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, 
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN', 
'')); 
 
  949$selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
 
  952print 
'<div class="div-table-responsive">';
 
  953print 
'<table class="tagtable liste'.($moreforfilter ? 
" listwithfilterbefore" : 
"").
'">'.
"\n";
 
  957print 
'<tr class="liste_titre_filter">';
 
  959if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
  960  print 
'<td class="liste_titre middle">';
 
  961  $searchpicto = $form->showFilterButtons(
'left');
 
  966if (!empty($arrayfields[
'e.ref'][
'checked'])) {
 
  967  print 
'<td class="liste_titre">';
 
  968  print 
'<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.
'">';
 
  972if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
 
  973  print 
'<td class="liste_titre">';
 
  974  print 
'<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.
'">';
 
  978if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
  979  print 
'<td class="liste_titre left">';
 
  980  print 
'<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
 
  984if (!empty($arrayfields[
's.town'][
'checked'])) {
 
  985  print 
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
 
  988if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
  989  print 
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.
'"></td>';
 
  992if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
  993  print 
'<td class="liste_titre">';
 
  994  print 
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
 
  998if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
  999  print 
'<td class="liste_titre center">';
 
 1000  print $form->select_country($search_country, 
'search_country', 
'', 0, 
'minwidth100imp maxwidth100');
 
 1004if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
 1005  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
 1006  print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, 
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 
'', 1);
 
 1010if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
 
 1011  print 
'<td class="liste_titre center">';
 
 1012  print 
'<div class="nowrap">';
 
 1013  print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 
'search_date_delivery_start', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
 1015  print 
'<div class="nowrap">';
 
 1016  print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 
'search_date_delivery_end', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
 1020if (!empty($arrayfields[
'l.ref'][
'checked'])) {
 
 1022  print 
'<td class="liste_titre">';
 
 1023  print 
'<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).
'"';
 
 1026if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
 1028  print 
'<td class="liste_titre"> </td>';
 
 1031include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
 
 1034$parameters = array(
'arrayfields'=>$arrayfields);
 
 1035$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters); 
 
 1036print $hookmanager->resPrint;
 
 1038if (!empty($arrayfields[
'e.datec'][
'checked'])) {
 
 1039  print 
'<td class="liste_titre center">';
 
 1040  print 
'<div class="nowrap">';
 
 1041  print $form->selectDate($search_date_create_start ? $search_date_create_start : -1, 
'search_date_create_start', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
 1043  print 
'<div class="nowrap">';
 
 1044  print $form->selectDate($search_date_create_end ? $search_date_create_end : -1, 
'search_date_create_end', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
 1049if (!empty($arrayfields[
'e.tms'][
'checked'])) {
 
 1050  print 
'<td class="liste_titre">';
 
 1054if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
 
 1055  print 
'<td class="liste_titre right parentonrightofpage">';
 
 1056  print $form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'StatusReceptionDraftShort'), 
'1'=>$langs->trans(
'StatusReceptionValidatedShort'), 
'2'=>$langs->trans(
'StatusReceptionProcessedShort')), $search_status, 1, 0, 0, 
'', 0, 0, 0, 
'', 
'search_status width100 onrightofpage');
 
 1060if (!empty($arrayfields[
'e.billed'][
'checked'])) {
 
 1061  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
 1062  print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1);
 
 1066if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
 1067  print 
'<td class="liste_titre middle">';
 
 1068  $searchpicto = $form->showFilterAndCheckAddButtons(0);
 
 1074print 
'<tr class="liste_titre">';
 
 1075if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
 1076  print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"], 
"", 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ');
 
 1078if (!empty($arrayfields[
'e.ref'][
'checked'])) {
 
 1079  print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.ref", 
"", $param, 
'', $sortfield, $sortorder);
 
 1081if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
 
 1082  print_liste_field_titre($arrayfields[
'e.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.ref_supplier", 
"", $param, 
'', $sortfield, $sortorder);
 
 1084if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
 1085  print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.nom", 
"", $param, 
'', $sortfield, $sortorder, 
'left ');
 
 1087if (!empty($arrayfields[
's.town'][
'checked'])) {
 
 1088  print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"], 
's.town', 
'', $param, 
'', $sortfield, $sortorder);
 
 1090if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
 1091  print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"], 
's.zip', 
'', $param, 
'', $sortfield, $sortorder);
 
 1093if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
 1094  print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"state.nom", 
"", $param, 
'', $sortfield, $sortorder);
 
 1096if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
 1097  print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"], 
"country.code_iso", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1099if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
 1100  print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"], 
"typent.code", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1102if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
 
 1103  print_liste_field_titre($arrayfields[
'e.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.date_delivery", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1105if (!empty($arrayfields[
'l.ref'][
'checked'])) {
 
 1106  print_liste_field_titre($arrayfields[
'l.ref'][
'label'], $_SERVER[
"PHP_SELF"], 
"l.ref", 
"", $param, 
'', $sortfield, $sortorder);
 
 1108if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
 1109  print_liste_field_titre($arrayfields[
'l.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"], 
"l.date_delivery", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1112include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
 
 1114$parameters = array(
'arrayfields'=>$arrayfields, 
'param'=>$param, 
'sortfield'=>$sortfield, 
'sortorder'=>$sortorder);
 
 1115$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object); 
 
 1116print $hookmanager->resPrint;
 
 1117if (!empty($arrayfields[
'e.datec'][
'checked'])) {
 
 1118  print_liste_field_titre($arrayfields[
'e.datec'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.date_creation", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
 1120if (!empty($arrayfields[
'e.tms'][
'checked'])) {
 
 1121  print_liste_field_titre($arrayfields[
'e.tms'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.tms", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
 1123if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
 
 1124  print_liste_field_titre($arrayfields[
'e.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.fk_statut", 
"", $param, 
'', $sortfield, $sortorder, 
'right ');
 
 1126if (!empty($arrayfields[
'e.billed'][
'checked'])) {
 
 1127  print_liste_field_titre($arrayfields[
'e.billed'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.billed", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1129if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
 1130  print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"], 
"", 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ');
 
 1135$totalarray = array();
 
 1136$totalarray[
'nbfield'] = 0;
 
 1137while ($i < min($num, $limit)) {
 
 1138  $obj = $db->fetch_object($resql);
 
 1140  $reception->id = $obj->rowid;
 
 1141  $reception->ref = $obj->ref;
 
 1143  $companystatic->id = $obj->socid;
 
 1144  $companystatic->ref = $obj->name;
 
 1145  $companystatic->name = $obj->name;
 
 1148  print 
'<tr class="oddeven">';
 
 1151  if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
 1152    print 
'<td class="center">';
 
 1153    if ($massactionbutton || $massaction) {
 
 1156      if (in_array($obj->rowid, $arrayofselected)) {
 
 1159      print 
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ? 
' checked="checked"' : 
'').
'>';
 
 1164  if (!empty($arrayfields[
'e.ref'][
'checked'])) {
 
 1165    print 
'<td class="nowraponall">';
 
 1166    print $reception->getNomUrl(1);
 
 1169    $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$reception->id;
 
 1170    print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
 
 1174      $totalarray[
'nbfield']++;
 
 1179  if (!empty($arrayfields[
'e.ref_supplier'][
'checked'])) {
 
 1180    print 
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
 
 1184      $totalarray[
'nbfield']++;
 
 1189  if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
 1190    print 
'<td class="tdoverflowmax150">';
 
 1191    print $companystatic->getNomUrl(1);
 
 1194      $totalarray[
'nbfield']++;
 
 1198  if (!empty($arrayfields[
's.town'][
'checked'])) {
 
 1199    print 
'<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).
'">';
 
 1203      $totalarray[
'nbfield']++;
 
 1207  if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
 1208    print 
'<td class="nocellnopadd center"">';
 
 1212      $totalarray[
'nbfield']++;
 
 1216  if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
 1217    print 
"<td>".dol_escape_htmltag($obj->state_name).
"</td>\n";
 
 1219      $totalarray[
'nbfield']++;
 
 1223  if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
 1224    print 
'<td class="center">';
 
 1225    $tmparray = 
getCountry($obj->fk_pays, 
'all');
 
 1229      $totalarray[
'nbfield']++;
 
 1233  if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
 1234    print 
'<td class="center">';
 
 1235    if (!isset($typenArray) || empty($typenArray)) {
 
 1236      $typenArray = $formcompany->typent_array(1);
 
 1238    if (isset($typenArray[$obj->typent_code])) {
 
 1239      print $typenArray[$obj->typent_code];
 
 1243      $totalarray[
'nbfield']++;
 
 1248  if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
 
 1249    print 
'<td class="center">';
 
 1257      $totalarray[
'nbfield']++;
 
 1261  if (!empty($arrayfields[
'l.ref'][
'checked']) || !empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
 1262    $reception->fetchObjectLinked($reception->id, $reception->element);
 
 1264    if (count($reception->linkedObjects[
'delivery']) > 0) {
 
 1265      $receiving = reset($reception->linkedObjects[
'delivery']);
 
 1268    if (!empty($arrayfields[
'l.ref'][
'checked'])) {
 
 1271      print !empty($receiving) ? $receiving->getNomUrl($db) : 
'';
 
 1275    if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
 1277      print 
'<td class="center">';
 
 1284  include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
 
 1287  $parameters = array(
'arrayfields'=>$arrayfields, 
'obj'=>$obj, 
'i'=>$i, 
'totalarray'=>&$totalarray);
 
 1288  $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters); 
 
 1289  print $hookmanager->resPrint;
 
 1291  if (!empty($arrayfields[
'e.datec'][
'checked'])) {
 
 1292    print 
'<td class="center nowrap">';
 
 1293    print 
dol_print_date($db->jdate($obj->date_creation), 
'dayhour');
 
 1296      $totalarray[
'nbfield']++;
 
 1300  if (!empty($arrayfields[
'e.tms'][
'checked'])) {
 
 1301    print 
'<td class="center nowrap">';
 
 1305      $totalarray[
'nbfield']++;
 
 1309  if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
 
 1310    print 
'<td class="right nowrap">'.$reception->LibStatut($obj->fk_statut, 5).
'</td>';
 
 1312      $totalarray[
'nbfield']++;
 
 1316  if (!empty($arrayfields[
'e.billed'][
'checked'])) {
 
 1317    print 
'<td class="center">'.yn($obj->billed).
'</td>';
 
 1319      $totalarray[
'nbfield']++;
 
 1324  if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
 1325    print 
'<td class="center">';
 
 1326    if ($massactionbutton || $massaction) {
 
 1329      if (in_array($obj->rowid, $arrayofselected)) {
 
 1332      print 
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ? 
' checked="checked"' : 
'').
'>';
 
 1337    $totalarray[
'nbfield']++;
 
 1348  foreach ($arrayfields as $key => $val) {
 
 1349    if (!empty($val[
'checked'])) {
 
 1353  print 
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
 
 1357include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
 
 1359$parameters = array(
'arrayfields'=>$arrayfields, 
'sql'=>$sql);
 
 1360$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters); 
 
 1361print $hookmanager->resPrint;
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
Class to manage absolute discounts.
 
Class to manage suppliers invoices.
 
Class to manage receptions.
 
Class to manage third parties objects (customers, suppliers, prospects...)
 
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
 
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
 
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
dol_now($mode='auto')
Return date for now.
 
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
 
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
 
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
 
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
 
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
 
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e rowid
 
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.