本文整理汇总了PHP中getCountry函数的典型用法代码示例。如果您正苦于以下问题:PHP getCountry函数的具体用法?PHP getCountry怎么用?PHP getCountry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCountry函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getResult
public function getResult()
{
$ip = getenv('HTTP_X_FORWARDED_FOR');
$array_ip = explode(",", $ip);
$country_code = getCountry($array_ip[0]);
$storeCode = Mage::app()->getStore()->getCode();
if (strtolower($country_code) != strtolower($storeCode)) {
return $country_code;
} else {
return false;
}
}
开发者ID:technomagegithub,项目名称:colb2b,代码行数:12,代码来源:Popup.php
示例2: index
/**
* Show users table
*/
public function index()
{
$clang = Yii::app()->lang;
if (!Permission::model()->hasGlobalPermission('Regions', 'create')) {
Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error');
$this->getController()->redirect(array("admin/index"));
}
App()->getClientScript()->registerCssFile(Yii::app()->getConfig('styleurl') . "jquery.dataTables.css");
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'jquery.dataTables.min.js');
$userlist = getCountry();
$aData['row'] = 0;
$aData['usr_arr'] = $userlist;
$aData['imageurl'] = Yii::app()->getConfig("adminimageurl");
$this->_renderWrappedTemplate('region/country', 'view_addcountry', $aData);
}
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:18,代码来源:countryaction.php
示例3: showCompetitionInfos
function showCompetitionInfos () {
#----------------------------------------------------------------------
global $chosenCompetitionId;
#--- Get the competition infos from the database.
$competition = getFullCompetitionInfos( $chosenCompetitionId );
extract( $competition );
$delegates = getCompetitionDelegates( $chosenCompetitionId );
$wcaDelegate = joinUsers( $delegates, true );
$organizers = getCompetitionOrganizers( $chosenCompetitionId );
// Only show organizer emails if there is no contact info given.
$organizer = joinUsers( $organizers, !$contact );
#--- Show the infos.
echo "<h1>$name</h1>\n";
#--- Start the table.
echo "<div class='table-responsive'>\n";
echo "<table width='100%' id='competitionDetails'><tr valign='top'>\n";
#--- Left part.
echo "<td style='width:70%'><table>";
$country = getCountry($countryId);
showItem( 'key', "Date", array( competitionDate( $competition ), $year ));
showItem( 'key', "City", array( $cityName, $country['name'] ));
showItem( 'key', "Venue", array( $venue ));
showItem( 'sub', "Address", array( $venueAddress ));
showItem( 'sub', "Details", array( $venueDetails ));
showItem( 'key', "Website", array( $website ));
showItem( 'key', "Organizer", array( $organizer ));
showItem( 'key', "WCA Delegate", array( $wcaDelegate ));
showItem( 'key', "Contact", array( $contact ));
echo "</table></td>";
#--- Right part.
echo "<td style='width:30%'><table>";
showItem( 'key', "Information", array( $information ));
showListItemNew( 'View results for', computeCompetitionEvents( $eventSpecs ));
showListItemNew( 'Reports', computeMedia( 'report' ));
showListItemNew( 'Articles', computeMedia( 'article' ));
showListItemNew( 'Multimedia', computeMedia( 'multimedia' ));
echo "</table></td>";
#--- End table.
echo "</tr></table></div>";
}
开发者ID:neodude,项目名称:worldcubeassociation.org,代码行数:46,代码来源:competition_infos.php
示例4: list_country
function list_country($c, $lang = '')
{
//Create the country list menu for forms with the given value selected
//$c = selected value
if (empty($c)) {
$c = strtoupper($GLOBALS['phpwcms']['default_lang']);
}
$country_list = '';
$country = getCountry($lang);
foreach ($country as $key => $value) {
$country_list .= ' <option value="' . html($key) . '"';
if ($key == $c) {
$country_list .= ' selected="selected"';
}
$country_list .= '>' . html($value) . '</option>' . LF;
}
return $country_list;
}
开发者ID:EDVLanger,项目名称:phpwcms,代码行数:18,代码来源:general.inc.php
示例5: mysql_result
<td style="vertical-align: middle;"><span style="font-size: 30px;"><?php
echo mysql_result($querymodal, 0, 'flightnumber');
?>
</span><br/><span style="font-size: 10px;"><?php
echo airlinename(mysql_result($querymodal, 0, 'flightnumber'));
?>
</span></td>
<td style="vertical-align: middle;"><span style="font-size: 30px; margin-top: 10px;"><?php
echo getCountry(mysql_result($querymodal, 0, 'origin'), "alt") . " " . mysql_result($querymodal, 0, 'origin');
?>
</span><br/><span style="font-size: 10px;"><?php
echo mysql_result($queryorig, 0, 'Name');
?>
</span>
<td style="vertical-align: middle;"><span style="font-size: 30px; margin-top: 10px;"><?php
echo getCountry(mysql_result($querymodal, 0, 'destination'), "alt") . " " . mysql_result($querymodal, 0, 'destination');
?>
</span><br/><span style="font-size: 10px;"><?php
echo mysql_result($querydest, 0, 'Name');
?>
</span>
</tr>
<tr style="border-bottom: 1px solid #444">
<td><b>Aircraft</b> <a href="http://www.airliners.net/search/photo.search?q=<?php
echo str_ireplace(" ", "+", aircraftname(mysql_result($querymodal, 0, 'acft')));
?>
+<?php
echo str_ireplace(" ", "+", airlinename(mysql_result($querymodal, 0, 'flightnumber'), "name"));
?>
" target="_blank" style="color: #333;" onMouseOver="this.style.color='#F00'" onMouseOut="this.style.color='#333'"><i class="icon-camera" title="Click here to see pictures of this aircraft"></i></a></td>
<td><b>Departure Time</b></td>
开发者ID:Newsoft-Computer,项目名称:CLI0005-IVAO-Colombia,代码行数:31,代码来源:validate.php
示例6: getDateFormate
?>
</td>
<td align="center"><?php
echo getDateFormate(getDispatchNumber("DespatchDate", "rec_id", $row['DispatchNumberId']), 1);
?>
</td>
<td align="center"><?php
echo getBuyer('BuyerName', 'rec_id', getDispatchNumber("BuyerId", "rec_id", $row['DispatchNumberId']));
?>
</td>
<td align="center"><?php
echo $row['Port'];
?>
</td>
<td align="center"><?php
echo getCountry(getBuyer('CountryId', 'rec_id', $row['BuyerId']));
?>
</td>
<td align="center"><?php
echo getProduct("ProductName", "rec_id", $row['ProductId']);
?>
</td>
<td align="center"><?php
echo $row['Quantity'];
?>
</td>
<td align="center"><?php
echo $row['Price'];
?>
</td>
<?
开发者ID:shailendra999,项目名称:hr_admin,代码行数:31,代码来源:export_doc_report.php
示例7:
// Country
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
$pays_id=GETPOST('pays_id');
if (! $pays_id && ! empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) $pays_id=getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE,2,$db,$langs);
if (! $pays_id && ! empty($conf->geoipmaxmind->enabled))
{
$pays_code=dol_user_country();
//print $pays_code;
if ($pays_code)
{
$new_pays_id=getCountry($pays_code,3,$db,$langs);
//print 'xxx'.$pays_code.' - '.$new_pays_id;
if ($new_pays_id) $pays_id=$new_pays_id;
}
}
$pays_code=getCountry($pays_id,2,$db,$langs);
print $html->select_country($pays_id,'pays_id');
print '</td></tr>';
// State
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($pays_code) print $formcompany->select_state(GETPOST("departement_id"),$pays_code);
else print '';
print '</td></tr>';
}
// EMail
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" size="40" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:new.php
示例8: updateProductOrService
/**
* Update a product or service
*
* @param array $authentication Array of authentication information
* @param Product $product Product
* @return array Array result
*/
function updateProductOrService($authentication, $product)
{
global $db, $conf, $langs;
$now = dol_now();
dol_syslog("Function: updateProductOrService login=" . $authentication['login']);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
// Init and check authentication
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters
if ($product['price_net'] > 0) {
$product['price_base_type'] = 'HT';
}
if ($product['price'] > 0) {
$product['price_base_type'] = 'TTC';
}
if ($product['price_net'] > 0 && $product['price'] > 0) {
$error++;
$errorcode = 'KO';
$errorlabel = "You must choose between price or price_net to provide price.";
}
if ($product['barcode'] && !$product['barcode_type']) {
$errror++;
$errorcode = 'KO';
$errorlabel = "You must set a barcode type when setting a barcode.";
}
if (!$error) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$newobject = new Product($db);
$newobject->fetch($product['id']);
if (isset($product['ref'])) {
$newobject->ref = $product['ref'];
}
if (isset($product['ref_ext'])) {
$newobject->ref_ext = $product['ref_ext'];
}
$newobject->type = $product['type'];
$newobject->libelle = $product['label'];
// TODO deprecated
$newobject->label = $product['label'];
$newobject->description = $product['description'];
$newobject->note = $product['note'];
$newobject->status = $product['status_tosell'];
$newobject->status_buy = $product['status_tobuy'];
$newobject->price = $product['price_net'];
$newobject->price_ttc = $product['price'];
$newobject->tva_tx = $product['vat_rate'];
$newobject->price_base_type = $product['price_base_type'];
$newobject->date_creation = $now;
if ($product['barcode']) {
$newobject->barcode = $product['barcode'];
$newobject->barcode_type = $product['barcode_type'];
}
$newobject->stock_reel = $product['stock_real'];
$newobject->pmp = $product['pmp'];
$newobject->seuil_stock_alert = $product['stock_alert'];
$newobject->country_id = $product['country_id'];
if ($product['country_code']) {
$newobject->country_id = getCountry($product['country_code'], 3);
}
$newobject->customcode = $product['customcode'];
$newobject->canvas = $product['canvas'];
/*foreach($product['lines'] as $line)
{
$newline=new FactureLigne($db);
$newline->type=$line['type'];
$newline->desc=$line['desc'];
$newline->fk_product=$line['fk_product'];
$newline->total_ht=$line['total_net'];
$newline->total_vat=$line['total_vat'];
$newline->total_ttc=$line['total'];
$newline->vat=$line['vat_rate'];
$newline->qty=$line['qty'];
$newline->fk_product=$line['product_id'];
}*/
//var_dump($product['ref_ext']);
//var_dump($product['lines'][0]['type']);
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
foreach ($extrafields->attribute_label as $key => $label) {
$key = 'options_' . $key;
$newobject->array_options[$key] = $product[$key];
}
$db->begin();
$result = $newobject->update($newobject->id, $fuser);
if ($result <= 0) {
$error++;
}
//.........这里部分代码省略.........
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:101,代码来源:server_productorservice.php
示例9: updateContact
/**
* Update a contact
*
* @param array $authentication Array of authentication information
* @param Contact $contact Contact
* @return array Array result
*/
function updateContact($authentication, $contact)
{
global $db, $conf, $langs;
$now = dol_now();
dol_syslog("Function: updateContact login=" . $authentication['login']);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
// Init and check authentication
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters
if (empty($contact['id'])) {
$error++;
$errorcode = 'KO';
$errorlabel = "Contact id is mandatory.";
}
if (!$error) {
$objectfound = false;
include_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$object = new Contact($db);
$result = $object->fetch($contact['id']);
if (!empty($object->id)) {
$objectfound = true;
$object->firstname = $contact['firstname'];
$object->lastname = $contact['lastname'];
$object->address = $contact['address'];
$object->zip = $contact['zip'];
$object->town = $contact['town'];
$object->country_id = $contact['country_id'];
if ($contact['country_code']) {
$object->country_id = getCountry($contact['country_code'], 3);
}
$object->province_id = $contact['province_id'];
$object->phone_pro = $contact['phone_pro'];
$object->phone_perso = $contact['phone_perso'];
$object->phone_mobile = $contact['phone_mobile'];
$object->fax = $contact['fax'];
$object->email = $contact['email'];
$object->civility_id = $contact['civility_id'];
$object->poste = $contact['poste'];
$object->statut = $contact['statut'];
//Retreive all extrafield for contact
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('socpeople', true);
foreach ($extrafields->attribute_label as $key => $label) {
$key = 'options_' . $key;
$object->array_options[$key] = $contact[$key];
}
$db->begin();
$result = $object->update($contact['id'], $fuser);
if ($result <= 0) {
$error++;
}
}
if (!$error && $objectfound) {
$db->commit();
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $object->id);
} elseif ($objectfound) {
$db->rollback();
$error++;
$errorcode = 'KO';
$errorlabel = $object->error;
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Contact id=' . $contact['id'] . ' cannot be found';
}
}
if ($error) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:85,代码来源:server_contact.php
示例10: getFullAddress
/**
* Return full address of third party
*
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @return string Full address string
*/
function getFullAddress($withcountry = 0, $sep = "\n") {
$ret = '';
if ($withcountry && $this->values->country_id && (empty($this->values->country_id) || empty($this->values->country))) {
require_once(DOL_DOCUMENT_ROOT . "/core/lib/company.lib.php");
$tmparray = getCountry($this->values->country_id, 'all');
$this->values->country = $tmparray['label'];
}
if (in_array($this->values->country_code, array('US'))) {
$ret.=($this->values->address ? $this->values->address . $sep : '');
$ret.=trim($this->values->zip . ' ' . $this->values->town);
if ($withcountry)
$ret.=($this->values->country ? $sep . $this->values->country : '');
}
else {
$ret.=($this->values->address ? $this->values->address . $sep : '');
$ret.=trim($this->values->zip . ' ' . $this->values->town);
if ($withcountry)
$ret.=($this->values->country ? $sep . $this->values->country : '');
}
return trim($ret);
}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:29,代码来源:societe.class.php
示例11: aircraftname
echo aircraftname(mysql_result($query, $i, 'acft'));
?>
</td>
<td style="vertical-align:middle;text-align:center;"><?php
if (mysql_result($query, $i, 'deptime') == "----") {
echo "FROM";
} else {
echo "TO";
}
?>
</td>
<td style="vertical-align:middle"><?php
if (mysql_result($query, $i, 'deptime') == "----") {
echo getCountry(mysql_result($query, $i, 'origin'), "alt", "24") . " " . mysql_result($query, $i, 'origin') . " - " . mysql_result($queryorig, 0, 'Name');
} else {
echo getCountry(mysql_result($query, $i, 'destination'), "alt", "24") . " " . mysql_result($query, $i, 'destination') . " - " . mysql_result($querydest, 0, 'Name');
}
?>
</td>
<td style="vertical-align:middle"><?php
echo mysql_result($query, $i, 'opstime');
?>
Z</td>
<td style="vertical-align:middle"><?php
echo mysql_result($query, $i, 'gate');
?>
</td>
<td><?php
echo mysql_result($query, $i, 'name') . ' (<a href="http://www.ivao.aero/members/person/details.asp?ID=' . mysql_result($query, $i, 'vid') . '">' . mysql_result($query, $i, 'vid') . '</a>)';
?>
</td>
开发者ID:Newsoft-Computer,项目名称:CLI0005-IVAO-Colombia,代码行数:31,代码来源:nextflights.php
示例12: record_new_connection
function record_new_connection($config, $json)
{
if (!(isset($_SERVER["REMOTE_ADDR"]) || isset($_SERVER["REMOTE_HOST"]))) {
return false;
}
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "INSERT INTO connections (appid,ip,country,custom,`timestamp`) VALUES (:appid,:ip,:country,:custom,:timestamp)";
$db = getDb($config);
$custom = json_encode($json['customField']);
if ($custom === false) {
$custom = null;
}
$ar = [':appid' => intval($json["appid"]), ':ip' => $ip, ':country' => strval(getCountry($ip)), ':timestamp' => intval($json["time"]), ':custom' => $custom];
$s = $db->prepare($sql);
return $s->execute($ar);
}
开发者ID:acyuta,项目名称:simple_php_api_net,代码行数:16,代码来源:logic.php
示例13: getCountry
// Account supplier code
if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
print '<td>' . $obj->code_compta_fournisseur . '</td>';
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print "<td>" . $obj->town . "</td>\n";
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print "<td>" . $obj->zip . "</td>\n";
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td align="center">';
$tmparray = getCountry($obj->fk_pays, 'all');
print $tmparray['label'];
print '</td>';
}
// Type ent
if (!empty($arrayfields['typent.code']['checked'])) {
print '<td align="center">';
if (count($typenArray) == 0) {
$typenArray = $formcompany->typent_array(1);
}
print $typenArray[$obj->typent_code];
print '</td>';
}
if (!empty($arrayfields['s.siren']['checked'])) {
print "<td>" . $obj->idprof1 . "</td>\n";
}
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:list.php
示例14: if
?>
<tr <? if ($sno%2==1) { ?> bgcolor="#F5F2F1" <? } ?>>
<td align="center"><?php
echo $sno;
?>
</td>
<td align="center"><?php
echo $row['BuyerName'];
?>
</td>
<td align="center"><?php
echo $row['Address'];
?>
</td>
<td align="center"><?php
echo getCountry($row['CountryId']);
?>
</td>
<td align="center"><? if($row['State']!=0){echo getState($row['State']);} else { echo $row['OtherState'];}?></td>
<td align="center"><? if($row['City']!=0){ echo getCity($row['City']);} else{ echo $row['OtherCity'];}?></td>
<td align="center"><?php
echo $row['Email'];
?>
</td>
<td align="center"><?php
echo $row['ContactNumber'];
?>
</td>
<td align="center"><a href="javascript:;" onClick="return hs.htmlExpand(this)">
<img src="images/Find-icon.png" border="0" width="24" height="24" /></a>
<div class="highslide-maincontent">
开发者ID:shailendra999,项目名称:hr_admin,代码行数:31,代码来源:list_buyer.php
示例15: change_db
include "func_weather.php";
// EXTERNAL VARIABLES
$aptICAO = $_REQUEST["icao"];
// GLOBAL VARIABLES
global $navdatabase, $rfedatabase, $sqlconn;
// Get Information of the Departure and Arrival airports from the Database
change_db($sqlconn, $navdatabase);
$queryapt = "SELECT Name,Latitude,Longtitude,Elevation FROM airports WHERE ICAO='" . $aptICAO . "'";
$queryapt = mysqlexec($sqlconn, $queryapt);
change_db($sqlconn, $rfedatabase);
?>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 style="font-weight: 300"><?php
echo getCountry($aptICAO);
?>
<?php
echo $aptICAO;
?>
- <?php
echo mysql_result($queryapt, 0, 'name');
?>
</h3>
</div>
<div id="modalbody" class="modal-body">
<div class="accordion" id="detailsaccordion">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#detailsaccordion" href="#collapsedetails">
开发者ID:Newsoft-Computer,项目名称:CLI0005-IVAO-Colombia,代码行数:31,代码来源:modal_airport.php
示例16: mysql_close
if ($res && $res['blocked']) {
echo "<ipblocked>true</ipblocked>";
echo "</result>";
mysql_close($conn);
exit(0);
}
$result = mysql_query("SELECT (IF(DATE_SUB(NOW(), INTERVAL {$BAN_TIMEOUT} MINUTE)>ban_time, false, " . "true)) banned, ({$BAN_TIMEOUT}-MINUTE(TIMEDIFF(NOW(), ban_time))) ban_time_left FROM bans WHERE ip='" . "{$_SERVER['REMOTE_ADDR']}' LIMIT 1");
$res = mysql_fetch_array($result);
if ($res && $res['banned']) {
echo "<banned banTime=\"{$res['ban_time_left']}\">true</banned>";
} else {
if (preg_match('/^register$/', $task)) {
clean();
$id = $_GET['id'];
$result = mysql_query("INSERT INTO sessions (id, ip, created_at, marked, type) " . "VALUES('{$id}', '{$_SERVER['REMOTE_ADDR']}', DEFAULT, 0, 0)");
$country = getCountry($_SERVER['REMOTE_ADDR']);
$countryCode = $country ? strtolower($country['code']) : false;
$country = $country ? $country['country'] : false;
if ($result) {
$q = "INSERT INTO user_settings (id, sett_name, sett_value) VALUES ";
$haveSettings = $countryCode ? true : false;
if ($haveSettings) {
$q .= "('{$id}', 'ccode', '{$countryCode}'),";
}
if (isset($_GET['settings'])) {
$settings = preg_replace('/^\\s+|\\s+$/', '', $_GET['settings']);
$settArr = explode(',', $settings);
if (count($settArr) > 1) {
$haveSettings = true;
for ($i = 0; $i < count($settArr); $i += 2) {
$q .= "('{$id}', '{$settArr[$i]}', '{$settArr[$i + 1]}'),";
开发者ID:raheb,项目名称:video-chat,代码行数:31,代码来源:functions.php
示例17: require_once
$output=getGraphData($layer_tablename, $X, $Y);
print $output;
break;
// /*start*/ These requests are specific to UAP (category structure)
case 'getCity':
require_once("MultiLayerSearch.php");
$cid=$_REQUEST['cityName'];
$result=getCity($cid);
print $result;
break;
case 'getCountry':
require_once("MultiLayerSearch.php");
$cName=$_REQUEST['continentName'];
$result=getCountry($cName);
print $result;
break;
case 'getCategory':
require_once("MultiLayerSearch.php");
print getCategory();
break;
case 'getContinent':
require_once("MultiLayerSearch.php");
print getContinent();
break;
case 'getTheme':
require_once("MultiLayerSearch.php");
开发者ID:rahool,项目名称:maplocator,代码行数:31,代码来源:ml_orchestrator.php
示例18: fetch
/**
* Load warehouse data
*
* @param int $id Warehouse id
* @param string $ref Warehouse label
* @return int >0 if OK, <0 if KO
*/
function fetch($id, $ref = '')
{
global $conf;
$sql = "SELECT rowid, label, description, statut, lieu, address, zip, town, fk_pays as country_id";
$sql .= " FROM " . MAIN_DB_PREFIX . "entrepot";
if ($id) {
$sql .= " WHERE rowid = '" . $id . "'";
} else {
$sql .= " WHERE entity = " . $conf->entity;
if ($ref) {
$sql .= " AND label = '" . $this->db->escape($ref) . "'";
}
}
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result) > 0) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->libelle = $obj->label;
$this->description = $obj->description;
$this->statut = $obj->statut;
$this->lieu = $obj->lieu;
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->country_id = $obj->country_id;
include_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$tmp = getCountry($this->country_id, 'all');
$this->country = $tmp['label'];
$this->country_code = $tmp['code'];
return 1;
} else {
return 0;
}
} else {
$this->error = $this->db->error();
return -1;
}
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:48,代码来源:entrepot.class.php
示例19: updateThirdParty
/**
* Update a thirdparty
*
* @param array $authentication Array of authentication information
* @param Societe $thirdparty Thirdparty
* @return array Array result
*/
function updateThirdParty($authentication, $thirdparty)
{
global $db, $conf, $langs;
$now = dol_now();
dol_syslog("Function: updateThirdParty login=" . $authentication['login']);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
// Init and check authentication
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters
if (empty($thirdparty['id'])) {
$error++;
$errorcode = 'KO';
$errorlabel = "Thirdparty id is mandatory.";
}
if (!$error) {
$objectfound = false;
include_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$object = new Societe($db);
$result = $object->fetch($thirdparty['id']);
if (!empty($object->id)) {
$objectfound = true;
$object->ref = $thirdparty['ref'];
$object->name = $thirdparty['ref'];
$object->ref_ext = $thirdparty['ref_ext'];
$object->status = $thirdparty['status'];
$object->client = $thirdparty['client'];
$object->fournisseur = $thirdparty['supplier'];
$object->code_client = $thirdparty['customer_code'];
$object->code_fournisseur = $thirdparty['supplier_code'];
$object->code_compta = $thirdparty['customer_code_accountancy'];
$object->code_compta_fournisseur = $thirdparty['supplier_code_accountancy'];
$object->date_creation = $now;
$object->note_private = $thirdparty['note_private'];
$object->note_public = $thirdparty['note_public'];
$object->address = $thirdparty['address'];
$object->zip = $thirdparty['zip'];
$object->town = $thirdparty['town'];
$object->country_id = $thirdparty['country_id'];
if ($thirdparty['country_code']) {
$object->country_id = getCountry($thirdparty['country_code'], 3);
}
$object->province_id = $thirdparty['province_id'];
//if ($thirdparty['province_code']) $newobject->province_code=getCountry($thirdparty['province_code'],3);
$object->phone = $thirdparty['phone'];
$object->fax = $thirdparty['fax'];
$object->email = $thirdparty['email'];
$object->url = $thirdparty['url'];
$object->idprof1 = $thirdparty['profid1'];
$object->idprof2 = $thirdparty['profid2'];
$object->idprof3 = $thirdparty['profid3'];
$object->idprof4 = $thirdparty['profid4'];
$object->idprof5 = $thirdparty['profid5'];
$object->idprof6 = $thirdparty['profid6'];
$object->capital = $thirdparty['capital'];
$object->barcode = $thirdparty['barcode'];
$object->tva_assuj = $thirdparty['vat_used'];
$object->tva_intra = $thirdparty['vat_number'];
$object->canvas = $thirdparty['canvas'];
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('societe', true);
foreach ($extrafields->attribute_label as $key => $label) {
$key = 'options_' . $key;
$object->array_options[$key] = $thirdparty[$key];
}
$db->begin();
$result = $object->update($thirdparty['id'], $fuser);
if ($result <= 0) {
$error++;
}
}
if (!$error && $objectfound) {
$db->commit();
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $object->id);
} elseif ($objectfound) {
$db->rollback();
$error++;
$errorcode = 'KO';
$errorlabel = $object->error;
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Thirdparty id=' . $thirdparty['id'] . ' cannot be found';
}
}
if ($error) {
//.........这里部分代码省略.........
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:101,代码来源:server_thirdparty.php
示例20: array
// Status
print '<tr><td class="fieldrequired">' . $langs->trans("Status") . '</td>';
print '<td colspan="3">';
print $form->selectarray("clos", array(0 => $account->status[0], 1 => $account->status[1]), isset($_POST["clos"]) ? $_POST["clos"] : $account->clos);
print '</td></tr>';
// Country
$account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id;
$selectedcode = $account->country_code;
if (isset($_POST["account_country_id"])) {
$selectedcode = $_POST["account_country_id"];
} else {
if (empty($selectedcode)) {
$selectedcode = $mysoc->country_code;
}
}
$account->country_code = getCountry($selectedcode, 2);
// Force country code on account to have following field on bank fields matching country rules
print '<tr><td class="fieldrequired">' . $langs->trans("Country") . '</td>';
print '<td colspan="3">';
print $form->select_country($selectedcode, 'account_country_id');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print '</td></tr>';
// State
print '<tr><td>' . $langs->trans('State') . '</td><td colspan="3">';
if ($selectedcode) {
print $formcompany->select_state(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : $account->state_id, $selectedcode, 'account_state_id');
} else {
print $countrynotdefined;
}
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:card.php
注:本文中的getCountry函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论