当前位置: 首页>>代码示例>>PHP>>正文


PHP Paiement::valide方法代码示例

本文整理汇总了PHP中Paiement::valide方法的典型用法代码示例。如果您正苦于以下问题:PHP Paiement::valide方法的具体用法?PHP Paiement::valide怎么用?PHP Paiement::valide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Paiement的用法示例。


在下文中一共展示了Paiement::valide方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Create
  *
  * @param 	User		$user				User object
  * @param 	int			$id					Id
  * @param 	string		$motif				Motif
  * @param 	int	$date_rejet			Date rejet
  * @param 	int			$bonid				Bon id
  * @param 	int			$facturation		Facturation
  * @return	void
  */
 function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0)
 {
     global $langs, $conf;
     $error = 0;
     $this->id = $id;
     $this->bon_id = $bonid;
     $now = dol_now();
     dol_syslog("RejetPrelevement::Create id {$id}");
     $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
     $facs = $this->getListInvoices(1);
     $this->db->begin();
     // Insert refused line into database
     $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_rejet (";
     $sql .= "fk_prelevement_lignes";
     $sql .= ", date_rejet";
     $sql .= ", motif";
     $sql .= ", fk_user_creation";
     $sql .= ", date_creation";
     $sql .= ", afacturer";
     $sql .= ") VALUES (";
     $sql .= $id;
     $sql .= ", '" . $this->db->idate($date_rejet) . "'";
     $sql .= ", " . $motif;
     $sql .= ", " . $user->id;
     $sql .= ", '" . $this->db->idate($now) . "'";
     $sql .= ", " . $facturation;
     $sql .= ")";
     $result = $this->db->query($sql);
     if (!$result) {
         dol_syslog("RejetPrelevement::create Erreur 4");
         dol_syslog("RejetPrelevement::create Erreur 4 {$sql}");
         $error++;
     }
     // Tag the line to refused
     $sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes ";
     $sql .= " SET statut = 3";
     $sql .= " WHERE rowid = " . $id;
     if (!$this->db->query($sql)) {
         dol_syslog("RejetPrelevement::create Erreur 5");
         $error++;
     }
     $num = count($facs);
     for ($i = 0; $i < $num; $i++) {
         $fac = new Facture($this->db);
         $fac->fetch($facs[$i][0]);
         // Make a negative payment
         $pai = new Paiement($this->db);
         $pai->amounts = array();
         /*
          * We replace the comma with a point otherwise some
          * PHP installs sends only the part integer negative
          */
         $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * -1);
         $pai->datepaye = $date_rejet;
         $pai->paiementid = 3;
         // type of payment: withdrawal
         $pai->num_paiement = $fac->ref;
         if ($pai->create($this->user) < 0) {
             $error++;
             dol_syslog("RejetPrelevement::Create Error creation payment invoice " . $facs[$i][0]);
         } else {
             $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', '');
             if ($result < 0) {
                 dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");
                 $error++;
             }
             // Payment validation
             if ($pai->valide() < 0) {
                 $error++;
                 dol_syslog("RejetPrelevement::Create Error payment validation");
             }
         }
         //Tag invoice as unpaid
         dol_syslog("RejetPrelevement::Create set_unpaid fac " . $fac->ref);
         $fac->set_unpaid($user);
         //TODO: Must be managed by notifications module
         // Send email to sender of the standing order request
         $this->_send_email($fac);
     }
     if ($error == 0) {
         dol_syslog("RejetPrelevement::Create Commit");
         $this->db->commit();
     } else {
         dol_syslog("RejetPrelevement::Create Rollback");
         $this->db->rollback();
     }
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:98,代码来源:rejetprelevement.class.php

示例2: header

    $object->fetch($id);
    $result = $object->delete();
    if ($result > 0) {
        $db->commit();
        header("Location: list.php");
        exit;
    } else {
        $langs->load("errors");
        setEventMessage($langs->trans($object->error), 'errors');
        $db->rollback();
    }
}
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->paiement) {
    $db->begin();
    $object->fetch($id);
    if ($object->valide() > 0) {
        $db->commit();
        // Loop on each invoice linked to this payment to rebuild PDF
        $factures = array();
        foreach ($factures as $id) {
            $fac = new Facture($db);
            $fac->fetch($id);
            $outputlangs = $langs;
            if (!empty($_REQUEST['lang_id'])) {
                $outputlangs = new Translate("", $conf);
                $outputlangs->setDefaultLang($_REQUEST['lang_id']);
            }
            if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
                $fac->generateDocument($fac->modelpdf, $outputlangs);
            }
        }
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:card.php

示例3: Paiement

	}
	else
	{
	    $langs->load("errors");
		$mesg='<div class="error">'.$langs->trans($paiement->error).'</div>';
        $db->rollback();
	}
}

if ($action == 'confirm_valide' && GETPOST('confirm') == 'yes' && $user->rights->facture->paiement)
{
	$db->begin();

	$paiement = new Paiement($db);
    $paiement->fetch($id);
	if ($paiement->valide() > 0)
	{
		$db->commit();

		// Loop on each invoice linked to this payment to rebuild PDF
		$factures=array();
		foreach($factures as $id)
		{
			$fac = new Facture($db);
			$fac->fetch($id);

			$outputlangs = $langs;
			if (! empty($_REQUEST['lang_id']))
			{
				$outputlangs = new Translate("",$conf);
				$outputlangs->setDefaultLang($_REQUEST['lang_id']);
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:fiche.php


注:本文中的Paiement::valide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。