dolibarr 19.0.4
commonorder.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
25require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
26require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
27
31abstract class CommonOrder extends CommonObject
32{
34
35
43 public function getKanbanView($option = '', $arraydata = null)
44 {
45 global $langs, $conf;
46
47 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
48
49 $return = '<div class="box-flex-item box-flex-grow-zero">';
50 $return .= '<div class="info-box info-box-sm">';
51 $return .= '<div class="info-box-icon bg-infobox-action">';
52 $return .= img_picto('', 'order');
53 $return .= '</div>';
54 $return .= '<div class="info-box-content">';
55 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
56 if ($selected >= 0) {
57 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
58 }
59 if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
60 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
61 }
62 if (property_exists($this, 'total_ht')) {
63 $return .= '<div class="info-box-ref amount">'.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency).' '.$langs->trans('HT').'</div>';
64 }
65 if (method_exists($this, 'getLibStatut')) {
66 $return .= '<div class="info-box-status">'.$this->getLibStatut(3).'</div>';
67 }
68 $return .= '</div>';
69 $return .= '</div>';
70 $return .= '</div>';
71 return $return;
72 }
73
79 public function getNbLinesProductOrServiceOnBuy($ignoreFree = false)
80 {
81 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
82 $product = new Product($this->db);
83 $return = 0;
84 foreach ($this->lines as $line) {
85 if (empty($line->fk_product) && !$ignoreFree) {
86 $return ++;
87 } elseif ((int) $line->fk_product > 0) {
88 if ($product->fetch($line->fk_product) > 0) {
89 if ($product->status_buy) $return ++;
90 }
91 }
92 }
93 return $return;
94 }
95
99 public $code = "";
100}
101
105abstract class CommonOrderLine extends CommonObjectLine
106{
111 public $label;
112
119 public $ref;
120
127 public $libelle;
128
133 public $product_ref;
134
139 public $product_label;
140
145 public $product_tosell=0;
146
151 public $product_tobuy=0;
152
157 public $product_desc;
158
163 public $product_tobatch;
164
169 public $product_barcode;
170
175 public $qty;
176
182 public $price;
183
188 public $subprice;
189
194 public $product_type = 0;
195
200 public $fk_product;
201
206 public $remise_percent;
207
212 public $vat_src_code;
213
218 public $tva_tx;
219
224 public $localtax1_tx;
225
230 public $localtax2_tx;
231
232 public $localtax1_type;
233 public $localtax2_type;
234
241 public $info_bits = 0;
242
243 public $special_code = 0;
244
245 public $fk_multicurrency;
246 public $multicurrency_code;
247 public $multicurrency_subprice;
248 public $multicurrency_total_ht;
249 public $multicurrency_total_tva;
250 public $multicurrency_total_ttc;
251}
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
Superclass for orders classes.
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
getNbLinesProductOrServiceOnBuy($ignoreFree=false)
return nb of fines of order where products or services that can be buyed
Superclass for orders classes.
$label
Custom label of line.
Class to manage products or services.
trait CommonIncoterm
Superclass for incoterm classes.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)