Go to the documentation of this file.
26 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
36 public $next_prev_filter =
"te.fournisseur = 1";
49 $this->fournisseur = 1;
60 $sql =
"SELECT rowid";
61 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
62 $sql .=
" WHERE cf.fk_soc = ".((int) $this->
id);
71 $this->single_open_commande = $row[0];
86 $sql =
"SELECT count(pfp.rowid) as nb";
87 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price as pfp";
88 $sql .=
" WHERE pfp.entity = ".$conf->entity;
89 $sql .=
" AND pfp.fk_soc = ".((int) $this->
id);
93 $obj = $this->
db->fetch_object(
$resql);
109 global $conf, $user, $hookmanager;
114 $sql =
"SELECT count(s.rowid) as nb";
115 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
116 if (empty($user->rights->societe->client->voir) && !$user->socid) {
117 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
118 $sql .=
" WHERE sc.fk_user = ".((int) $user->id);
121 $sql .=
" ".$clause.
" s.fournisseur = 1";
122 $sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
124 if (is_object($hookmanager)) {
125 $parameters = array();
126 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $this);
127 $sql .= $hookmanager->resPrint;
132 while ($obj = $this->
db->fetch_object(
$resql)) {
133 $this->nb[
"suppliers"] = $obj->nb;
139 $this->error = $this->
db->error();
155 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"categorie (label,visible,type)";
157 $sql .=
" ('".$this->db->escape($name).
"',1,1)";
159 dol_syslog(
"Fournisseur::CreateCategory", LOG_DEBUG);
162 dol_syslog(
"Fournisseur::CreateCategory : Success");
165 $this->error = $this->
db->lasterror();
166 dol_syslog(
"Fournisseur::CreateCategory : Failed (".$this->error.
")");
185 $sql =
"SELECT s.rowid, s.nom as name";
186 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
187 if (empty($user->rights->societe->client->voir) && !$user->socid) {
188 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
190 $sql .=
" WHERE s.fournisseur = 1";
191 $sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
192 if (empty($user->rights->societe->client->voir) && !$user->socid) {
193 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
199 while ($obj = $this->
db->fetch_object(
$resql)) {
200 $arr[$obj->rowid] = $obj->name;
204 $this->error = $this->
db->lasterror();
Class to manage third parties objects (customers, suppliers, prospects...)
$conf db
API class for accounts.
Class to manage Dolibarr database access.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
CreateCategory($user, $name)
Create a supplier category.
static replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
Function used to replace a thirdparty id with another one.
load_state_board()
Load statistics indicators.
Class to manage suppliers.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
static commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
Function used to replace a thirdparty id with another one.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
__construct($db)
Constructor.
nbOfProductRefs()
Returns number of ref prices (not number of products).
ListArray()
Return the suppliers list.
getNbOfOrders()
Return nb of orders.