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


PHP Interfaces类代码示例

本文整理汇总了PHP中Interfaces的典型用法代码示例。如果您正苦于以下问题:PHP Interfaces类的具体用法?PHP Interfaces怎么用?PHP Interfaces使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: insertCrawlData

 public function insertCrawlData($data)
 {
     $router_data = Router_old::getRouterInfo($data['router_id']);
     $actual_crawl_cycle = Crawling::getActualCrawlCycle();
     $last_endet_crawl_cycle = Crawling::getLastEndedCrawlCycle();
     /**Insert Router Interfaces*/
     foreach ($data['interface_data'] as $sendet_interface) {
         //Update RRD Graph DB
         $interface_last_endet_crawl = Interfaces::getInterfaceCrawlByCrawlCycleAndRouterIdAndInterfaceName($last_endet_crawl_cycle['id'], $data['router_id'], $sendet_interface['name']);
         $traffic_rx_bps = round(($sendet_interface['traffic_rx'] - $interface_last_endet_crawl['traffic_rx']) / $GLOBALS['crawl_cycle'] / 60);
         $traffic_rx_bps = $traffic_rx_bps < 0 ? 0 : $traffic_rx_bps;
         $traffic_tx_bps = round(($sendet_interface['traffic_tx'] - $interface_last_endet_crawl['traffic_tx']) / $GLOBALS['crawl_cycle'] / 60);
         $traffic_tx_bps = $traffic_tx_bps < 0 ? 0 : $traffic_tx_bps;
         //Set default indizies to prevent from warnings
         $sendet_interface['wlan_frequency'] = isset($sendet_interface['wlan_frequency']) ? preg_replace("/([A-Za-z])/", "", $sendet_interface['wlan_frequency']) : "";
         $sendet_interface['wlan_mode'] = isset($sendet_interface['wlan_mode']) ? $sendet_interface['wlan_mode'] : "";
         $sendet_interface['wlan_essid'] = isset($sendet_interface['wlan_essid']) ? $sendet_interface['wlan_essid'] : "";
         $sendet_interface['wlan_bssid'] = isset($sendet_interface['wlan_bssid']) ? $sendet_interface['wlan_bssid'] : "";
         $sendet_interface['wlan_tx_power'] = isset($sendet_interface['wlan_tx_power']) ? $sendet_interface['wlan_tx_power'] : 0;
         //check if interface already exists
         $networkinterface_test = new Networkinterface(false, (int) $data['router_id'], $sendet_interface['name']);
         //if interface not exist, create new
         if (!$networkinterface_test->fetch()) {
             $networkinterface_new = new Networkinterface(false, (int) $data['router_id'], $sendet_interface['name']);
             $networkinterface_id = $networkinterface_new->store();
         } else {
             $networkinterface_id = $networkinterface_test->getNetworkinterfaceId();
         }
         //save crawl data for interface
         $networkinterface_status = new NetworkinterfaceStatus(false, (int) $actual_crawl_cycle['id'], (int) $networkinterface_id, (int) $data['router_id'], $sendet_interface['name'], $sendet_interface['mac_addr'], (int) $sendet_interface['mtu'], (int) $sendet_interface['traffic_rx'], (int) $traffic_rx_bps, (int) $sendet_interface['traffic_tx'], (int) $traffic_tx_bps, $sendet_interface['wlan_mode'], $sendet_interface['wlan_frequency'], $sendet_interface['wlan_essid'], $sendet_interface['wlan_bssid'], (int) $sendet_interface['wlan_tx_power'], false);
         $networkinterface_status->store();
         //Update RRDDatabase
         $rrd_path_traffic_rx = ROOT_DIR . "/rrdtool/databases/router_{$data['router_id']}_interface_{$sendet_interface['name']}_traffic_rx.rrd";
         if (!file_exists($rrd_path_traffic_rx)) {
             exec("rrdtool create {$rrd_path_traffic_rx} --step 600 --start " . time() . " DS:traffic_rx:GAUGE:700:U:U DS:traffic_tx:GAUGE:900:U:U RRA:AVERAGE:0:1:144 RRA:AVERAGE:0:6:168 RRA:AVERAGE:0:18:240");
         }
         exec("rrdtool update {$rrd_path_traffic_rx} " . time() . ":" . round($traffic_rx_bps / 1000, 2) . ":" . round($traffic_tx_bps / 1000, 2));
         //add unknown ipv6 link local addresses to netmon
         //prepare data
         $ipv6_link_local_addr = explode("/", $sendet_interface['ipv6_link_local_addr']);
         $ipv6_link_local_netmask = isset($ipv6_link_local_addr[1]) ? (int) $ipv6_link_local_addr[1] : 64;
         $ipv6_link_local_addr = Ip::ipv6Expand($ipv6_link_local_addr[0]);
         //first try to determine network of given address
         $ipv6_link_local_network = Ip::ipv6NetworkFromAddr($ipv6_link_local_addr, (int) $ipv6_link_local_netmask);
         $network = new Network(false, false, $ipv6_link_local_network, (int) $ipv6_link_local_netmask, 6);
         if ($network->fetch()) {
             //if network found, then try to add ip address
             $ip = new Ip(false, (int) $networkinterface_id, $network->getNetworkId(), $ipv6_link_local_addr);
             $ip->store();
         }
     }
     RrdTool::updateRouterClientCountHistory($data['router_id'], $data['client_count']);
 }
