27require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
37 public $next_prev_filter =
"te.fournisseur:=:1";
50 $this->fournisseur = 1;
72 public function fetch($rowid, $ref =
'', $ref_ext =
'', $barcode =
'', $idprof1 =
'', $idprof2 =
'', $idprof3 =
'', $idprof4 =
'', $idprof5 =
'', $idprof6 =
'', $email =
'', $ref_alias =
'', $is_client = 0, $is_supplier = 1)
74 return parent::fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias, $is_client, $is_supplier);
86 $sql =
"SELECT rowid";
87 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
88 $sql .=
" WHERE cf.fk_soc = ".((int) $this->
id);
90 $resql = $this->db->query($sql);
92 $num = $this->db->num_rows($resql);
107 $sql =
"SELECT count(pfp.rowid) as nb";
108 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price as pfp";
109 $sql .=
" WHERE pfp.entity = ".$conf->entity;
110 $sql .=
" AND pfp.fk_soc = ".((int) $this->
id);
112 $resql = $this->db->query($sql);
114 $obj = $this->db->fetch_object($resql);
128 global
$conf, $user, $hookmanager;
133 $sql =
"SELECT count(s.rowid) as nb";
134 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
135 if (!$user->hasRight(
"societe",
"client",
"voir") && !$user->socid) {
136 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
137 $sql .=
" WHERE sc.fk_user = ".((int) $user->id);
140 $sql .=
" ".$clause.
" s.fournisseur = 1";
141 $sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
143 if (is_object($hookmanager)) {
144 $parameters = array();
145 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $this);
146 $sql .= $hookmanager->resPrint;
149 $resql = $this->db->query($sql);
151 while ($obj = $this->db->fetch_object($resql)) {
152 $this->nb[
"suppliers"] = $obj->nb;
154 $this->db->free($resql);
158 $this->error = $this->db->error();
174 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"categorie (label,visible,type)";
176 $sql .=
" ('".$this->db->escape($name).
"',1,1)";
178 dol_syslog(
"Fournisseur::CreateCategory", LOG_DEBUG);
179 $resql = $this->db->query($sql);
181 dol_syslog(
"Fournisseur::CreateCategory : Success");
184 $this->error = $this->db->lasterror();
185 dol_syslog(
"Fournisseur::CreateCategory : Failed (".$this->error.
")");
204 $sql =
"SELECT s.rowid, s.nom as name";
205 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
206 if (!$user->hasRight(
"societe",
"client",
"voir") && !$user->socid) {
207 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
209 $sql .=
" WHERE s.fournisseur = 1";
210 $sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
211 if (!$user->hasRight(
"societe",
"client",
"voir") && !$user->socid) {
212 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
215 $resql = $this->db->query($sql);
218 while ($obj = $this->db->fetch_object($resql)) {
219 $arr[$obj->rowid] = $obj->name;
223 $this->error = $this->db->lasterror();
static commonReplaceThirdparty(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
Function used to replace a thirdparty id with another one.
Class to manage Dolibarr database access.
Class to manage suppliers.
nbOfProductRefs()
Returns number of ref prices (not number of products) for current supplier.
ListArray()
Return the suppliers list.
getNbOfOrders()
Return nb of orders.
__construct($db)
Constructor.
loadStateBoard()
Load statistics indicators.
fetch($rowid, $ref='', $ref_ext='', $barcode='', $idprof1='', $idprof2='', $idprof3='', $idprof4='', $idprof5='', $idprof6='', $email='', $ref_alias='', $is_client=0, $is_supplier=1)
Load a third party from database into memory.
CreateCategory($user, $name)
Create a supplier category.
static replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
Function used to replace a thirdparty id with another one.
Class to manage third parties objects (customers, suppliers, prospects...)
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...