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


PHP DoliDB::error方法代码示例

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


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

示例1: verif

 /**
  *  Return if a code is available
  *
  *	@param	DoliDB		$db			Database handler
  * 	@param	string		$code		Code of third party
  * 	@param	Societe		$societe	Object third party
  * 	@param	string		$type		'supplier' or 'customer'
  *	@return	int						0 if OK but not available, >0 if OK and available, <0 if KO
  */
 function verif($db, $code, $societe, $type)
 {
     $sql = "SELECT ";
     if ($type == 'customer') {
         $sql .= "code_compta";
     } else {
         if ($type == 'supplier') {
             $sql .= "code_compta_fournisseur";
         }
     }
     $sql .= " FROM " . MAIN_DB_PREFIX . "societe";
     $sql .= " WHERE ";
     if ($type == 'customer') {
         $sql .= "code_compta";
     } else {
         if ($type == 'supplier') {
             $sql .= "code_compta_fournisseur";
         }
     }
     $sql .= " = '" . $this->db->escape($code) . "'";
     if (!empty($societe->id)) {
         $sql .= " AND rowid <> " . $societe->id;
     }
     $resql = $db->query($sql);
     if ($resql) {
         if ($db->num_rows($resql) == 0) {
             dol_syslog("mod_codecompta_aquarium::verif code '" . $code . "' available");
             return 1;
             // Dispo
         } else {
             dol_syslog("mod_codecompta_aquarium::verif code '" . $code . "' not available");
             return 0;
             // Non dispo
         }
     } else {
         $this->error = $db->error() . " sql=" . $sql;
         dol_syslog("mod_codecompta_aquarium::verif error" . $this->error, LOG_ERR);
         return -1;
         // Erreur
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:50,代码来源:mod_codecompta_aquarium.php

示例2: listBoxes

 /**
  *  Return array of boxes qualified for area and user
  *
  *  @param	DoliDB	$db				Database handler
  *  @param	string	$mode			'available' or 'activated'
  *  @param	string	$zone			Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
  *  @param  User    $user	  		Objet user to filter (used only if $zone >= 0)
  *  @param	array	$excludelist	Array of box id (box.box_id = boxes_def.rowid) to exclude
  *  @return array               	Array of boxes
  */
 static function listBoxes($db, $mode, $zone, $user, $excludelist = array())
 {
     global $conf;
     $boxes = array();
     $confuserzone = 'MAIN_BOXES_' . $zone;
     if ($mode == 'activated') {
         $sql = "SELECT b.rowid, b.position, b.box_order, b.fk_user,";
         $sql .= " d.rowid as box_id, d.file, d.note, d.tms";
         $sql .= " FROM " . MAIN_DB_PREFIX . "boxes as b, " . MAIN_DB_PREFIX . "boxes_def as d";
         $sql .= " WHERE b.box_id = d.rowid";
         $sql .= " AND d.entity = " . $conf->entity;
         if ($zone >= 0) {
             $sql .= " AND b.position = " . $zone;
         }
         if ($user->id && $user->conf->{$confuserzone}) {
             $sql .= " AND b.fk_user = " . $user->id;
         } else {
             $sql .= " AND b.fk_user = 0";
         }
         $sql .= " ORDER BY b.box_order";
     } else {
         $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
         $sql .= " FROM " . MAIN_DB_PREFIX . "boxes_def as d";
         $sql .= " WHERE entity = " . $conf->entity;
     }
     $resql = $db->query($sql);
     if ($resql) {
         $num = $db->num_rows($resql);
         $j = 0;
         while ($j < $num) {
             $obj = $db->fetch_object($resql);
             if (!in_array($obj->box_id, $excludelist)) {
                 if (preg_match('/^([^@]+)@([^@]+)$/i', $obj->file, $regs)) {
                     $boxname = $regs[1];
                     $module = $regs[2];
                     $relsourcefile = "/" . $module . "/core/boxes/" . $boxname . ".php";
                 } else {
                     $boxname = preg_replace('/.php$/i', '', $obj->file);
                     $relsourcefile = "/core/boxes/" . $boxname . ".php";
                 }
                 dol_include_once($relsourcefile);
                 if (class_exists($boxname)) {
                     $box = new $boxname($db, $obj->note);
                     // box properties
                     $box->rowid = !empty($obj->rowid) ? $obj->rowid : '';
                     $box->id = !empty($obj->box_id) ? $obj->box_id : '';
                     $box->position = !empty($obj->position) ? $obj->position : '';
                     $box->box_order = !empty($obj->box_order) ? $obj->box_order : '';
                     $box->fk_user = !empty($obj->fk_user) ? $obj->fk_user : '';
                     $box->sourcefile = $relsourcefile;
                     if ($mode == 'activated' && (!$user->id || !$user->conf->{$confuserzone})) {
                         if (is_numeric($box->box_order)) {
                             if ($box->box_order % 2 == 1) {
                                 $box->box_order = 'A' . $box->box_order;
                             } elseif ($box->box_order % 2 == 0) {
                                 $box->box_order = 'B' . $box->box_order;
                             }
                         }
                     }
                     // box_def properties
                     $box->box_id = !empty($obj->box_id) ? $obj->box_id : '';
                     $box->note = !empty($obj->note) ? $obj->note : '';
                     $enabled = true;
                     if (isset($box->depends) && count($box->depends) > 0) {
                         foreach ($box->depends as $module) {
                             //print $boxname.'-'.$module.'<br>';
                             if (empty($conf->{$module}->enabled)) {
                                 $enabled = false;
                             }
                         }
                     }
                     if ($enabled) {
                         $boxes[] = $box;
                     }
                 }
             }
             $j++;
         }
     } else {
         //dol_print_error($db);
         $this->error = $db->error();
         dol_syslog(get_class() . "::listBoxes Error " . $this->error, LOG_ERR);
         return array();
     }
     return $boxes;
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:96,代码来源:infobox.class.php

示例3: migrate_price_commande_fournisseur

/**
 * Mise a jour des totaux lignes de commande fournisseur
 *
 * @param	DoliDB		$db		Database handler
 * @param	Translate	$langs	Object langs
 * @param	Conf		$conf	Object conf
 * @return	void
 */
function migrate_price_commande_fournisseur($db, $langs, $conf)
{
    $db->begin();
    print '<tr><td colspan="4">';
    print '<br>';
    print '<b>' . $langs->trans('MigrationSupplierOrder') . "</b><br>\n";
    // Liste des lignes commande non a jour
    $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,";
    $sql .= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
    $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd, " . MAIN_DB_PREFIX . "commande_fournisseur as c";
    $sql .= " WHERE cd.fk_commande = c.rowid";
    $sql .= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100) or cd.total_ttc IS NULL)";
    dolibarr_install_syslog("upgrade2::migrate_price_commande_fournisseur", LOG_DEBUG);
    $resql = $db->query($sql);
    if ($resql) {
        $num = $db->num_rows($resql);
        $i = 0;
        if ($num) {
            while ($i < $num) {
                $obj = $db->fetch_object($resql);
                $rowid = $obj->rowid;
                $qty = $obj->qty;
                $pu = $obj->subprice;
                $txtva = $obj->tva_taux;
                $remise_percent = $obj->remise_percent;
                $remise_percent_global = $obj->remise_percent_global;
                $info_bits = $obj->info_bits;
                // On met a jour les 3 nouveaux champs
                $commandeligne = new CommandeFournisseurLigne($db);
                $commandeligne->fetch($rowid);
                $result = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, $remise_percent_global, 'HT', $info_bits, 0);
                $total_ht = $result[0];
                $total_tva = $result[1];
                $total_ttc = $result[2];
                $commandeligne->total_ht = $total_ht;
                $commandeligne->total_tva = $total_tva;
                $commandeligne->total_ttc = $total_ttc;
                dolibarr_install_syslog("upgrade2: Line {$rowid}: commandeid={$obj->rowid} pu={$pu} qty={$qty} tva_taux={$txtva} remise_percent={$remise_percent} remise_global={$remise_percent_global} -> {$total_ht}, {$total_tva}, {$total_ttc}");
                print ". ";
                $commandeligne->update_total();
                /* On touche pas a facture mere
                   $commande = new Commande($db);
                   $commande->id = $obj->rowid;
                   if ( $commande->fetch($commande->id) >= 0 )
                   {
                   if ( $commande->update_price() > 0 )
                   {
                   print ". ";
                   }
                   else
                   {
                   print "Error id=".$commande->id;
                   }
                   }
                   else
                   {
                   print "Error #3";
                   }
                   */
                $i++;
            }
        } else {
            print $langs->trans("AlreadyDone");
        }
        $db->free($resql);
        /*
        $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet";
        $sql.= " WHERE subprice = 0 and total_ttc = 0 and total_tva = 0 and total_ht = 0";
        $resql=$db->query($sql);
        if (! $resql)
        {
        dol_print_error($db);
        }
        */
        $db->commit();
    } else {
        print "Error #1 " . $db->error();
        $db->rollback();
    }
    print '<br>';
    print '</td></tr>';
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:90,代码来源:upgrade2.php

示例4:

		$resql=$oscommercedb->query($sql);
		if ($resql) {
			$mesg ="<div class=\"ok\">".$langs->trans("OSCommerceTestOk",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbname"],$_POST["oscommerce_dbuser"]);
			$mesg.="</div>";
		}
		else {
			$mesg ="<div class=\"error\">".$langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',$_POST["oscommerce_db_table_prefix"]."configuration");
			$mesg.="</div>";
		}

		//$oscommercedb->close();    Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
	}
	elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1)
	{
		$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo1",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbname"]);
		$mesg.="<br>".$oscommercedb->error();
		$mesg.="</div>";
		//$oscommercedb->close();    Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
	}
	else
	{
		$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo2",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbuser"]);
		$mesg.="<br>".$oscommercedb->error();
		$mesg.="</div>";
	}

	//$resql=$db->query("select count(*) from llx_const");
	//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
}

开发者ID:remyyounes,项目名称:dolibarr,代码行数:29,代码来源:boutique.php


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