开发者ID:wAmpIre,项目名称:netmon,代码行数:53,代码来源:crawl.class.php

示例2: delTimeSpent

    /**
     *  Delete time spent
     *
     *  @param	User	$user        	User that delete
     *  @param  int		$notrigger	    0=launch triggers after, 1=disable triggers
     *  @return	int						<0 if KO, >0 if OK
     */
    function delTimeSpent($user, $notrigger=0)
    {
        global $conf, $langs;

        $error=0;

        $this->db->begin();

        $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
        $sql.= " WHERE rowid = ".$this->timespent_id;

        dol_syslog(get_class($this)."::delTimeSpent sql=".$sql);
        $resql = $this->db->query($sql);
        if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }

        if (! $error)
        {
            if (! $notrigger)
            {
                // Call triggers
                include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
                $interface=new Interfaces($this->db);
                $result=$interface->run_triggers('TASK_TIMESPENT_DELETE',$this,$user,$langs,$conf);
                if ($result < 0) { $error++; $this->errors=$interface->errors; }
                // End call triggers
            }
        }

        if (! $error)
        {
            $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task";
            $sql.= " SET duration_effective = duration_effective - '".$this->timespent_duration."'";
            $sql.= " WHERE rowid = ".$this->id;

            dol_syslog(get_class($this)."::delTimeSpent sql=".$sql, LOG_DEBUG);
            if ($this->db->query($sql) )
            {
                $result = 0;
            }
            else
            {
                $this->error=$this->db->lasterror();
                dol_syslog(get_class($this)."::addTimeSpent error -3 ".$this->error, LOG_ERR);
                $result = -2;
            }
        }

        // Commit or rollback
        if ($error)
        {
            foreach($this->errors as $errmsg)
            {
                dol_syslog(get_class($this)."::delTimeSpent ".$errmsg, LOG_ERR);
                $this->error.=($this->error?', '.$errmsg:$errmsg);
            }
            $this->db->rollback();
            return -1*$error;
        }
        else
        {
            $this->db->commit();
            return 1;
        }
    }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:71,代码来源:task.class.php

