本文整理汇总了PHP中Propal::getIdcontact方法的典型用法代码示例。如果您正苦于以下问题:PHP Propal::getIdcontact方法的具体用法?PHP Propal::getIdcontact怎么用?PHP Propal::getIdcontact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propal
的用法示例。
在下文中一共展示了Propal::getIdcontact方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
//.........这里部分代码省略.........
$fk_parent_line = 0;
}
$result = $this->addline($this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, $this->lines[$i]->tva_tx, $this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax2_tx, $this->lines[$i]->fk_product, $this->lines[$i]->remise_percent, $this->lines[$i]->info_bits, $this->lines[$i]->fk_remise_except, 'HT', 0, $this->lines[$i]->date_start, $this->lines[$i]->date_end, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label, $this->lines[$i]->array_options, $this->lines[$i]->fk_unit, $this->element, $this->lines[$i]->id);
if ($result < 0) {
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) {
$this->error = $this->db->lasterror();
dol_print_error($this->db);
}
$this->db->rollback();
return -1;
}
// Defined the new fk_parent_line
if ($result > 0 && $this->lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
// update ref
$initialref = '(PROV' . $this->id . ')';
if (!empty($this->ref)) {
$initialref = $this->ref;
}
$sql = 'UPDATE ' . MAIN_DB_PREFIX . "commande SET ref='" . $this->db->escape($initialref) . "' WHERE rowid=" . $this->id;
if ($this->db->query($sql)) {
if ($this->id) {
$this->ref = $initialref;
// Add object linked
if (is_array($this->linked_objects) && !empty($this->linked_objects)) {
foreach ($this->linked_objects as $origin => $origin_id) {
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret) {
dol_print_error($this->db);
$error++;
}
// TODO mutualiser
if ($origin == 'propal' && $origin_id) {
// On recupere les differents contact interne et externe
$prop = new Propal($this->db);
$prop->fetch($origin_id);
// We get ids of sales representatives of proposal
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid) {
//On passe le commercial suivi propale en commercial suivi commande
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// We get ids of customer follower of proposal
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
if ($this->contactid) {
//On passe le contact client suivi propale en contact client suivi commande
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
}
}
}
}
}
if (!$error) {
//$action='create';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
/*$hookmanager->initHooks(array('orderdao'));
$parameters=array('socid'=>$this->id);
$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)) // For avoid conflicts if trigger used
{*/
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
/* }
}
else if ($reshook < 0) $error++;*/
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('ORDER_CREATE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return $this->id;
} else {
$this->db->rollback();
return -1 * $error;
}
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
} else {
dol_print_error($this->db);
$this->db->rollback();
return -1;
}
}
示例2: create
//.........这里部分代码省略.........
$sql .= ")";
$sql .= " VALUES ('(PROV)'," . $this->socid . ", " . $this->db->idate(gmmktime()) . ", " . $user->id . ", " . $this->fk_project;
$sql .= ", " . $this->db->idate($date);
$sql .= ", " . ($this->source >= 0 && $this->source != '' ? $this->source : 'null');
$sql .= ", '" . $this->db->escape($this->note) . "'";
$sql .= ", '" . $this->db->escape($this->note_public) . "'";
$sql .= ", '" . $this->db->escape($this->ref_client) . "'";
$sql .= ", " . ($this->ref_int ? "'" . $this->db->escape($this->ref_int) . "'" : "null");
$sql .= ", '" . $this->modelpdf . "'";
$sql .= ", " . ($this->cond_reglement_id > 0 ? "'" . $this->cond_reglement_id . "'" : "null");
$sql .= ", " . ($this->mode_reglement_id > 0 ? "'" . $this->mode_reglement_id . "'" : "null");
$sql .= ", " . ($this->availability_id > 0 ? "'" . $this->availability_id . "'" : "null");
$sql .= ", " . ($this->demand_reason_id > 0 ? "'" . $this->demand_reason_id . "'" : "null");
$sql .= ", " . ($this->date_livraison ? "'" . $this->db->idate($this->date_livraison) . "'" : "null");
$sql .= ", " . ($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL');
$sql .= ", " . ($this->remise_absolue > 0 ? $this->remise_absolue : 'NULL');
$sql .= ", '" . $this->remise_percent . "'";
$sql .= ", " . $conf->entity;
$sql .= ")";
dol_syslog("Commande::create sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . 'commande');
if ($this->id) {
$fk_parent_line = 0;
$num = sizeof($this->lines);
/*
* Insertion du detail des produits dans la base
*/
for ($i = 0; $i < $num; $i++) {
// Reset fk_parent_line for no child products and special product
if ($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line) || $this->lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
$result = $this->addline($this->id, $this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, $this->lines[$i]->tva_tx, $this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax2_tx, $this->lines[$i]->fk_product, $this->lines[$i]->remise_percent, $this->lines[$i]->info_bits, $this->lines[$i]->fk_remise_except, 'HT', 0, $this->lines[$i]->date_start, $this->lines[$i]->date_end, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, $fk_parent_line);
if ($result < 0) {
$this->error = $this->db->lasterror();
dol_print_error($this->db);
$this->db->rollback();
return -1;
}
// Defined the new fk_parent_line
if ($result > 0 && $this->lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
// Mise a jour ref
$sql = 'UPDATE ' . MAIN_DB_PREFIX . "commande SET ref='(PROV" . $this->id . ")' WHERE rowid=" . $this->id;
if ($this->db->query($sql)) {
if ($this->id) {
$this->ref = "(PROV" . $this->id . ")";
// Add linked object and contacts
if ($this->origin && $this->origin_id) {
$ret = $this->add_object_linked();
if (!$ret) {
dol_print_error($this->db);
}
// TODO mutualiser
if ($this->origin == 'propal') {
// On recupere les differents contact interne et externe
$prop = new Propal($this->db, $this->socid, $this->origin_id);
// On recupere le commercial suivi propale
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid) {
//On passe le commercial suivi propale en commercial suivi commande
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// On recupere le contact client suivi propale
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
if ($this->contactid) {
//On passe le contact client suivi propale en contact client suivi commande
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
}
}
}
}
if (!$notrigger) {
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
$interface = new Interfaces($this->db);
$result = $interface->run_triggers('ORDER_CREATE', $this, $user, $langs, $conf);
if ($result < 0) {
$error++;
$this->errors = $interface->errors;
}
// Fin appel triggers
}
$this->db->commit();
return $this->id;
} else {
$this->db->rollback();
return -1;
}
}
} else {
dol_print_error($this->db);
$this->db->rollback();
return -1;
}
}
示例3: create
//.........这里部分代码省略.........
if ($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line) || $this->lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
$result = $this->addline($this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, $this->lines[$i]->tva_tx, $this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax2_tx, $this->lines[$i]->fk_product, $this->lines[$i]->remise_percent, $this->lines[$i]->info_bits, $this->lines[$i]->fk_remise_except, 'HT', 0, $this->lines[$i]->date_start, $this->lines[$i]->date_end, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label, $this->lines[$i]->array_options);
if ($result < 0) {
$this->error = $this->db->lasterror();
dol_print_error($this->db);
$this->db->rollback();
return -1;
}
// Defined the new fk_parent_line
if ($result > 0 && $this->lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
// Mise a jour ref
$sql = 'UPDATE ' . MAIN_DB_PREFIX . "commande SET ref='(PROV" . $this->id . ")' WHERE rowid=" . $this->id;
if ($this->db->query($sql)) {
if ($this->id) {
$this->ref = "(PROV" . $this->id . ")";
// Add object linked
if (is_array($this->linked_objects) && !empty($this->linked_objects)) {
foreach ($this->linked_objects as $origin => $origin_id) {
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret) {
dol_print_error($this->db);
$error++;
}
// TODO mutualiser
if ($origin == 'propal' && $origin_id) {
// On recupere les differents contact interne et externe
$prop = new Propal($this->db, $this->socid, $origin_id);
// On recupere le commercial suivi propale
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid) {
//On passe le commercial suivi propale en commercial suivi commande
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// On recupere le contact client suivi propale
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
if ($this->contactid) {
//On passe le contact client suivi propale en contact client suivi commande
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
}
}
}
}
}
if (!$error) {
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
$parameters = array('socid' => $this->id);
$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++;
}