本文整理汇总了PHP中Societe类的典型用法代码示例。如果您正苦于以下问题:PHP Societe类的具体用法?PHP Societe怎么用?PHP Societe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Societe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforePDFCreation
function beforePDFCreation($parameters, &$object, &$action, $hookmanager)
{
if ($object->element == 'facture') {
if (isset($object->thirdparty)) {
$societe =& $object->thirdparty;
} else {
dol_include_once('/societe/class/societe.class.php');
$societe = new Societe($db);
$societe->fetch($object->socid);
}
if (!empty($societe->id)) {
global $db, $conf;
if (!empty($societe->array_options['options_fk_soc_factor']) && $societe->array_options['options_factor_suivi'] == 1) {
define('INC_FROM_DOLIBARR', true);
dol_include_once('/factor/config.php');
dol_include_once('/factor/class/factor.class.php');
$PDOdb = new TPDOdb();
$factor = new TFactor();
$factor->loadBy($PDOdb, $societe->array_options['options_fk_soc_factor'], 'fk_soc');
if (!empty($factor->mention)) {
if (strpos($object->note_public, $factor->mention) === false) {
$object->note_public = $factor->mention . (!empty($object->note_public) ? "\n\n" . $object->note_public : '');
$r = $object->update_note($object->note_public, '_public');
}
}
}
}
}
}
示例2: getRefByObject
static function getRefByObject(&$object)
{
global $db;
$ref = '';
if ($object->element == 'societe' && !empty($object->code_client)) {
$ref = $object->code_client;
} else {
if ($object->element == 'societe') {
$ref = $object->name;
} else {
if ($object->element == 'contact') {
dol_include_once('/societe/class/societe.class.php');
$soc = new Societe($db);
$soc->fetch($object->socid);
$ref = trim((!empty($soc->code_client) ? $soc->code_client : $soc->name) . '_' . $object->lastname);
} else {
if ($object->element == 'user' && !empty($object->login)) {
$ref = $object->login;
} elseif (!empty($object->ref)) {
$ref = $object->ref;
}
}
}
}
return $ref;
}
示例3: getObject
/**
* Get object from id or ref and save it into this->object
*
* @param int $id Object id
* @param ref $ref Object ref
* @return object Object loaded
*/
protected function getObject($id,$ref='')
{
$ret = $this->getInstanceDao();
$object = new Societe($this->db);
if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref);
$this->object = $object;
}
示例4: ajoutArticle
/**
* Add a product into cart
*
* @return void
*/
public function ajoutArticle()
{
global $conf, $db, $mysoc;
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$product = new Product($db);
$product->fetch($this->id);
$sql = "SELECT taux";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_tva";
$sql .= " WHERE rowid = " . $this->tva();
dol_syslog("ajoutArticle", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$vat_rate = $obj->taux;
//var_dump($vat_rate);exit;
} else {
dol_print_error($db);
}
// Define part of HT, VAT, TTC
$resultarray = calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, 0, 0, 0, 'HT', 0, $product->type, $mysoc);
// Calcul du total ht sans remise
$total_ht = $resultarray[0];
$total_vat = $resultarray[1];
$total_ttc = $resultarray[2];
// Calcul du montant de la remise
if ($this->remisePercent()) {
$remise_percent = $this->remisePercent();
} else {
$remise_percent = 0;
}
$montant_remise_ht = $resultarray[6] - $resultarray[0];
$this->montantRemise($montant_remise_ht);
$newcartarray = $_SESSION['poscart'];
$i = count($newcartarray);
$newcartarray[$i]['id'] = $i;
$newcartarray[$i]['ref'] = $product->ref;
$newcartarray[$i]['label'] = $product->label;
$newcartarray[$i]['price'] = $product->price;
$newcartarray[$i]['price_ttc'] = $product->price_ttc;
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
if (isset($product->multiprices[$societe->price_level])) {
$newcartarray[$i]['price'] = $product->multiprices[$societe->price_level];
$newcartarray[$i]['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
}
}
$newcartarray[$i]['fk_article'] = $this->id;
$newcartarray[$i]['qte'] = $this->qte();
$newcartarray[$i]['fk_tva'] = $this->tva();
$newcartarray[$i]['remise_percent'] = $remise_percent;
$newcartarray[$i]['remise'] = price2num($montant_remise_ht);
$newcartarray[$i]['total_ht'] = price2num($total_ht, 'MT');
$newcartarray[$i]['total_ttc'] = price2num($total_ttc, 'MT');
$_SESSION['poscart'] = $newcartarray;
$this->raz();
}
示例5: _get_company_object
function _get_company_object(&$TRender)
{
global $db, $conf, $langs, $user;
dol_include_once('/societe/class/societe.class.php');
foreach ($TRender as $fk_soc => &$line) {
$s = new Societe($db);
$s->fetch($fk_soc);
$line['client'] = $s->name;
}
}
示例6: update
public function update(Societe $societe)
{
$query = $this->_db->prepare(' UPDATE t_societe SET
raisonSociale=:raisonSociale, dateCreation=:dateCreation
WHERE id=:id') or die(print_r($this->_db->errorInfo()));
$query->bindValue(':id', $societe->id());
$query->bindValue(':raisonSociale', $societe->raisonSociale());
$query->bindValue(':dateCreation', $societe->dateCreation());
$query->execute();
$query->closeCursor();
}
示例7: loadBox
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 5)
{
global $conf, $user, $langs, $db;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
$thirdpartystatic = new Societe($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max));
if ($user->rights->societe->lire) {
$sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms, s.status";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE s.fournisseur = 1";
$sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
if ($user->societe_id) {
$sql .= " AND s.rowid = " . $user->societe_id;
}
$sql .= " ORDER BY s.tms DESC ";
$sql .= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$datec = $db->jdate($objp->datec);
$datem = $db->jdate($objp->tms);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day"));
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3));
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedSuppliers"));
}
$db->free($result);
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
}
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
示例8: loadBox
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 5)
{
global $user, $langs, $db, $conf;
$langs->load("boxes");
$this->max = $max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts", $max));
if ($user->rights->societe->lire) {
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
$sql .= ", s.nom as socname";
$sql .= ", s.code_client";
$sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON sp.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE sp.entity IN (" . getEntity('societe', 1) . ")";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
if ($user->societe_id) {
$sql .= " AND sp.fk_soc = " . $user->societe_id;
}
$sql .= " ORDER BY sp.tms DESC";
$sql .= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$contactstatic = new Contact($db);
$societestatic = new Societe($db);
$line = 0;
while ($line < $num) {
$objp = $db->fetch_object($result);
$datec = $db->jdate($objp->datec);
$datem = $db->jdate($objp->tms);
$contactstatic->id = $objp->id;
$contactstatic->lastname = $objp->lastname;
$contactstatic->firstname = $objp->firstname;
$contactstatic->civility_id = $objp->civility_id;
$contactstatic->statut = $objp->status;
$societestatic->id = $objp->fk_soc;
$societestatic->code_client = $objp->code_client;
$societestatic->name = $objp->socname;
$this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $contactstatic->getNomUrl(1), 'asis' => 1);
$this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : '', 'asis' => 1);
$this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day"));
$this->info_box_contents[$line][] = array('td' => 'align="right" class="nowrap" width="18"', 'text' => $contactstatic->getLibStatut(3), 'asis' => 1);
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedContacts"));
}
$db->free($result);
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
}
} else {
$this->info_box_contents[0][0] = array('align' => 'left', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
示例9: runTrigger
/**
* Function called when a Dolibarrr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
// Mettre ici le code a executer en reaction de l'action
// Les donnees de l'action sont stockees dans $object
if ($action == 'PAYPAL_PAYMENT_OK') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". source=" . $object->source . " ref=" . $object->ref);
if (!empty($object->source)) {
if ($object->source == 'membersubscription') {
//require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherents.class.php';
// TODO add subscription treatment
} else {
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
$soc = new Societe($this->db);
// Parse element/subelement (ex: project_task)
$element = $path = $filename = $object->source;
if (preg_match('/^([^_]+)_([^_]+)/i', $object->source, $regs)) {
$element = $path = $regs[1];
$filename = $regs[2];
}
// For compatibility
if ($element == 'order') {
$path = $filename = 'commande';
}
if ($element == 'invoice') {
$path = 'compta/facture';
$filename = 'facture';
}
dol_include_once('/' . $path . '/class/' . $filename . '.class.php');
$classname = ucfirst($filename);
$obj = new $classname($this->db);
$ret = $obj->fetch('', $object->ref);
if ($ret < 0) {
return -1;
}
// Add payer id
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
// Add transaction id
$obj->setValueFrom('ref_int', $object->resArray["TRANSACTIONID"]);
}
} else {
// TODO add free tag treatment
}
}
return 0;
}
示例10: getRemise
static function getRemise(&$PDOdb, $type, $total, $zip = '', $fk_shipment_mode = 0, $fk_soc = 0)
{
global $db, $conf;
if (!empty($conf->global->REMISE_USE_THIRDPARTY_DISCOUNT) && !empty($fk_soc)) {
dol_include_once('/societe/class/societe.class.php');
$s = new Societe($db);
$s->fetch($fk_soc);
return $s->array_options['options_remsup'];
}
$TRemise = TRemise::getAll($PDOdb, $type, true, !empty($zip), !empty($fk_shipment_mode));
$remise_used = 0;
$find = false;
if (!empty($TRemise)) {
foreach ($TRemise as &$remise) {
if ($type === 'WEIGHT' && $total >= $remise['palier'] && ($remise['remise'] > $remise_used || empty($remise_used))) {
if (!empty($zip) && !empty($remise['zip']) && strpos($zip, $remise['zip']) === 0) {
$remise_used = $remise['remise'];
$find = true;
break;
} else {
if (empty($zip) && empty($remise['zip'])) {
// pas de remise associée au code poste trouvé avant
$find = true;
$remise_used = $remise['remise'];
break;
}
}
} else {
if ($type === 'AMOUNT') {
if ($total >= $remise['palier'] && ($remise['remise'] > $remise_used || empty($remise_used))) {
$remise_used = $remise['remise'];
$find = true;
}
}
}
}
}
if (!$find && !empty($zip)) {
return TRemise::getRemise($PDOdb, $type, $total);
} else {
return $remise_used;
}
}
示例11: array
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param Societe $object Supplier invoice
*/
function __construct($db, $object)
{
global $conf, $langs, $mysoc;
$langs->load("main");
$langs->load("bills");
$this->db = $db;
$this->name = "canelle";
$this->description = $langs->trans('SuppliersInvoiceModel');
// Dimension page pour format A4
$this->type = 'pdf';
$formatarray = pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur, $this->page_hauteur);
$this->marge_gauche = 10;
$this->marge_droite = 10;
$this->marge_haute = 10;
$this->marge_basse = 10;
$this->option_logo = 1;
// Affiche logo
$this->option_tva = 1;
// Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1;
// Affiche mode reglement
$this->option_condreg = 1;
// Affiche conditions reglement
$this->option_codeproduitservice = 1;
// Affiche code produit-service
$this->option_multilang = 1;
// Dispo en plusieurs langues
$this->franchise = !$mysoc->tva_assuj;
// Get source company
if (!is_object($object->thirdparty)) {
$object->fetch_thirdparty();
}
$this->emetteur = $object->thirdparty;
if (!$this->emetteur->country_code) {
$this->emetteur->country_code = substr($langs->defaultlang, -2);
}
// By default, if was not defined
// Defini position des colonnes
$this->posxdesc = $this->marge_gauche + 1;
$this->posxtva = 111;
$this->posxup = 126;
$this->posxqty = 145;
$this->posxdiscount = 162;
$this->postotalht = 174;
$this->tva = array();
$this->localtax1 = array();
$this->localtax2 = array();
$this->atleastoneratenotnull = 0;
$this->atleastonediscount = 0;
}
示例12: generateCSV
function generateCSV()
{
global $db, $conf;
$TFactRef = $_REQUEST['toGenerate'];
// Création et attribution droits fichier
$dir = $conf->lcr->dir_output;
$filename = 'lcr_' . date('YmdHis') . '.csv';
$f = fopen($dir . '/' . $filename, 'w+');
chmod($dir . '/' . $filename, 0777);
$TTitle = array('Code client', 'Raison sociale', 'Adresse 1', 'Adresse 2', 'Code postal', 'Ville', 'Téléphone', 'Référence', 'SIREN', 'RIB', 'Agence', 'Montant', 'Monnaie', 'Accepté', 'Référence', 'Date de création', 'Date d\'échéance');
fputcsv($f, $TTitle, ';');
$fact = new Facture($db);
$s = new Societe($db);
foreach ($TFactRef as $ref_fact) {
if ($fact->fetch('', $ref_fact) > 0 && $s->fetch($fact->socid) > 0) {
$rib = $s->get_all_rib();
fputcsv($f, array($s->code_client, $s->name, $s->address, '', $s->zip, $s->town, $s->phone, $ref_fact, $s->idprof1, $rib[0]->iban, '', price($fact->total_ttc), 'E', 1, $ref_fact, date('d/m/Y', $fact->date), date('d/m/Y', $fact->date_lim_reglement)), ';');
}
}
fclose($f);
}
示例13: loadBox
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 5)
{
global $user, $langs, $db, $conf;
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
$thirdpartystatic = new Societe($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $max));
if ($user->rights->societe->lire) {
$sql = "SELECT s.nom as name, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE s.client IN (2, 3)";
$sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
if ($user->societe_id) {
$sql .= " AND s.rowid = " . $user->societe_id;
}
$sql .= " ORDER BY s.tms DESC";
$sql .= $db->plimit($max, 0);
dol_syslog(get_class($this) . "::loadBox", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$prospectstatic = new Prospect($db);
while ($i < $num) {
$objp = $db->fetch_object($resql);
$datec = $db->jdate($objp->datec);
$datem = $db->jdate($objp->tms);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->name, 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day"));
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => str_replace('img ', 'img height="14" ', $prospectstatic->LibProspStatut($objp->fk_stcomm, 3)));
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3));
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedProspects"));
}
$db->free($resql);
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
}
} else {
dol_syslog("box_prospect::loadBox not allowed de read this box content", LOG_ERR);
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
示例14: GETPOST
/**
* \file htdocs/societe/note.php
* \brief Tab for notes on third party
* \ingroup societe
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$action = GETPOST('action');
$langs->load("companies");
// Security check
$id = GETPOST('id') ? GETPOST('id', 'int') : GETPOST('socid', 'int');
if ($user->societe_id) {
$id = $user->societe_id;
}
$result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Societe($db);
if ($id > 0) {
$object->fetch($id);
}
$permissionnote = $user->rights->societe->creer;
// Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';
// Must be include, not includ_once
/*
* View
*/
$form = new Form($db);
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
示例15: GETPOST
require_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
$langs->load("supplier_proposal");
$langs->load("companies");
// Security check
$socid = GETPOST('socid', 'int');
if (isset($user->societe_id) && $user->societe_id > 0) {
$action = '';
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'supplier_proposal');
/*
* View
*/
$now = dol_now();
$supplier_proposalstatic = new SupplierProposal($db);
$companystatic = new Societe($db);
$form = new Form($db);
$formfile = new FormFile($db);
$help_url = "EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur";
llxHeader("", $langs->trans("SupplierProposalArea"), $help_url);
print load_fiche_titre($langs->trans("SupplierProposalArea"));
print '<div class="fichecenter"><div class="fichethirdleft">';
/*
* Search form
*/
$var = false;
print '<form method="post" action="' . DOL_URL_ROOT . '/supplier_proposal/list.php">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">' . $langs->trans("SearchRequest") . '</td></tr>';
print '<tr ' . $bc[$var] . '><td>';