示例3: update

	/**
	 *      Update database for contract line
	 *      @param      user        	User that modify
	 *      @param      notrigger	    0=no, 1=yes (no update trigger)
	 *      @return     int         	<0 if KO, >0 if OK
	 */
	function update($user, $notrigger=0)
	{
		global $conf, $langs;

		// Clean parameters
		$this->fk_contrat=trim($this->fk_contrat);
		$this->fk_product=trim($this->fk_product);
		$this->statut=trim($this->statut);
		$this->label=trim($this->label);
		$this->description=trim($this->description);
		$this->tva_tx=trim($this->tva_tx);
		$this->localtax1_tx=trim($this->localtax1_tx);
		$this->localtax2_tx=trim($this->localtax2_tx);
		$this->qty=trim($this->qty);
		$this->remise_percent=trim($this->remise_percent);
		$this->remise=trim($this->remise);
		$this->fk_remise_except=trim($this->fk_remise_except);
		$this->subprice=price2num($this->subprice);
		$this->price_ht=price2num($this->price_ht);
		$this->total_ht=trim($this->total_ht);
		$this->total_tva=trim($this->total_tva);
		$this->total_localtax1=trim($this->total_localtax1);
		$this->total_localtax2=trim($this->total_localtax2);
		$this->total_ttc=trim($this->total_ttc);
		$this->info_bits=trim($this->info_bits);
		$this->fk_user_author=trim($this->fk_user_author);
		$this->fk_user_ouverture=trim($this->fk_user_ouverture);
		$this->fk_user_cloture=trim($this->fk_user_cloture);
		$this->commentaire=trim($this->commentaire);

		// Check parameters
		// Put here code to add control on parameters values

		// Update request
		$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
		$sql.= " fk_contrat='".$this->fk_contrat."',";
		$sql.= " fk_product=".($this->fk_product?"'".$this->fk_product."'":'null').",";
		$sql.= " statut='".$this->statut."',";
		$sql.= " label='".$this->db->escape($this->label)."',";
		$sql.= " description='".$this->db->escape($this->description)."',";
		$sql.= " date_commande=".($this->date_commande!=''?$this->db->idate($this->date_commande):"null").",";
		$sql.= " date_ouverture_prevue=".($this->date_ouverture_prevue!=''?$this->db->idate($this->date_ouverture_prevue):"null").",";
		$sql.= " date_ouverture=".($this->date_ouverture!=''?$this->db->idate($this->date_ouverture):"null").",";
		$sql.= " date_fin_validite=".($this->date_fin_validite!=''?$this->db->idate($this->date_fin_validite):"null").",";
		$sql.= " date_cloture=".($this->date_cloture!=''?$this->db->idate($this->date_cloture):"null").",";
		$sql.= " tva_tx='".$this->tva_tx."',";
		$sql.= " localtax1_tx='".$this->localtax1_tx."',";
		$sql.= " localtax2_tx='".$this->localtax2_tx."',";
		$sql.= " qty='".$this->qty."',";
		$sql.= " remise_percent='".$this->remise_percent."',";
		$sql.= " remise=".($this->remise?"'".$this->remise."'":"null").",";
		$sql.= " fk_remise_except=".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
		$sql.= " subprice='".$this->subprice."',";
		$sql.= " price_ht='".$this->price_ht."',";
		$sql.= " total_ht='".$this->total_ht."',";
		$sql.= " total_tva='".$this->total_tva."',";
		$sql.= " total_localtax1='".$this->total_localtax1."',";
		$sql.= " total_localtax2='".$this->total_localtax2."',";
		$sql.= " total_ttc='".$this->total_ttc."',";
		$sql.= " info_bits='".$this->info_bits."',";
		$sql.= " fk_user_author=".($this->fk_user_author >= 0?$this->fk_user_author:"NULL").",";
		$sql.= " fk_user_ouverture=".($this->fk_user_ouverture > 0?$this->fk_user_ouverture:"NULL").",";
		$sql.= " fk_user_cloture=".($this->fk_user_cloture > 0?$this->fk_user_cloture:"NULL").",";
		$sql.= " commentaire='".$this->db->escape($this->commentaire)."'";
		$sql.= " WHERE rowid=".$this->id;

		dol_syslog("ContratLigne::update sql=".$sql, LOG_DEBUG);
		$resql = $this->db->query($sql);
		if ($resql)
		{
			$contrat=new Contrat($this->db);
			$contrat->fetch($this->fk_contrat);
			$result=$contrat->update_statut($user);
		}
		else
		{
			$this->error="Error ".$this->db->lasterror();
			dol_syslog("ContratLigne::update ".$this->error, LOG_ERR);
			return -1;
		}

		if (! $notrigger)
		{
			// Appel des triggers
			include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
			$interface=new Interfaces($this->db);
			$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
			if ($result < 0) { $error++; $this->errors=$interface->errors; }
			// Fin appel triggers
		}

		return 1;
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:99,代码来源:contrat.class.php

示例4: delete


//.........这里部分代码省略.........
                $toute_categs ['societe'] = $static_cat->containing($this->id,2);
            }
            if ($this->fournisseur)
            {
                $toute_categs ['fournisseur'] = $static_cat->containing($this->id,1);
            }

            // Remove each "Categorie"
            foreach ($toute_categs as $type => $categs_type)
            {
                foreach ($categs_type as $cat)
                {
                    $cat->del_type($this, $type);
                }
            }

            // Remove contacts
            $sql = "DELETE from ".MAIN_DB_PREFIX."socpeople";
            $sql.= " WHERE fk_soc = " . $id;
            dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
            if ($this->db->query($sql))
            {
                $sqr++;
            }
            else
            {
                $this->error .= $this->db->lasterror();
                dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
            }

            // Update link in member table
            $sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
            $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
            dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
            if ($this->db->query($sql))
            {
                $sqr++;
            }
            else
            {
                $this->error .= $this->db->lasterror();
                dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
            }

            // Remove ban
            $sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib";
            $sql.= " WHERE fk_soc = " . $id;
            dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
            if ($this->db->query($sql))
            {
                $sqr++;
            }
            else
            {
                $this->error = $this->db->lasterror();
                dol_syslog("Societe::Delete erreur -2 ".$this->error, LOG_ERR);
            }

            // Remove third party
            $sql = "DELETE from ".MAIN_DB_PREFIX."societe";
            $sql.= " WHERE rowid = " . $id;
            dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
            if ($this->db->query($sql))
            {
                $sqr++;
            }
            else
            {
                $this->error = $this->db->lasterror();
                dol_syslog("Societe::Delete erreur -3 ".$this->error, LOG_ERR);
            }

            if ($sqr == 4)
            {
                // Appel des triggers
                include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
                $interface=new Interfaces($this->db);
                $result=$interface->run_triggers('COMPANY_DELETE',$this,$user,$langs,$conf);
                if ($result < 0) { $error++; $this->errors=$interface->errors; }
                // Fin appel triggers

                $this->db->commit();

                // Suppression du repertoire document
                $docdir = $conf->societe->dir_output . "/" . $id;
                if (file_exists ($docdir))
                {
                    dol_delete_dir_recursive($docdir);
                }

                return 1;
            }
            else
            {
                $this->db->rollback();
                return -1;
            }
        }

    }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:societe.class.php

