1<?php 2/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> 5 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> 6 * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> 7 * Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com> 8 * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 3 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program. If not, see <https://www.gnu.org/licenses/>. 22 * or see https://www.gnu.org/ 23 */ 24 25/** 26 * \file htdocs/core/modules/supplier_order/modules_commandefournisseur.php 27 * \ingroup commande fournisseur 28 * \brief File that contains parent class for supplier orders models 29 * and parent class for supplier orders numbering models 30 */ 31require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; 32require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit 33 34 35/** 36 * Parent class for supplier orders models 37 */ 38abstract class ModelePDFSuppliersOrders extends CommonDocGenerator 39{ 40 /** 41 * @var string Error code (or message) 42 */ 43 public $error = ''; 44 45 46 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps 47 /** 48 * Return list of active generation models 49 * 50 * @param DoliDB $db Database handler 51 * @param integer $maxfilenamelength Max length of value to show 52 * @return array List of templates 53 */ 54 public static function liste_modeles($db, $maxfilenamelength = 0) 55 { 56 // phpcs:enable 57 global $conf; 58 59 $type = 'order_supplier'; 60 $list = array(); 61 62 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; 63 $list = getListOfModels($db, $type, $maxfilenamelength); 64 65 return $list; 66 } 67} 68 69 70 71/** 72 * Parent Class of numbering models of suppliers orders references 73 */ 74abstract class ModeleNumRefSuppliersOrders 75{ 76 /** 77 * @var string Error code (or message) 78 */ 79 public $error = ''; 80 81 /** Return if a model can be used or not 82 * 83 * @return boolean true if model can be used 84 */ 85 public function isEnabled() 86 { 87 return true; 88 } 89 90 /** Returns default description of numbering model 91 * 92 * @return string Description Text 93 */ 94 public function info() 95 { 96 global $langs; 97 $langs->load("orders"); 98 return $langs->trans("NoDescription"); 99 } 100 101 /** Returns a numbering example 102 * 103 * @return string Example 104 */ 105 public function getExample() 106 { 107 global $langs; 108 $langs->load("orders"); 109 return $langs->trans("NoExample"); 110 } 111 112 /** Tests if existing numbers make problems with numbering 113 * 114 * @return boolean false if conflict, true if ok 115 */ 116 public function canBeActivated() 117 { 118 return true; 119 } 120 121 /** Returns next value assigned 122 * 123 * @return string Valeur 124 */ 125 public function getNextValue() 126 { 127 global $langs; 128 return $langs->trans("NotAvailable"); 129 } 130 131 /** Returns version of the numbering model 132 * 133 * @return string Value 134 */ 135 public function getVersion() 136 { 137 global $langs; 138 $langs->load("admin"); 139 140 if ($this->version == 'development') { 141 return $langs->trans("VersionDevelopment"); 142 } 143 if ($this->version == 'experimental') { 144 return $langs->trans("VersionExperimental"); 145 } 146 if ($this->version == 'dolibarr') { 147 return DOL_VERSION; 148 } 149 if ($this->version) { 150 return $this->version; 151 } 152 return $langs->trans("NotAvailable"); 153 } 154} 155