本文整理汇总了PHP中FactureFournisseur::fetch_thirdparty方法的典型用法代码示例。如果您正苦于以下问题:PHP FactureFournisseur::fetch_thirdparty方法的具体用法?PHP FactureFournisseur::fetch_thirdparty怎么用?PHP FactureFournisseur::fetch_thirdparty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactureFournisseur
的用法示例。
在下文中一共展示了FactureFournisseur::fetch_thirdparty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restrictedArea
// Security check
$socid = '';
if (!empty($user->societe_id)) {
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('invoicesuppliercard', 'globalcard'));
$object = new FactureFournisseur($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref);
$object->fetch_thirdparty();
}
$permissionnote = $user->rights->fournisseur->facture->creer;
// Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->fournisseur->facture->creer;
// Used by the include of actions_dellink.inc.php
$permissionedit = $user->rights->fournisseur->facture->creer;
// Used by the include of actions_lineupdown.inc.php
/*
* Actions
*/
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
示例2: addPaymentToBank
/**
* Add a record into bank for payment with links between this bank record and invoices of payment.
* All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create().
*
* @param User $user Object of user making payment
* @param string $mode 'payment', 'payment_supplier'
* @param string $label Label to use in bank record
* @param int $accountid Id of bank account to do link with
* @param string $emetteur_nom Name of transmitter
* @param string $emetteur_banque Name of bank
* @param int $notrigger No trigger
* @return int <0 if KO, bank_line_id if OK
*/
function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0)
{
global $conf, $langs, $user;
$error = 0;
$bank_line_id = 0;
if (!empty($conf->banque->enabled)) {
if ($accountid <= 0) {
$this->error = 'Bad value for parameter accountid';
dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->error, LOG_ERR);
return -1;
}
$this->db->begin();
$this->fk_account = $accountid;
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
dol_syslog("{$user->id},{$mode},{$label},{$this->fk_account},{$emetteur_nom},{$emetteur_banque}");
$acc = new Account($this->db);
$result = $acc->fetch($this->fk_account);
$totalamount = $this->amount;
if (empty($totalamount)) {
$totalamount = $this->total;
}
// For backward compatibility
if ($mode == 'payment_supplier') {
$totalamount = -$totalamount;
}
// Insert payment into llx_bank
$bank_line_id = $acc->addline($this->datepaye, $this->paiementid, $label, $totalamount, $this->num_paiement, '', $user, $emetteur_nom, $emetteur_banque);
// Mise a jour fk_bank dans llx_paiement
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0) {
$result = $this->update_fk_bank($bank_line_id);
if ($result <= 0) {
$error++;
dol_print_error($this->db);
}
// Add link 'payment', 'payment_supplier' in bank_url between payment and bank transaction
if (!$error) {
$url = '';
if ($mode == 'payment') {
$url = DOL_URL_ROOT . '/compta/paiement/card.php?id=';
}
if ($mode == 'payment_supplier') {
$url = DOL_URL_ROOT . '/fourn/paiement/card.php?id=';
}
if ($url) {
$result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
if ($result <= 0) {
$error++;
dol_print_error($this->db);
}
}
}
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
if (!$error && $label != '(WithdrawalPayment)') {
$linkaddedforthirdparty = array();
foreach ($this->amounts as $key => $value) {
if ($mode == 'payment') {
$fac = new Facture($this->db);
$fac->fetch($key);
$fac->fetch_thirdparty();
if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) {
$result = $acc->add_url_line($bank_line_id, $fac->thirdparty->id, DOL_URL_ROOT . '/comm/card.php?socid=', $fac->thirdparty->name, 'company');
if ($result <= 0) {
dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->db->lasterror());
}
$linkaddedforthirdparty[$fac->thirdparty->id] = $fac->thirdparty->id;
// Mark as done for this thirdparty
}
}
if ($mode == 'payment_supplier') {
$fac = new FactureFournisseur($this->db);
$fac->fetch($key);
$fac->fetch_thirdparty();
if (!in_array($fac->thirdparty->id, $linkaddedforthirdparty)) {
$result = $acc->add_url_line($bank_line_id, $fac->thirdparty->id, DOL_URL_ROOT . '/fourn/card.php?socid=', $fac->thirdparty->name, 'company');
if ($result <= 0) {
dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->db->lasterror());
}
$linkaddedforthirdparty[$fac->thirdparty->id] = $fac->thirdparty->id;
// Mark as done for this thirdparty
}
}
}
}
if (!$error && !$notrigger) {
// Appel des triggers
$result = $this->call_trigger('PAYMENT_ADD_TO_BANK', $user);
//.........这里部分代码省略.........
示例3: count
/**
* Function to build pdf onto disk
*
* @param FactureFournisseur $object Id of object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $user, $langs, $conf, $mysoc, $hookmanager;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
if ($conf->fournisseur->dir_output . '/facture') {
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement();
//$amount_credit_notes_included = $object->getSumCreditNotesUsed();
//$amount_deposits_included = $object->getSumDepositsUsed();
// Definition of $dir and $file
if ($object->specimen) {
$dir = $conf->fournisseur->facture->dir_output;
$file = $dir . "/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);
$dir = $conf->fournisseur->facture->dir_output . '/' . get_exdir($object->id, 2) . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) {
$file = $dir . "/" . $objectref . ($objectrefsupplier ? "_" . $objectrefsupplier : "") . ".pdf";
}
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
$nblignes = count($object->lines);
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Must be after pdf_getInstance
$heightforinfotot = 50;
// Height reserved to output the info and total part
$heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
// Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8;
// Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output . '/' . $conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
$pdf->Open();
$pagenb = 0;
$pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Invoice"));
$pdf->SetCreator("Dolibarr " . DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("Order"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
$pdf->SetCompression(false);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
// Left, Top, Right
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0; $i < $nblignes; $i++) {
if ($object->lines[$i]->remise_percent) {
$this->atleastonediscount++;
}
}
if (empty($this->atleastonediscount)) {
$this->posxpicture += $this->postotalht - $this->posxdiscount;
$this->posxtva += $this->postotalht - $this->posxdiscount;
$this->posxup += $this->postotalht - $this->posxdiscount;
$this->posxqty += $this->postotalht - $this->posxdiscount;
$this->posxdiscount += $this->postotalht - $this->posxdiscount;
//$this->postotalht;
}
// New page
//.........这里部分代码省略.........
示例4: Form
llxHeader('', $langs->trans("Bill"), $helpurl);
dol_include_once('/labelprint/class/utils.class.php');
$html = new Form($db);
$form = new Form($db);
$formcompany = new FormCompany($db);
$contactstatic = new Contact($db);
$userstatic = new User($db);
/* *************************************************************************** */
/* */
/* Mode vue et edition */
/* */
/* *************************************************************************** */
if ($id > 0) {
$facture = new FactureFournisseur($db);
if ($facture->fetch($id, $user->societe_id) > 0) {
$facture->fetch_thirdparty();
$head = facturefourn_prepare_head($facture);
dol_fiche_head($head, 'labelprint', $langs->trans('SupplierInvoice'), 0, 'bill');
// Confirmation to delete invoice
if ($action == 'truncate') {
$text = $langs->trans('ConfirmTruncateList');
$formconfirm = $html->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $id, $langs->trans('TruncateList'), $text, 'confirm_truncate', '', 0, 1);
}
print $formconfirm;
/*
* Facture synthese pour rappel
*/
print '<table class="border" width="100%">';
// Reference du facture
print '<tr><td width="20%">' . $langs->trans("Ref") . '</td><td colspan="3">';
print $html->showrefnav($facture, 'facid', '', 1, 'rowid', 'ref', $morehtmlref);
示例5: FactureFournisseur
$mesg=dol_remove_file_process($_POST['removedfile'],0);
$_GET["action"]='presend';
$_POST["action"]='presend';
}
/*
* Send mail
*/
if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{
$langs->load('mails');
$facturefourn=new FactureFournisseur($db);
$facturefourn->fetch($_GET['facid']);
$result=$facturefourn->fetch_thirdparty();
if ($result > 0)
{
$ref = dol_sanitizeFileName($facturefourn->ref);
$file = $conf->fournisseur->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (is_readable($file))
{
if ($_POST['sendto'])
{
// Le destinataire a ete fourni via le champ libre
$sendto = $_POST['sendto'];
$sendtoid = 0;
}
elseif ($_POST['receiver'] != '-1')
{
示例6: Form
}
}
/*
* View
*/
$html = new Form($db);
llxHeader();
if ($_GET["facid"])
{
$fac->fetch_thirdparty();
$head = facturefourn_prepare_head($fac);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'note', $titre, 0, 'bill');
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($fac,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref supplier
示例7: header
$mesg = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>';
} else {
$result = $object->createFromClone($id);
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?action=editfacnumber&id=' . $result);
exit;
} else {
$langs->load("errors");
$mesg = '<div class="error">' . $langs->trans($object->error) . '</div>';
$action = '';
}
}
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider) {
$idwarehouse = GETPOST('idwarehouse');
$object->fetch($id);
$object->fetch_thirdparty();
// Check parameters
if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $object->hasProductsOrServices(1)) {
$langs->load("stocks");
if (!$idwarehouse || $idwarehouse == -1) {
$error++;
$errors[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse"));
$action = '';
}
}
if (!$error) {
$result = $object->validate($user, '', $idwarehouse);
if ($result < 0) {
$mesg = '<div class="error">' . $object->error . '</div>';
}
}
示例8: addPaymentToBank
/**
* A record into bank for payment with links between this bank record and invoices of payment.
* All payment properties must have been set first like after a call to create().
* @param user Object of user making payment
* @param mode 'payment', 'payment_supplier'
* @param label Label to use in bank record
* @param accountid Id of bank account to do link with
* @param emetteur_nom Name of transmitter
* @param emetteur_banque Name of bank
* @return int <0 if KO, bank_line_id if OK
*/
function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque,$notrigger=0)
{
global $conf,$langs,$user;
$error=0;
$bank_line_id=0;
$this->fk_account=$accountid;
if ($conf->banque->enabled)
{
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
dol_syslog("$user->id,$mode,$label,$this->fk_account,$emetteur_nom,$emetteur_banque");
$acc = new Account($this->db);
$acc->fetch($this->fk_account);
$totalamount=$this->amount;
if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility
if ($mode == 'payment') $totalamount=$totalamount;
if ($mode == 'payment_supplier') $totalamount=-$totalamount;
// Insert payment into llx_bank
$bank_line_id = $acc->addline($this->datepaye,
$this->paiementid, // Payment mode id or code ("CHQ or VIR for example")
$label,
$totalamount,
$this->num_paiement,
'',
$user,
$emetteur_nom,
$emetteur_banque);
// Mise a jour fk_bank dans llx_paiement
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
{
$result=$this->update_fk_bank($bank_line_id);
if ($result <= 0)
{
$error++;
dol_print_error($this->db);
}
// Add link 'payment', 'payment_supplier' in bank_url between payment and bank transaction
if ( ! $error)
{
$url='';
if ($mode == 'payment') $url=DOL_URL_ROOT.'/compta/paiement/fiche.php?id=';
if ($mode == 'payment_supplier') $url=DOL_URL_ROOT.'/fourn/paiement/fiche.php?id=';
if ($url)
{
$result=$acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
if ($result <= 0)
{
$error++;
dol_print_error($this->db);
}
}
}
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
if (! $error)
{
$linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of.
{
if ($mode == 'payment')
{
$fac = new Facture($this->db);
$fac->fetch($key);
$fac->fetch_thirdparty();
if (! in_array($fac->thirdparty->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{
$result=$acc->add_url_line($bank_line_id, $fac->thirdparty->id,
DOL_URL_ROOT.'/comm/fiche.php?socid=', $fac->thirdparty->nom, 'company');
if ($result <= 0) dol_print_error($this->db);
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
}
}
if ($mode == 'payment_supplier')
{
$fac = new FactureFournisseur($this->db);
$fac->fetch($key);
$fac->fetch_thirdparty();
if (! in_array($fac->thirdparty->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{
$result=$acc->add_url_line($bank_line_id, $fac->thirdparty->id,
DOL_URL_ROOT.'/fourn/fiche.php?socid=', $fac->thirdparty->nom, 'company');
//.........这里部分代码省略.........
示例9: unset
$localtax2tx = get_localtax($_POST['tauxtva'], 2, $societe);
}
$result = $facfou->updateline($_GET['lineid'], $label, $pu, $_POST['tauxtva'], $localtax1tx, $localtax2tx, $_POST['qty'], $_POST['idprod'], $price_base_type, 0, $type);
if ($result >= 0) {
unset($_POST['label']);
}
}
}
if ($_GET['action'] == 'addline') {
$facfou = new FactureFournisseur($db, '', $_GET['facid']);
$ret = $facfou->fetch($_GET['facid']);
if ($ret < 0) {
dol_print_error($db, $facfou->error);
exit;
}
$ret = $facfou->fetch_thirdparty();
if ($_POST['idprodfournprice']) {
$product = new ProductFournisseur($db);
$idprod = $product->get_buyprice($_POST['idprodfournprice'], $_POST['qty']);
if ($idprod > 0) {
$result = $product->fetch($idprod);
// cas special pour lequel on a les meme reference que le fournisseur
// $label = '['.$product->ref.'] - '. $product->libelle;
$label = $product->description;
$tvatx = get_default_tva($facfou->thirdparty, $mysoc, $product->id);
$localtax1tx = get_localtax($tvatx, 1, $mysoc);
$localtax2tx = get_localtax($tvatx, 2, $mysoc);
$type = $product->type;
$result = $facfou->addline($label, $product->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $_POST['qty'], $idprod);
}
if ($idprod == -1) {