示例5: delete


//.........这里部分代码省略.........
				}
			}

			return parent::delete();

			// TODO Supprimer les contacts
			// Remove contacts
			if (!$error) {
				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "socpeople";
				$sql.= " WHERE fk_soc = " . $id;
				dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
					$error++;
					$this->error .= $this->db->lasterror();
					dol_syslog(get_class($this) . "::delete erreur -1 " . $this->error, LOG_ERR);
				}
			}

			// Update link in member table
			if (!$error) {
				$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent";
				$sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
				dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
					$error++;
					$this->error .= $this->db->lasterror();
					dol_syslog(get_class($this) . "::delete erreur -1 " . $this->error, LOG_ERR);
				}
			}

			// Remove ban
			if (!$error) {
				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "societe_rib";
				$sql.= " WHERE fk_soc = " . $id;
				dol_syslog(get_class($this) . "::Delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
					$error++;
					$this->error = $this->db->lasterror();
					dol_syslog(get_class($this) . "::Delete erreur -2 " . $this->error, LOG_ERR);
				}
			}

			// Removed extrafields
			//$result=$this->deleteExtraFields($this);
			//if ($result < 0) $error++;

			if (!$error) {
				// Additionnal action by hooks
				include_once(DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php');
				$hookmanager = new HookManager($this->db);
				$hookmanager->initHooks(array('thirdparty_extrafields'));
				$parameters = array();
				$action = 'delete';
				$reshook = $hookmanager->executeHooks('deleteThirdparty', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
				if (!empty($hookmanager->error)) {
					$error++;
					$this->error = $hookmanager->error;
				}
			}

			// Remove third party
			if (!$error) {
				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "societe";
				$sql.= " WHERE rowid = " . $id;
				dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
					$error++;
					$this->error = $this->db->lasterror();
					dol_syslog(get_class($this) . "::delete erreur -3 " . $this->error, LOG_ERR);
				}
			}

			if (!$error) {
				// Appel des triggers
				include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
				$interface = new Interfaces($this->db);
				$result = $interface->run_triggers('COMPANY_DELETE', $this, $user, $langs, $conf);
				if ($result < 0) {
					$error++;
					$this->errors = $interface->errors;
				}
				// Fin appel triggers
			}

			if (!$error) {
				$this->db->commit();

				// Delete directory
				$docdir = $conf->societe->multidir_output[$this->entity] . "/" . $id;
				if (file_exists($docdir)) {
					dol_delete_dir_recursive($docdir);
				}

				return 1;
			} else {
				$this->db->rollback();
				return -1;
			}
		}
	}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:societe.class.php

