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


PHP Societe::update方法代码示例

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


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

示例1: put

 /**
  * Update thirdparty
  *
  * @param int   $id             Id of thirdparty to update
  * @param array $request_data   Datas   
  * @return int 
  * 
  * @url	PUT thirdparty/{id}
  */
 function put($id, $request_data = NULL)
 {
     if (!DolibarrApiAccess::$user->rights->societe->creer) {
         throw new RestException(401);
     }
     $result = $this->company->fetch($id);
     if (!$result) {
         throw new RestException(404, 'Thirdparty not found');
     }
     if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) {
         throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
     }
     foreach ($request_data as $field => $value) {
         $this->company->{$field} = $value;
     }
     if ($this->company->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) {
         return $this->get($id);
     }
     return false;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:29,代码来源:api_thirdparty.class.php

示例2: Societe

$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
    $sortorder = "ASC";
}
if (!$sortfield) {
    $sortfield = "nom";
}
/*
 * Actions
 */
if ($_POST['action'] == 'setcustomeraccountancycode') {
    $societe = new Societe($db);
    $result = $societe->fetch($_POST['socid']);
    $societe->code_compta = $_POST["customeraccountancycode"];
    $result = $societe->update($societe->id, $user, 1, 1, 0);
    if ($result < 0) {
        $mesg = join(',', $societe->errors);
    }
    $POST["action"] = "";
    $socid = $_POST["socid"];
}
if ($_GET["action"] == 'attribute_prefix' && $user->rights->societe->creer) {
    $societe = new Societe($db, $_GET["socid"]);
    $societe->attribute_prefix($db, $_GET["socid"]);
}
// conditions de reglement
if ($_POST["action"] == 'setconditions' && $user->rights->societe->creer) {
    $societe = new Societe($db, $_GET["socid"]);
    $societe->cond_reglement = $_POST['cond_reglement_id'];
    $sql = "UPDATE " . MAIN_DB_PREFIX . "societe SET cond_reglement='" . $_POST['cond_reglement_id'];
开发者ID:netors,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例3: 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

示例4: update

 /**
  *	Update a member in database (standard information and password)
  *
  *	@param	User	$user				User making update
  *	@param	int		$notrigger			1=disable trigger UPDATE (when called by create)
  *	@param	int		$nosyncuser			0=Synchronize linked user (standard info), 1=Do not synchronize linked user
  *	@param	int		$nosyncuserpass		0=Synchronize linked user (password), 1=Do not synchronize linked user
  *	@param	int		$nosyncthirdparty	0=Synchronize linked thirdparty (standard info), 1=Do not synchronize linked thirdparty
  * 	@param	string	$action				Current action for hookmanager
  * 	@return	int							<0 if KO, >0 if OK
  */
 function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update')
 {
     global $conf, $langs, $hookmanager;
     $nbrowsaffected = 0;
     $error = 0;
     dol_syslog(get_class($this) . "::update notrigger=" . $notrigger . ", nosyncuser=" . $nosyncuser . ", nosyncuserpass=" . $nosyncuserpass . " nosyncthirdparty=" . $nosyncthirdparty . ", email=" . $this->email);
     // Clean parameters
     $this->lastname = trim($this->lastname) ? trim($this->lastname) : trim($this->lastname);
     $this->firstname = trim($this->firstname) ? trim($this->firstname) : trim($this->firstname);
     $this->address = $this->address ? $this->address : $this->address;
     $this->zip = $this->zip ? $this->zip : $this->zip;
     $this->town = $this->town ? $this->town : $this->town;
     $this->country_id = $this->country_id > 0 ? $this->country_id : $this->country_id;
     $this->state_id = $this->state_id > 0 ? $this->state_id : $this->state_id;
     if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) {
         $this->lastname = ucwords(trim($this->lastname));
     }
     if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) {
         $this->firstname = ucwords(trim($this->firstname));
     }
     // Check parameters
     if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($this->email)) {
         $langs->load("errors");
         $this->error = $langs->trans("ErrorBadEMail", $this->email);
         return -1;
     }
     $this->db->begin();
     $sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
     $sql .= " civility = " . (!is_null($this->civility_id) ? "'" . $this->civility_id . "'" : "null");
     $sql .= ", firstname = " . ($this->firstname ? "'" . $this->db->escape($this->firstname) . "'" : "null");
     $sql .= ", lastname=" . ($this->lastname ? "'" . $this->db->escape($this->lastname) . "'" : "null");
     $sql .= ", login=" . ($this->login ? "'" . $this->db->escape($this->login) . "'" : "null");
     $sql .= ", societe=" . ($this->societe ? "'" . $this->db->escape($this->societe) . "'" : "null");
     $sql .= ", fk_soc=" . ($this->fk_soc > 0 ? "'" . $this->fk_soc . "'" : "null");
     $sql .= ", address=" . ($this->address ? "'" . $this->db->escape($this->address) . "'" : "null");
     $sql .= ", zip=" . ($this->zip ? "'" . $this->db->escape($this->zip) . "'" : "null");
     $sql .= ", town=" . ($this->town ? "'" . $this->db->escape($this->town) . "'" : "null");
     $sql .= ", country=" . ($this->country_id > 0 ? "'" . $this->country_id . "'" : "null");
     $sql .= ", state_id=" . ($this->state_id > 0 ? "'" . $this->state_id . "'" : "null");
     $sql .= ", email='" . $this->email . "'";
     $sql .= ", skype='" . $this->skype . "'";
     $sql .= ", phone=" . ($this->phone ? "'" . $this->db->escape($this->phone) . "'" : "null");
     $sql .= ", phone_perso=" . ($this->phone_perso ? "'" . $this->db->escape($this->phone_perso) . "'" : "null");
     $sql .= ", phone_mobile=" . ($this->phone_mobile ? "'" . $this->db->escape($this->phone_mobile) . "'" : "null");
     $sql .= ", note_private=" . ($this->note_private ? "'" . $this->db->escape($this->note_private) . "'" : "null");
     $sql .= ", note_public=" . ($this->note_private ? "'" . $this->db->escape($this->note_public) . "'" : "null");
     $sql .= ", photo=" . ($this->photo ? "'" . $this->photo . "'" : "null");
     $sql .= ", public='" . $this->public . "'";
     $sql .= ", statut=" . $this->statut;
     $sql .= ", fk_adherent_type=" . $this->typeid;
     $sql .= ", morphy='" . $this->morphy . "'";
     $sql .= ", birth=" . ($this->birth ? "'" . $this->db->idate($this->birth) . "'" : "null");
     if ($this->datefin) {
         $sql .= ", datefin='" . $this->db->idate($this->datefin) . "'";
     }
     // Ne doit etre modifie que par effacement cotisation
     if ($this->datevalid) {
         $sql .= ", datevalid='" . $this->db->idate($this->datevalid) . "'";
     }
     // Ne doit etre modifie que par validation adherent
     $sql .= ", fk_user_mod=" . ($user->id > 0 ? $user->id : 'null');
     // Can be null because member can be create by a guest
     $sql .= " WHERE rowid = " . $this->id;
     dol_syslog(get_class($this) . "::update update member", LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         unset($this->country_code);
         unset($this->country);
         unset($this->state_code);
         unset($this->state);
         $nbrowsaffected += $this->db->affected_rows($resql);
         $action = 'update';
         // Actions on extra fields (by external module)
         // TODO le hook fait double emploi avec le trigger !!
         $hookmanager->initHooks(array('memberdao'));
         $parameters = array('id' => $this->id);
         $action = '';
         $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action);
         // Note that $action and $object may have been modified by some hooks
         if (empty($reshook)) {
             if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
                 $result = $this->insertExtraFields();
                 if ($result < 0) {
                     $error++;
                 }
             }
         } else {
             if ($reshook < 0) {
                 $error++;
//.........这里部分代码省略.........
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:101,代码来源:adherent.class.php

示例5: Societe

$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
    $sortorder = "ASC";
}
if (!$sortfield) {
    $sortfield = "nom";
}
$object = new Societe($db);
/*
 * Actions
 */
if ($action == 'setcustomeraccountancycode') {
    $result = $object->fetch($id);
    $object->code_compta = $_POST["customeraccountancycode"];
    $result = $object->update($object->id, $user, 1, 1, 0);
    if ($result < 0) {
        $mesgs[] = join(',', $object->errors);
    }
    $action = "";
}
// conditions de reglement
if ($action == 'setconditions' && $user->rights->societe->creer) {
    $object->fetch($id);
    $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
    if ($result < 0) {
        dol_print_error($db, $object->error);
    }
}
// mode de reglement
if ($action == 'setmode' && $user->rights->societe->creer) {
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:fiche.php

示例6: update

	/**
     *      Update parameters of third party
     *      @param      id              			id societe
     *      @param      user            			Utilisateur qui demande la mise a jour
     *      @param      call_trigger    			0=non, 1=oui
     *		@param		allowmodcodeclient			Inclut modif code client et code compta
     *		@param		allowmodcodefournisseur		Inclut modif code fournisseur et code compta fournisseur
     *      @return     int             			<0 si ko, >=0 si ok
     */
    function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
    {
    	$result = parent::update($id, $user, $call_trigger, $allowmodcodeclient, $allowmodcodefournisseur);

    	return $result;
    }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:15,代码来源:dao_thirdparty_default.class.php

示例7: switch


//.........这里部分代码省略.........
                         if (!empty($ligne[2])) {
                             $doliprod->status = $ligne[2];
                         }
                         $doliprod->status_buy = 1;
                         if (!empty($ligne[3])) {
                             $doliprod->description = $ligne[3];
                         }
                         if (!empty($ligne[4])) {
                             $doliprod->price = $ligne[4];
                         }
                         if (!empty($ligne[5])) {
                             $doliprod->tva_tx = $ligne[5];
                         }
                         if (!empty($ligne[6])) {
                             $doliprod->weight = $ligne[6];
                         }
                         if (!empty($ligne[7])) {
                             $doliprod->volume = $ligne[7];
                         }
                         if (!empty($ligne[9])) {
                             $doliprod->barcode = $ligne[9];
                         }
                         if (!empty($ligne[9])) {
                             $doliprod->barcode_type = dol_getIdFromCode($this->db, $ligne[10], 'c_barcode_type', 'libelle', 'rowid');
                         }
                         if (!empty($ligne[10])) {
                             $doliprod->type = $ligne[11];
                         }
                         $doliprod->price_base_type = 'HT';
                         $this->db->begin;
                         switch ($typeimport) {
                             case 'C':
                                 if ($pid > 0) {
                                     if ($doliprod->update($pid, $this->user) < 0) {
                                         $this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error) . "\n";
                                         $error++;
                                     }
                                     if ($doliprod->updatePrice($doliprod->price, $doliprod->price_base_type, $this->user) < 0) {
                                         $this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error) . "\n";
                                         $error++;
                                     }
                                 } else {
                                     if ($doliprod->create($this->user) < 0) {
                                         $this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error) . "\n";
                                         $error++;
                                     } else {
                                         // image et code barre
                                         if ($ligne[8]) {
                                             $this->add_photo_web($conf->produit->dir_output, $ligne[8], $doliprod->id);
                                         }
                                         /*if ($ligne[9]) {
                                         			if ($doliprod->setValueFrom('fk_barcode_type', 2) < 0){
                                         				$this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error)."\n"; // TODO paramétrer
                                         				$error++;
                                         			}
                                         			if ($doliprod->setValueFrom('barcode', $ligne[9]) < 0 ){
                                         				$this->process_msg .= $langs->trans("ErrProductCreate", $ligne[0], $doliprod->error)."\n";
                                         				$error++;
                                         			}
                                         		}*/
                                     }
                                 }
                                 break;
                                 /*case 'M':
                                 		if ($pid>0) 
                                 		{
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:67,代码来源:importator.class.php

示例8: testSocieteUpdate

    /**
     * testSocieteUpdate
     *
     * @param	Societe	$localobject	Company
     * @return	Societe	$localobject	Company
	 *
     * @depends	testSocieteFetch
     * The depends says test is run only if previous is ok
     */
    public function testSocieteUpdate($localobject)
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject->note='New note after update';
		//$localobject->note_public='New note public after update';
		$localobject->name='New name';
		$localobject->address='New address';
		$localobject->zip='New zip';
		$localobject->town='New town';
		$localobject->country_id=2;
		$localobject->status=0;
		$localobject->tel='New tel';
		$localobject->fax='New fax';
		$localobject->email='newemail@newemail.com';
		$localobject->url='New url';
		$localobject->idprof1='new idprof1';
		$localobject->idprof2='new idprof2';
		$localobject->idprof3='new idprof3';
		$localobject->idprof4='new idprof4';
		$result=$localobject->update($localobject->id,$user);
    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
    	$this->assertLessThan($result, 0);
		$result=$localobject->update_note($localobject->note);
    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
    	$this->assertLessThan($result, 0);
		//$result=$localobject->update_note_public($localobject->note_public);
    	//print __METHOD__." id=".$localobject->id." result=".$result."\n";
    	//$this->assertLessThan($result, 0);

		$newobject=new Societe($this->savdb);
    	$result=$newobject->fetch($localobject->id);
        print __METHOD__." id=".$localobject->id." result=".$result."\n";
    	$this->assertLessThan($result, 0);

    	$this->assertEquals($localobject->note, $newobject->note);
    	//$this->assertEquals($localobject->note_public, $newobject->note_public);
    	$this->assertEquals($localobject->name, $newobject->name);
    	$this->assertEquals($localobject->address, $newobject->address);
    	$this->assertEquals($localobject->zip, $newobject->zip);
    	$this->assertEquals($localobject->town, $newobject->town);
    	$this->assertEquals($localobject->country_id, $newobject->country_id);
    	$this->assertEquals('BE', $newobject->country_code);
    	$this->assertEquals($localobject->status, $newobject->status);
    	$this->assertEquals($localobject->tel, $newobject->tel);
    	$this->assertEquals($localobject->fax, $newobject->fax);
    	$this->assertEquals($localobject->email, $newobject->email);
    	$this->assertEquals($localobject->url, $newobject->url);
    	$this->assertEquals($localobject->idprof1, $newobject->idprof1);
    	$this->assertEquals($localobject->idprof2, $newobject->idprof2);
    	$this->assertEquals($localobject->idprof3, $newobject->idprof3);
    	$this->assertEquals($localobject->idprof4, $newobject->idprof4);

    	return $localobject;
    }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:68,代码来源:SocieteTest.php


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