dolibarr 20.0.2
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
25require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
26require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
27
32class FormOrder extends Form
33{
43 public function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status', $morecss = '')
44 {
45 $options = array();
46
47 // 7 is same label than 6. 8 does not exists (billed is another field)
48 $statustohow = array(
49 '0' => '0',
50 '1' => '1',
51 '2' => '2',
52 '3' => '3',
53 '4' => '4',
54 '5' => '5',
55 '6' => '6,7',
56 '9' => '9'
57 );
58
59 $tmpsupplierorder = new CommandeFournisseur($this->db);
60
61 foreach ($statustohow as $key => $value) {
62 $tmpsupplierorder->statut = $key;
63 $options[$value] = $tmpsupplierorder->getLibStatut($short);
64 }
65
66 if (is_array($selected)) {
67 $selectedarray = $selected;
68 } else {
69 $selectedarray = explode(',', $selected);
70 }
71
72 print Form::multiselectarray($hmlname, $options, $selectedarray, 0, 0, $morecss, 0, 150);
73 }
74
83 public function selectOrderStatus($selected = '', $short = 0, $hmlname = 'order_status')
84 {
85 $options = array();
86
87 $statustohow = array(
93 );
94
95 $tmpsupplierorder = new Commande($this->db);
96
97 foreach ($statustohow as $value) {
98 $tmpsupplierorder->statut = $value;
99 $options[$value] = $tmpsupplierorder->getLibStatut($short);
100 }
101
102 if (is_array($selected)) {
103 $selectedarray = $selected;
104 } else {
105 $selectedarray = explode(',', $selected);
106 }
107
108 print Form::multiselectarray($hmlname, $options, $selectedarray, 0, 0, '', 0, 150);
109 }
110
120 public function selectInputMethod($selected = '', $htmlname = 'source_id', $addempty = 0)
121 {
122 global $langs;
123
124 $listofmethods = array();
125
126 $sql = "SELECT rowid, code, libelle as label";
127 $sql .= " FROM ".$this->db->prefix()."c_input_method";
128 $sql .= " WHERE active = 1";
129
130 dol_syslog(get_class($this)."::selectInputMethod", LOG_DEBUG);
131 $resql = $this->db->query($sql);
132
133 if (!$resql) {
134 dol_print_error($this->db);
135 return -1;
136 }
137
138 while ($obj = $this->db->fetch_object($resql)) {
139 $listofmethods[$obj->rowid] = $langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : $obj->label;
140 }
141
142 print Form::selectarray($htmlname, $listofmethods, $selected, $addempty);
143
144 return 1;
145 }
146}
Class to manage predefined suppliers products.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
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...
selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status', $morecss='')
Return combo list of different statuses of orders.
selectInputMethod($selected='', $htmlname='source_id', $addempty=0)
Return list of input method (mode used to receive order, like order received by email,...
selectOrderStatus($selected='', $short=0, $hmlname='order_status')
Return combo list of different status of orders.
dol_print_error($db=null, $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.