dolibarr  17.0.4
html.formorder.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2016 Marcos GarcĂ­a <marcosgdf@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
26 
31 class FormOrder extends Form
32 {
33 
42  public function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status')
43  {
44  $options = array();
45 
46  // 7 is same label than 6. 8 does not exists (billed is another field)
47  $statustohow = array(
48  '0' => '0',
49  '1' => '1',
50  '2' => '2',
51  '3' => '3',
52  '4' => '4',
53  '5' => '5',
54  '6' => '6,7',
55  '9' => '9'
56  );
57 
58  $tmpsupplierorder = new CommandeFournisseur($this->db);
59 
60  foreach ($statustohow as $key => $value) {
61  $tmpsupplierorder->statut = $key;
62  $options[$value] = $tmpsupplierorder->getLibStatut($short);
63  }
64 
65  if (is_array($selected)) {
66  $selectedarray = $selected;
67  } else {
68  $selectedarray = explode(',', $selected);
69  }
70 
71  print Form::multiselectarray($hmlname, $options, $selectedarray, 0);
72  }
73 
83  public function selectInputMethod($selected = '', $htmlname = 'source_id', $addempty = 0)
84  {
85  global $langs;
86 
87  $listofmethods = array();
88 
89  $sql = "SELECT rowid, code, libelle as label";
90  $sql .= " FROM ".$this->db->prefix()."c_input_method";
91  $sql .= " WHERE active = 1";
92 
93  dol_syslog(get_class($this)."::selectInputMethod", LOG_DEBUG);
94  $resql = $this->db->query($sql);
95 
96  if (!$resql) {
97  dol_print_error($this->db);
98  return -1;
99  }
100 
101  while ($obj = $this->db->fetch_object($resql)) {
102  $listofmethods[$obj->rowid] = $langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : $obj->label;
103  }
104 
105  print Form::selectarray($htmlname, $listofmethods, $selected, $addempty);
106 
107  return 1;
108  }
109 }
Class to manage predefined suppliers products.
Class to manage generation of HTML components Only common components must be here.
static selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='minwidth75', $addjscombo=1, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
Return a HTML select string, built from an array of key+value.
static multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=-1)
Show a multiselect form from an array.
Class to manage HTML output components for orders Before adding component here, check they are not in...
selectInputMethod($selected='', $htmlname='source_id', $addempty=0)
Return list of input method (mode used to receive order, like order received by email,...
selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status')
Return combo list of differents status of a orders.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.
Definition: inc.php:41