示例6: update

 /**
  *      Mise a jour de l'objet ligne de commande en base
  *		@return		int		<0 si ko, >0 si ok
  */
 function update($notrigger = 0)
 {
     global $conf, $langs, $user;
     // Clean parameters
     if (empty($this->tva_tx)) {
         $this->tva_tx = 0;
     }
     if (empty($this->localtax1_tx)) {
         $this->localtax1_tx = 0;
     }
     if (empty($this->localtax2_tx)) {
         $this->localtax2_tx = 0;
     }
     if (empty($this->qty)) {
         $this->qty = 0;
     }
     if (empty($this->total_localtax1)) {
         $this->total_localtax1 = 0;
     }
     if (empty($this->total_localtax2)) {
         $this->total_localtax2 = 0;
     }
     if (empty($this->marque_tx)) {
         $this->marque_tx = 0;
     }
     if (empty($this->marge_tx)) {
         $this->marge_tx = 0;
     }
     if (empty($this->remise)) {
         $this->remise = 0;
     }
     if (empty($this->remise_percent)) {
         $this->remise_percent = 0;
     }
     if (empty($this->info_bits)) {
         $this->info_bits = 0;
     }
     if (empty($this->product_type)) {
         $this->product_type = 0;
     }
     if (empty($this->fk_parent_line)) {
         $this->fk_parent_line = 0;
     }
     $this->db->begin();
     // Mise a jour ligne en base
     $sql = "UPDATE " . MAIN_DB_PREFIX . "commandedet SET";
     $sql .= " description='" . $this->db->escape($this->desc) . "'";
     $sql .= " , tva_tx=" . price2num($this->tva_tx);
     $sql .= " , localtax1_tx=" . price2num($this->localtax1_tx);
     $sql .= " , localtax2_tx=" . price2num($this->localtax2_tx);
     $sql .= " , qty=" . price2num($this->qty);
     $sql .= " , subprice=" . price2num($this->subprice) . "";
     $sql .= " , remise_percent=" . price2num($this->remise_percent) . "";
     $sql .= " , price=" . price2num($this->price) . "";
     // TODO A virer
     $sql .= " , remise=" . price2num($this->remise) . "";
     // TODO A virer
     if (empty($this->skip_update_total)) {
         $sql .= " , total_ht=" . price2num($this->total_ht) . "";
         $sql .= " , total_tva=" . price2num($this->total_tva) . "";
         $sql .= " , total_ttc=" . price2num($this->total_ttc) . "";
     }
     $sql .= " , total_localtax1=" . price2num($this->total_localtax1);
     $sql .= " , total_localtax2=" . price2num($this->total_localtax2);
     $sql .= " , info_bits=" . $this->info_bits;
     if ($this->date_start) {
         $sql .= " , date_start='" . $this->db->idate($this->date_start) . "'";
     } else {
         $sql .= ' , date_start=null';
     }
     if ($this->date_end) {
         $sql .= " , date_end='" . $this->db->idate($this->date_end) . "'";
     }
     $sql .= " , product_type=" . $this->product_type;
     $sql .= " , fk_parent_line=" . ($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
     $sql .= " WHERE rowid = " . $this->rowid;
     dol_syslog("OrderLine::update sql={$sql}");
     $resql = $this->db->query($sql);
     if ($resql) {
         if (!$notrigger) {
             // Appel des triggers
             include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
             $interface = new Interfaces($this->db);
             $result = $interface->run_triggers('LINEORDER_UPDATE', $this, $user, $langs, $conf);
             if ($result < 0) {
                 $error++;
                 $this->errors = $interface->errors;
             }
             // Fin appel triggers
         }
         $this->db->commit();
         return 1;
     } else {
         $this->error = $this->db->error();
         dol_syslog("OrderLine::update Error " . $this->error, LOG_ERR);
         $this->db->rollback();
//.........这里部分代码省略.........
开发者ID:ripasch,项目名称:dolibarr,代码行数:101,代码来源:commande.class.php

示例7: setEventMessages

 $result = $mailfile->sendfile();
 if ($result) {
     $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
     // Must not contain "
     setEventMessages($mesg, null, 'mesgs');
     $error = 0;
     // Initialisation donnees
     $object->sendtoid = $sendtoid;
     $object->actiontypecode = $actiontypecode;
     $object->actionmsg = $actionmsg;
     $object->actionmsg2 = $actionmsg2;
     $object->fk_element = $object->id;
     $object->elementtype = $object->element;
     // Appel des triggers
     include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
     $interface = new Interfaces($db);
     $result = $interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL', $object, $user, $langs, $conf);
     if ($result < 0) {
         $error++;
         $object->errors = $interface->errors;
     }
     // Fin appel triggers
     if ($error) {
         dol_print_error($db);
     } else {
         // Redirect here
         // This avoid sending mail twice if going out and then back to page
         header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
         exit;
     }
 } else {
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:card.php

示例8: resiliate

 /**
  *		Fonction qui resilie un adherent
  *		@param		user		user adherent qui resilie
  *		@return		int			<0 si ko, >0 si ok
  */
 function resiliate($user)
 {
     global $langs, $conf;
     if ($this->statut == 0) {
         dol_syslog(get_class($this) . "::resiliate statut of member does not allow this", LOG_WARNING);
         return 0;
     }
     $this->db->begin();
     $sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
     $sql .= " statut = 0";
     $sql .= ", fk_user_valid=" . $user->id;
     $sql .= " WHERE rowid = " . $this->id;
     $result = $this->db->query($sql);
     if ($result) {
         $this->statut = 0;
         $this->use_webcal = $conf->global->PHPWEBCALENDAR_MEMBERSTATUS == 'always' ? 1 : 0;
         // Appel des triggers
         include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
         $interface = new Interfaces($this->db);
         $result = $interface->run_triggers('MEMBER_RESILIATE', $this, $user, $langs, $conf);
         if ($result < 0) {
             $error++;
             $this->errors = $interface->errors;
         }
         // Fin appel triggers
         $this->db->commit();
         return 1;
     } else {
         $this->error = $this->db->error();
         $this->db->rollback();
         return -1;
     }
 }
开发者ID:ripasch,项目名称:dolibarr,代码行数:38,代码来源:adherent.class.php

示例9: delete

 /**
  *	Delete object in database
  *
  *	@param      User	$user        	User that delete
  *  @param      int		$notrigger	    0=launch triggers after, 1=disable triggers
  *	@return		int						<0 if KO, >0 if OK
  */
 function delete($user, $notrigger = 0)
 {
     global $conf, $langs;
     $error = 0;
     $sql = "DELETE FROM " . MAIN_DB_PREFIX . "import_model";
     $sql .= " WHERE rowid=" . $this->id;
     $this->db->begin();
     dol_syslog(get_class($this) . "::delete sql=" . $sql);
     $resql = $this->db->query($sql);
     if (!$resql) {
         $error++;
         $this->errors[] = "Error " . $this->db->lasterror();
     }
     if (!$error) {
         if (!$notrigger) {
             // Call triggers
             include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
             $interface = new Interfaces($this->db);
             $result = $interface->run_triggers('IMPORT_DELETE', $this, $user, $langs, $conf);
             if ($result < 0) {
                 $error++;
                 $this->errors = $interface->errors;
             }
             // End call triggers
         }
     }
     // Commit or rollback
     if ($error) {
         foreach ($this->errors as $errmsg) {
             dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
             $this->error .= $this->error ? ', ' . $errmsg : $errmsg;
         }
         $this->db->rollback();
         return -1 * $error;
     } else {
         $this->db->commit();
         return 1;
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:46,代码来源:import.class.php

示例10: delete

 /**
  * 	Delete object on database and/or on disk
  *
  *	@param	User	$user		User that delete
  *  @param	int		$mode		'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented)
  *	@return	int					<0 if KO, >0 if OK
  */
 function delete($user, $mode = 'all')
 {
     global $conf, $langs;
     require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     $error = 0;
     $result = 0;
     if ($mode != 'databaseonly') {
         $relativepath = $this->getRelativePath(1);
     }
     // Ex: dir1/dir2/dir3
     dol_syslog(get_class($this) . "::delete remove directory id=" . $this->id . " mode=" . $mode . ($mode == 'databaseonly' ? '' : ' relativepath=' . $relativepath));
     $this->db->begin();
     $sql = "DELETE FROM " . MAIN_DB_PREFIX . "ecm_directories";
     $sql .= " WHERE rowid=" . $this->id;
     dol_syslog(get_class($this) . "::delete sql=" . $sql);
     $resql = $this->db->query($sql);
     if (!$resql) {
         $this->db->rollback();
         $this->error = "Error " . $this->db->lasterror();
         dol_syslog(get_class($this) . "::delete " . $this->error, LOG_ERR);
         return -2;
     }
     if ($mode != 'databaseonly') {
         $file = $conf->ecm->dir_output . "/" . $relativepath;
         $result = @dol_delete_dir($file);
     }
     if ($result || !@is_dir(dol_osencode($file))) {
         $this->db->commit();
     } else {
         $this->error = 'ErrorFailToDeleteDir';
         dol_syslog(get_class($this) . "::delete " . $this->error, LOG_ERR);
         $this->db->rollback();
         $error++;
     }
     if (!$error) {
         // Appel des triggers
         include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
         $interface = new Interfaces($this->db);
         $result = $interface->run_triggers('MYECMDIR_DELETE', $this, $user, $langs, $conf);
         if ($result < 0) {
             $error++;
             $this->errors = $interface->errors;
         }
         // Fin appel triggers
     }
     if (!$error) {
         return 1;
     } else {
         return -1;
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:58,代码来源:ecmdirectory.class.php

示例11: require_once

if (!defined('NOREQUIRESOC'))
	define('NOREQUIRESOC', '1');
if (!defined('EVEN_IF_ONLY_LOGIN_ALLOWED'))
	define('EVEN_IF_ONLY_LOGIN_ALLOWED', '1');

require_once("../main.inc.php");

// This can happen only with a bookmark or forged url call.
if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser'
		|| $_SESSION["dol_authmode"] == 'http')) {
	die("Disconnection does not work when connection was made in mode " . $_SESSION["dol_authmode"]);
}

// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface = new Interfaces($db);
$result = $interface->run_triggers('USER_LOGOUT', $user, $user, $langs, $conf, $conf->entity);
if ($result < 0) {
	$error++;
}
// Fin appel triggers
// Define url to go after disconnect
$urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"];

// Destroy some cookies
if ($conf->phenix->enabled && $conf->phenix->cookie) {
	// Destroy cookie
	setcookie($conf->phenix->cookie, '', 1, "/");
}

// Destroy object of session
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:logout.php

示例12: accessforbidden

    accessforbidden();
}
/*
 * Action
 */
// None
/*
 * View
 */
llxHeader("", "");
$form = new Form($db);
print load_fiche_titre($langs->trans("TriggersAvailable"), '', 'title_setup');
print $langs->trans("TriggersDesc") . "<br>";
print "<br>\n";
$template_dir = DOL_DOCUMENT_ROOT . '/core/tpl/';
$interfaces = new Interfaces($db);
$triggers = $interfaces->getTriggersList();
print '<table class="noborder">
<tr class="liste_titre">
<td colspan="2">' . $langs->trans("File") . '</td>
<td align="center">' . $langs->trans("Active") . '</td>
<td align="center">&nbsp;</td>
</tr>
';
$var = True;
foreach ($triggers as $trigger) {
    $var = !$var;
    print '<tr ' . $bc[$var] . '>';
    print '<td valign="top" width="14" align="center">' . $trigger['picto'] . '</td>';
    print '<td valign="top">' . $trigger['file'] . '</td>';
    print '<td valign="top" align="center">' . $trigger['status'] . '</td>';
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:triggers.php

示例13: delete

 /**
  * 	Delete a category from database
  *
  * 	@param	User	$user		Object user that ask to delete
  *	@return	void
  */
 function delete($user)
 {
     global $conf, $langs;
     $error = 0;
     dol_syslog("Categorie::remove");
     $this->db->begin();
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_societe";
         $sql .= " WHERE fk_categorie = " . $this->id;
         if (!$this->db->query($sql)) {
             $this->error = $this->db->lasterror();
             dol_syslog("Error sql=" . $sql . " " . $this->error, LOG_ERR);
             $error++;
         }
     }
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_fournisseur";
         $sql .= " WHERE fk_categorie = " . $this->id;
         if (!$this->db->query($sql)) {
             $this->error = $this->db->lasterror();
             dol_syslog("Error sql=" . $sql . " " . $this->error, LOG_ERR);
             $error++;
         }
     }
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_product";
         $sql .= " WHERE fk_categorie = " . $this->id;
         if (!$this->db->query($sql)) {
             $this->error = $this->db->lasterror();
             dol_syslog("Error sql=" . $sql . " " . $this->error, LOG_ERR);
             $error++;
         }
     }
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_member";
         $sql .= " WHERE fk_categorie = " . $this->id;
         if (!$this->db->query($sql)) {
             $this->error = $this->db->lasterror();
             dol_syslog("Error sql=" . $sql . " " . $this->error, LOG_ERR);
             $error++;
         }
     }
     // Link childs to parent
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_association";
         $sql .= " WHERE fk_categorie_mere  = " . $this->id;
         $sql .= " OR fk_categorie_fille = " . $this->id;
         if (!$this->db->query($sql)) {
             $this->error = $this->db->lasterror();
             dol_syslog("Error sql=" . $sql . " " . $this->error, LOG_ERR);
             $error++;
         }
     }
     // Delete category
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie";
         $sql .= " WHERE rowid = " . $this->id;
         if (!$this->db->query($sql)) {
             $this->error = $this->db->lasterror();
             dol_syslog("Error sql=" . $sql . " " . $this->error, LOG_ERR);
             $error++;
         } else {
             // Appel des triggers
             include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
             $interface = new Interfaces($this->db);
             $result = $interface->run_triggers('CATEGORY_DELETE', $this, $user, $langs, $conf);
             if ($result < 0) {
                 $error++;
                 $this->errors = $interface->errors;
                 $this->error = join(',', $this->errors);
             }
             // Fin appel triggers
         }
     }
     if (!$error) {
         $this->db->commit();
         return 1;
     } else {
         $this->db->rollback();
         return -1;
     }
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:88,代码来源:categorie.class.php

示例14: delete

	/**
	 * 		Delete an order
	 *		@return		int		<0 if KO, >0 if OK
	 */
	function delete()
	{
		global $langs,$conf;

		$err = 0;

		$this->db->begin();

		$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ;
		dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG);
		if (! $this->db->query($sql) )
		{
			$err++;
		}

		$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id;
		dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG);
		if ($resql = $this->db->query($sql) )
		{
			if ($this->db->affected_rows($resql) < 1)
			{
				$err++;
			}
		}
		else
		{
			$err++;
		}

		if ($err == 0)
		{
			// Appel des triggers
			include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
			$interface=new Interfaces($this->db);
			$result=$interface->run_triggers('ORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf);
			if ($result < 0) { $error++; $this->errors=$interface->errors; }
			// Fin appel triggers

			dol_syslog("CommandeFournisseur::delete : Success");
			$this->db->commit();
			return 1;
		}
		else
		{
			$this->db->rollback();
			return -1;
		}
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:52,代码来源:fournisseur.commande.class.php

示例15: updatePrice


//.........这里部分代码省略.........
     if (empty($this->tva_tx)) {
         $this->tva_tx = 0;
     }
     if (empty($newnpr)) {
         $newnpr = 0;
     }
     // Check parameters
     if ($newvat == '') {
         $newvat = $this->tva_tx;
     }
     if (!empty($newminprice) && $newminprice > $newprice) {
         $this->error = 'ErrorPriceCantBeLowerThanMinPrice';
         return -1;
     }
     if ($newprice != '' || $newprice == 0) {
         if ($newpricebase == 'TTC') {
             $price_ttc = price2num($newprice, 'MU');
             $price = price2num($newprice) / (1 + $newvat / 100);
             $price = price2num($price, 'MU');
             if ($newminprice != '' || $newminprice == 0) {
                 $price_min_ttc = price2num($newminprice, 'MU');
                 $price_min = price2num($newminprice) / (1 + $newvat / 100);
                 $price_min = price2num($price_min, 'MU');
             } else {
                 $price_min = 0;
                 $price_min_ttc = 0;
             }
         } else {
             $price = price2num($newprice, 'MU');
             $price_ttc = $newnpr != 1 ? price2num($newprice) * (1 + $newvat / 100) : $price;
             $price_ttc = price2num($price_ttc, 'MU');
             if ($newminprice != '' || $newminprice == 0) {
                 $price_min = price2num($newminprice, 'MU');
                 $price_min_ttc = price2num($newminprice) * (1 + $newvat / 100);
                 $price_min_ttc = price2num($price_min_ttc, 'MU');
                 //print 'X'.$newminprice.'-'.$price_min;
             } else {
                 $price_min = 0;
                 $price_min_ttc = 0;
             }
         }
         //print 'x'.$id.'-'.$newprice.'-'.$newpricebase.'-'.$price.'-'.$price_ttc.'-'.$price_min.'-'.$price_min_ttc;
         //Local taxes
         $localtax1 = get_localtax($newvat, 1);
         $localtax2 = get_localtax($newvat, 2);
         if (empty($localtax1)) {
             $localtax1 = 0;
         }
         // If = '' then = 0
         if (empty($localtax2)) {
             $localtax2 = 0;
         }
         // If = '' then = 0
         // Ne pas mettre de quote sur les numeriques decimaux.
         // Ceci provoque des stockages avec arrondis en base au lieu des valeurs exactes.
         $sql = "UPDATE " . MAIN_DB_PREFIX . "product SET";
         $sql .= " price_base_type='" . $newpricebase . "',";
         $sql .= " price=" . $price . ",";
         $sql .= " price_ttc=" . $price_ttc . ",";
         $sql .= " price_min=" . $price_min . ",";
         $sql .= " price_min_ttc=" . $price_min_ttc . ",";
         $sql .= " localtax1_tx=" . ($localtax1 >= 0 ? $localtax1 : 'NULL') . ",";
         $sql .= " localtax2_tx=" . ($localtax2 >= 0 ? $localtax2 : 'NULL') . ",";
         $sql .= " tva_tx='" . price2num($newvat) . "',";
         $sql .= " recuperableonly='" . $newnpr . "'";
         $sql .= " WHERE rowid = " . $id;
         dol_syslog(get_class($this) . "update_price sql=" . $sql, LOG_DEBUG);
         $resql = $this->db->query($sql);
         if ($resql) {
             $this->price = $price;
             $this->price_ttc = $price_ttc;
             $this->price_min = $price_min;
             $this->price_min_ttc = $price_min_ttc;
             $this->price_base_type = $newpricebase;
             $this->tva_tx = $newvat;
             $this->tva_npr = $newnpr;
             //Local taxes
             $this->localtax1_tx = $localtax1;
             $this->localtax2_tx = $localtax2;
             // Price by quantity
             $this->price_by_qty = $newpsq;
             $this->_log_price($user, $level);
             // Save price for level into table product_price
             $this->level = $level;
             // Store level of price edited for trigger
             // Appel des triggers
             include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
             $interface = new Interfaces($this->db);
             $result = $interface->run_triggers('PRODUCT_PRICE_MODIFY', $this, $user, $langs, $conf);
             if ($result < 0) {
                 $error++;
                 $this->errors = $interface->errors;
             }
             // Fin appel triggers
         } else {
             dol_print_error($this->db);
         }
     }
     return 1;
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:product.class25..php


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