本文整理汇总了PHP中Societe::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Societe::fetch方法的具体用法?PHP Societe::fetch怎么用?PHP Societe::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Societe
的用法示例。
在下文中一共展示了Societe::fetch方法的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: delete
/**
* Delete thirdparty
*
* @param int $id Thirparty ID
* @return type
*
* @url DELETE thirdparty/{id}
*/
function delete($id)
{
if (!DolibarrApiAccess::$user->rights->societe->supprimer) {
throw new RestException(401);
}
$result = $this->company->fetch($id);
if (!$result) {
throw new RestException(404, 'Thirdparty not found');
}
if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) {
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
return $this->company->delete($id);
}
示例7: 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;
}
}
示例8: 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);
}
示例9: Expedition
$result = $delivery->fetch($_GET["id"]);
$delivery->fetch_thirdparty();
$expedition=new Expedition($db);
$result = $expedition->fetch($delivery->origin_id);
$typeobject = $expedition->origin;
if ($delivery->origin_id)
{
$delivery->fetch_origin();
}
if ( $delivery->id > 0)
{
$soc = new Societe($db);
$soc->fetch($delivery->socid);
$head=delivery_prepare_head($delivery);
dol_fiche_head($head, 'delivery', $langs->trans("Sending"), 0, 'sending');
/*
* Confirmation de la suppression
*
*/
if ($_GET["action"] == 'delete')
{
$expedition_id = $_GET["expid"];
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1);
if ($ret == 'html') print '<br>';
}
示例10: GETPOST
* \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';
llxHeader('', $langs->trans("ThirdParty") . ' - ' . $langs->trans("Notes"), $help_url);
if ($id > 0) {
示例11: Propal
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ', p.ref DESC';
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
//print $sql;
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result) {
$objectstatic = new Propal($db);
$userstatic = new User($db);
$num = $db->num_rows($result);
if ($socid) {
$soc = new Societe($db);
$soc->fetch($socid);
}
$param = '&socid=' . $socid . '&viewstatut=' . $viewstatut;
if ($month) {
$param .= '&month=' . $month;
}
if ($year) {
$param .= '&year=' . $year;
}
if ($search_ref) {
$param .= '&search_ref=' . $search_ref;
}
if ($search_refcustomer) {
$param .= '&search_refcustomer=' . $search_refcustomer;
}
if ($search_societe) {
示例12: Societe
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
include_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) {
$company = new Societe($db);
$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
$companyLink = $company->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
$bankcash = new Account($db);
$bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]);
$bankcash->label = $bankcash->ref;
$bankcashLink = $bankcash->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
$bankcb = new Account($db);
$bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]);
$bankcbLink = $bankcb->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$bankcheque = new Account($db);
示例13: Product
// Remove element from category
if ($id > 0 && $removeelem > 0) {
if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) {
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$tmpobject = new Product($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'product';
} else {
if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) {
$tmpobject = new Societe($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'fournisseur';
} else {
if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) {
$tmpobject = new Societe($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'societe';
} else {
if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) {
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
$tmpobject = new Adherent($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'member';
} else {
if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$tmpobject = new Contact($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'contact';
}
}
示例14: accessforbidden
/*
* Show object in view mode
*/
$result = $object->fetch($id, $ref);
if ($result <= 0) {
dol_print_error($db, $object->error);
exit;
}
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
if ($user->societe_id > 0 && $user->societe_id != $object->socid) {
accessforbidden('', 0);
}
$result = $object->fetch_thirdparty();
$soc = new Societe($db);
$result = $soc->fetch($object->socid);
if ($result < 0) {
dol_print_error($db);
}
$selleruserevenustamp = $mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
// print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
// selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
if ($object->paye) {
示例15: Societe
print '</div>';
}
else
{
/*
* Confirmation de la suppression du deplacement
*/
if ($_GET["action"] == 'delete')
{
$ret=$html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete");
if ($ret == 'html') print '<br>';
}
$soc = new Societe($db);
if ($deplacement->socid) $soc->fetch($deplacement->socid);
print '<table class="border" width="100%">';
// Ref
print "<tr>";
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
print $html->showrefnav($deplacement,'id','',1,'rowid','ref','');
print '</td></tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans($deplacement->type).'</td></tr>';
// Who
print '<tr><td>'.$langs->trans("Person").'</td><td>';
$userfee=new User($db);