本文整理汇总了PHP中Societe::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Societe::delete方法的具体用法?PHP Societe::delete怎么用?PHP Societe::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Societe
的用法示例。
在下文中一共展示了Societe::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete thirdparty
*
* @param int $id Thirparty ID
* @return type
*
* @url DELETE thirdparty/{id}
*/
function delete($id)
{
if (!DolibarrApiAccess::$user->rights->societe->supprimer) {
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);
}
return $this->company->delete($id);
}
示例2: deleteThirdParty
/**
* Delete a thirdparty
*
* @param array $authentication Array of authentication information
* @param string $id internal id
* @param string $ref internal reference
* @param string $ref_ext external reference
* @return array Array result
*/
function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
{
global $db, $conf, $langs;
dol_syslog("Function: deleteThirdParty login=" . $authentication['login'] . " id=" . $id . " ref=" . $ref . " ref_ext=" . $ref_ext);
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 (!$error && ($id && $ref || $id && $ref_ext || $ref && $ref_ext)) {
dol_syslog("Function: deleteThirdParty checkparam");
$error++;
$errorcode = 'BAD_PARAMETERS';
$errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
}
dol_syslog("Function: deleteThirdParty 1");
if (!$error) {
$fuser->getrights();
if ($fuser->rights->societe->lire && $fuser->rights->societe->supprimer) {
$thirdparty = new Societe($db);
$result = $thirdparty->fetch($id, $ref, $ref_ext);
if ($result > 0) {
$db->begin();
$result = $thirdparty->delete($thirdparty->id, $fuser);
if ($result > 0) {
$db->commit();
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''));
} else {
$db->rollback();
$error++;
$errorcode = 'KO';
$errorlabel = $thirdparty->error;
dol_syslog("Function: deleteThirdParty cant delete");
}
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Object not found for id=' . $id . ' nor ref=' . $ref . ' nor ref_ext=' . $ref_ext;
}
} else {
$error++;
$errorcode = 'PERMISSION_DENIED';
$errorlabel = 'User does not have permission for this request';
}
}
if ($error) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
示例3: Societe
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $socid);
exit;
} else {
//$object->id = $socid;
$action = "edit";
}
}
}
}
// Delete third party
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) {
$object = new Societe($db);
$object->load($socid);
$result = $object->delete();
if ($result > 0) {
Header("Location: " . DOL_URL_ROOT . "/comm/list.php");
exit;
} else {
$langs->load("errors");
$error = $langs->trans($object->error);
$errors = $object->errors;
$action = '';
}
}
/*
* Generate document
示例4: array
require_once DOL_DOCUMENT_ROOT . $object_file;
if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) {
$errors++;
}
}
//External modules should update their ones too
if (!$errors) {
$reshook = $hookmanager->executeHooks('replaceThirdparty', array('soc_origin' => $soc_origin->id, 'soc_dest' => $object->id), $soc_dest, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$errors++;
}
}
if (!$errors) {
//We finally remove the old thirdparty
if ($soc_origin->delete($soc_origin->id, $user) < 1) {
$errors++;
}
}
if (!$errors) {
setEventMessage($langs->trans('ThirdpartiesMergeSuccess'));
$db->commit();
} else {
setEventMessage($langs->trans('ErrorsThirdpartyMerge'), 'errors');
$db->rollback();
}
}
}
}
if (GETPOST('getcustomercode')) {
// We defined value code_client
示例5: delete
/**
* Delete third party in database
* @param id id de la societe a supprimer
*/
function delete($id)
{
$result = parent::delete($id);
return $result;
}
示例6: switch
//.........这里部分代码省略.........
else{
if ($doliprod->updatePrice($doliprod->id, $doliprod->price, $doliprod->price_base_type, $this->user) < 0){
$this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error)."\n";
$error++;
}
}
}
else $this->process_msg .= $langs->trans("Untreated", $i).' '.$langs->trans("ErrProdNoExist", $ligne[0])."\n";
break;*/
/*case 'M':
if ($pid>0)
{
if ($doliprod->update($pid, $this->user) < 0){
$this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error)."\n";
$error++;
}
if (version_compare(DOL_VERSION, 3.5) >= 0){
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->updatePrice($doliprod->id, $doliprod->price, $doliprod->price_base_type, $this->user) < 0){
$this->process_msg .= $langs->trans("ErrProductUpdate", $ligne[0], $doliprod->error)."\n";
$error++;
}
}
}
else $this->process_msg .= $langs->trans("Untreated", $i).' '.$langs->trans("ErrProdNoExist", $ligne[0])."\n";
break;*/
case 'D':
if ($pid > 0) {
if ($doliprod->delete($pid) < 0) {
$this->process_msg .= $langs->trans("ErrProductDelete", $ligne[0], $doliprod->error) . "\n";
$error++;
}
} else {
$this->process_msg .= $langs->trans("Untreated", $i) . ' ' . $langs->trans("ErrProdNoExist", $ligne[0]) . "\n";
}
}
if (!$error) {
$this->db->commit();
} else {
$this->db->rollback();
}
}
}
// while
break;
case 'ImportThirtdparty':
$i = 0;
//$societe = new Societe($this->db);
while ($ligne = fgetcsv($fp, 1000, ";")) {
$i++;
$societe = new Societe($this->db);
if ($this->firstline && $i == 1) {
continue;
}
if (!$ligne[0]) {
$this->process_msg .= $langs->trans("Untreated", $i) . " " . $langs->trans("ErrNameRequired") . "\n";
continue;
}
// vérifier par code_client
if ($ligne[13]) {
$sid = $this->get_socbyclientcode($ligne[13]);
示例7: testSocieteDelete
/**
* testSocieteDelete
*
* @param int $id Id of company
* @return int
*
* @depends testSocieteOther
* The depends says test is run only if previous is ok
*/
public function testSocieteDelete($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Societe($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete($id);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
示例8: testAdherentSetThirdPartyId
/**
* testAdherentSetThirdPartyId
*
* @param Adherent $localobject Member instance
* @return Adherent
*
* @depends testAdherentSetUserId
* The depends says test is run only if previous is ok
*/
public function testAdherentSetThirdPartyId(Adherent $localobject)
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
//Create a Third Party
$thirdparty = new Societe($db);
$thirdparty->initAsSpecimen();
$result = $thirdparty->create($user);
print __METHOD__ . " id=" . $localobject->id . " third party id=" . $thirdparty->id . " result=" . $result . "\n";
$this->assertTrue($result > 0);
//Set Third Party ID
$result = $localobject->setThirdPartyId($thirdparty->id);
$this->assertEquals($result, 1);
print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
//Adherent is updated with new data
$localobject->fetch($localobject->id);
$this->assertEquals($localobject->fk_soc, $thirdparty->id);
print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n";
//We remove the third party association
$result = $localobject->setThirdPartyId(0);
$this->assertEquals($result, 1);
//And check if it has been updated
$localobject->fetch($localobject->id);
$this->assertNull($localobject->fk_soc);
//Now we remove the third party
$result = $thirdparty->delete($thirdparty->id, $user);
$this->assertEquals($result, 1);
return $localobject;
}