26require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
 
   27require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
 
   28require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
 
   36  public $next_prev_filter = 
"(te.fournisseur:=:1)"; 
 
   49    $this->fournisseur = 1;
 
 
   71  public function fetch($rowid, $ref = 
'', $ref_ext = 
'', $barcode = 
'', $idprof1 = 
'', $idprof2 = 
'', $idprof3 = 
'', $idprof4 = 
'', $idprof5 = 
'', $idprof6 = 
'', $email = 
'', $ref_alias = 
'', $is_client = 0, $is_supplier = 1)
 
   73    return parent::fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias, $is_client, $is_supplier);
 
 
   85    $sql = 
"SELECT rowid";
 
   86    $sql .= 
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf";
 
   87    $sql .= 
" WHERE cf.fk_soc = ".((int) $this->
id);
 
   89    $resql = $this->db->query($sql);
 
   91      $num = $this->db->num_rows($resql);
 
 
  106    $sql = 
"SELECT count(pfp.rowid) as nb";
 
  107    $sql .= 
" FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price as pfp";
 
  108    $sql .= 
" WHERE pfp.entity = ".$conf->entity;
 
  109    $sql .= 
" AND pfp.fk_soc = ".((int) $this->
id);
 
  111    $resql = $this->db->query($sql);
 
  113      $obj = $this->db->fetch_object($resql);
 
 
  127    global $conf, $user, $hookmanager;
 
  132    $sql = 
"SELECT count(s.rowid) as nb";
 
  133    $sql .= 
" FROM ".MAIN_DB_PREFIX.
"societe as s";
 
  134    if (!$user->hasRight(
"societe", 
"client", 
"voir") && !$user->socid) {
 
  135      $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
 
  136      $sql .= 
" WHERE sc.fk_user = ".((int) $user->id);
 
  139    $sql .= 
" ".$clause.
" s.fournisseur = 1";
 
  140    $sql .= 
" AND s.entity IN (".getEntity(
'societe').
")";
 
  142    if (is_object($hookmanager)) {
 
  143      $parameters = array();
 
  144      $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $this); 
 
  145      $sql .= $hookmanager->resPrint;
 
  148    $resql = $this->db->query($sql);
 
  150      while ($obj = $this->db->fetch_object($resql)) {
 
  151        $this->nb[
"suppliers"] = $obj->nb;
 
  153      $this->db->free($resql);
 
  157      $this->error = $this->db->error();
 
 
  173    $sql = 
"INSERT INTO ".MAIN_DB_PREFIX.
"categorie (label,visible,type)";
 
  175    $sql .= 
" ('".$this->db->escape($name).
"',1,1)";
 
  177    dol_syslog(
"Fournisseur::CreateCategory", LOG_DEBUG);
 
  178    $resql = $this->db->query($sql);
 
  180      dol_syslog(
"Fournisseur::CreateCategory : Success");
 
  183      $this->error = $this->db->lasterror();
 
  184      dol_syslog(
"Fournisseur::CreateCategory : Failed (".$this->error.
")");
 
 
  203    $sql = 
"SELECT s.rowid, s.nom as name";
 
  204    $sql .= 
" FROM ".MAIN_DB_PREFIX.
"societe as s";
 
  205    if (!$user->hasRight(
"societe", 
"client", 
"voir") && !$user->socid) {
 
  206      $sql .= 
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
 
  208    $sql .= 
" WHERE s.fournisseur = 1";
 
  209    $sql .= 
" AND s.entity IN (".getEntity(
'societe').
")";
 
  210    if (!$user->hasRight(
"societe", 
"client", 
"voir") && !$user->socid) {
 
  211      $sql .= 
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
 
  214    $resql = $this->db->query($sql);
 
  217      while ($obj = $this->db->fetch_object($resql)) {
 
  218        $arr[$obj->rowid] = $obj->name;
 
  222      $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.