dolibarr 20.0.0
commonorder.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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/commonobject.class.php';
26require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
27require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
28
32abstract class CommonOrder extends CommonObject
33{
35
36
44 public function getKanbanView($option = '', $arraydata = null)
45 {
46 global $langs, $conf;
47
48 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
49
50 $return = '<div class="box-flex-item box-flex-grow-zero">';
51 $return .= '<div class="info-box info-box-sm">';
52 $return .= '<div class="info-box-icon bg-infobox-action">';
53 $return .= img_picto('', 'order');
54 $return .= '</div>';
55 $return .= '<div class="info-box-content">';
56 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
57 if ($selected >= 0) {
58 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
59 }
60 if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
61 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
62 }
63 if (property_exists($this, 'total_ht')) {
64 $return .= '<div class="info-box-ref amount">'.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency).' '.$langs->trans('HT').'</div>';
65 }
66 if (method_exists($this, 'getLibStatut')) {
67 $return .= '<div class="info-box-status">'.$this->getLibStatut(3).'</div>';
68 }
69 $return .= '</div>';
70 $return .= '</div>';
71 $return .= '</div>';
72 return $return;
73 }
74
80 public function getNbLinesProductOrServiceOnBuy($ignoreFree = false)
81 {
82 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
83 $product = new Product($this->db);
84 $return = 0;
85 foreach ($this->lines as $line) {
86 if (empty($line->fk_product) && !$ignoreFree) {
87 $return ++;
88 } elseif ((int) $line->fk_product > 0) {
89 if ($product->fetch($line->fk_product) > 0) {
90 if ($product->status_buy) $return ++;
91 }
92 }
93 }
94 return $return;
95 }
96
100 public $code = "";
101}
102
106abstract class CommonOrderLine extends CommonObjectLine
107{
112 public $label;
113
120 public $ref;
121
128 public $libelle;
129
134 public $product_ref;
135
140 public $product_label;
141
146 public $product_tosell=0;
147
152 public $product_tobuy=0;
153
158 public $product_desc;
159
164 public $product_tobatch;
165
170 public $product_barcode;
171
176 public $qty;
177
183 public $price;
184
189 public $subprice;
190
195 public $product_type = 0;
196
201 public $fk_product;
202
207 public $remise_percent;
208
213 public $vat_src_code;
214
219 public $tva_tx;
220
225 public $localtax1_tx;
226
231 public $localtax2_tx;
232
233 public $localtax1_type;
234 public $localtax2_type;
235
242 public $info_bits = 0;
243
247 public $special_code = 0;
248
249 public $fk_multicurrency;
250 public $multicurrency_code;
251 public $multicurrency_subprice;
252 public $multicurrency_total_ht;
253 public $multicurrency_total_tva;
254 public $multicurrency_total_ttc;
255}
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=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)