dolibarr 25.0.0-alpha
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 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
28require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
29
33abstract class CommonOrder extends CommonObject
34{
35 use CommonIncoterm;
36
37
45 public function getKanbanView($option = '', $arraydata = null)
46 {
47 global $langs, $conf;
48
49 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
50
51 $return = '<div class="box-flex-item box-flex-grow-zero">';
52 $return .= '<div class="info-box info-box-sm">';
53 $return .= '<div class="info-box-icon bg-infobox-action">';
54 $return .= img_picto('', 'order');
55 $return .= '</div>';
56 $return .= '<div class="info-box-content">';
57 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
58 if ($selected >= 0) {
59 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
60 }
61 if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
62 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
63 }
64 if (property_exists($this, 'total_ht')) {
65 $return .= '<div class="info-box-ref amount">'.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency).' '.$langs->trans('HT').'</div>';
66 }
67 if (method_exists($this, 'getLibStatut')) {
68 $return .= '<div class="info-box-status">'.$this->getLibStatut(3).'</div>';
69 }
70 $return .= '</div>';
71 $return .= '</div>';
72 $return .= '</div>';
73 return $return;
74 }
75
81 public function getNbLinesProductOrServiceOnBuy($ignoreFree = false)
82 {
83 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
84 $product = new Product($this->db);
85 $return = 0;
86 foreach ($this->lines as $line) {
87 if (empty($line->fk_product) && !$ignoreFree) {
88 $return++;
89 } elseif ((int) $line->fk_product > 0) {
90 if ($product->fetch($line->fk_product) > 0) {
91 if ($product->status_buy) {
92 $return++;
93 }
94 }
95 }
96 }
97 return $return;
98 }
99
103 public $code = "";
104}
105
109abstract class CommonOrderLine extends CommonObjectLine
110{
116 public $label;
117
124 public $ref;
125
132 public $libelle;
133
138 public $product_ref;
139
144 public $product_label;
145
150 public $product_tosell = 0;
151
156 public $product_tobuy = 0;
157
162 public $product_desc;
163
168 public $product_tobatch;
169
174 public $product_barcode;
175
180 public $qty;
181
188 public $price;
189
194 public $subprice;
195
200 public $product_type = 0;
201
206 public $fk_product;
207
212 public $remise_percent;
213
218 public $vat_src_code;
219
224 public $tva_tx;
225
230 public $localtax1_tx;
231
236 public $localtax2_tx;
237
241 public $localtax1_type;
245 public $localtax2_type;
246
253 public $info_bits = 0;
254
258 public $special_code = 0;
259
263 public $fk_multicurrency;
267 public $multicurrency_code;
271 public $multicurrency_subprice;
275 public $multicurrency_total_ht;
279 public $multicurrency_total_tva;
283 public $multicurrency_total_ttc;
284}
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 clickable link of object (with eventually picto)
getNbLinesProductOrServiceOnBuy($ignoreFree=false)
return nb of fines of order where products or services that can be bought
Superclass for orders classes.
Class to manage products or services.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)