mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 00:53:00 +01:00
Merge github.com:Dolibarr/dolibarr into dev_new_add_desc_when_select_product
This commit is contained in:
@@ -86,10 +86,10 @@ class box_members extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max));
|
||||
|
||||
if ($user->rights->adherent->lire)
|
||||
{
|
||||
if ($user->rights->adherent->lire) {
|
||||
$sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql .= ' a.photo, a.email, a.gender, a.morphy,';
|
||||
$sql .= " t.subscription";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('member').")";
|
||||
@@ -98,13 +98,11 @@ class box_members extends ModeleBoxes
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$line = 0;
|
||||
while ($line < $num)
|
||||
{
|
||||
while ($line < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$datec = $this->db->jdate($objp->datec);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
@@ -113,6 +111,10 @@ class box_members extends ModeleBoxes
|
||||
$memberstatic->firstname = $objp->firstname;
|
||||
$memberstatic->id = $objp->rowid;
|
||||
$memberstatic->ref = $objp->rowid;
|
||||
$memberstatic->photo = $objp->photo;
|
||||
$memberstatic->gender = $objp->gender;
|
||||
$memberstatic->email = $objp->email;
|
||||
$memberstatic->morphy = $objp->morphy;
|
||||
$memberstatic->company = $objp->company;
|
||||
|
||||
if (!empty($objp->fk_soc)) {
|
||||
@@ -125,7 +127,7 @@ class box_members extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $memberstatic->getNomUrl(1),
|
||||
'text' => $memberstatic->getNomUrl(-1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
|
||||
@@ -126,7 +126,6 @@ class box_services_contracts extends ModeleBoxes
|
||||
$contractlinestatic->product_id = $objp->product_id;
|
||||
$contractlinestatic->product_ref = $objp->product_ref;
|
||||
$contractlinestatic->product_type = $objp->product_type;
|
||||
|
||||
$contractlinestatic->statut = $objp->contractline_status;
|
||||
|
||||
$contractstatic->id = $objp->rowid;
|
||||
|
||||
@@ -105,7 +105,7 @@ trait CommonIncoterm
|
||||
*
|
||||
* @param int $id_incoterm Id of incoterm to set or '' to remove
|
||||
* @param string $location location of incoterm
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setIncoterms($id_incoterm, $location)
|
||||
{
|
||||
|
||||
@@ -33,36 +33,36 @@ abstract class CommonInvoice extends CommonObject
|
||||
{
|
||||
use CommonIncoterm;
|
||||
|
||||
/**
|
||||
* Standard invoice
|
||||
*/
|
||||
const TYPE_STANDARD = 0;
|
||||
/**
|
||||
* Standard invoice
|
||||
*/
|
||||
const TYPE_STANDARD = 0;
|
||||
|
||||
/**
|
||||
* Replacement invoice
|
||||
*/
|
||||
const TYPE_REPLACEMENT = 1;
|
||||
/**
|
||||
* Replacement invoice
|
||||
*/
|
||||
const TYPE_REPLACEMENT = 1;
|
||||
|
||||
/**
|
||||
* Credit note invoice
|
||||
*/
|
||||
const TYPE_CREDIT_NOTE = 2;
|
||||
/**
|
||||
* Credit note invoice
|
||||
*/
|
||||
const TYPE_CREDIT_NOTE = 2;
|
||||
|
||||
/**
|
||||
* Deposit invoice
|
||||
*/
|
||||
const TYPE_DEPOSIT = 3;
|
||||
/**
|
||||
* Deposit invoice
|
||||
*/
|
||||
const TYPE_DEPOSIT = 3;
|
||||
|
||||
/**
|
||||
* Proforma invoice.
|
||||
* @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
|
||||
*/
|
||||
const TYPE_PROFORMA = 4;
|
||||
/**
|
||||
* Proforma invoice.
|
||||
* @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
|
||||
*/
|
||||
const TYPE_PROFORMA = 4;
|
||||
|
||||
/**
|
||||
* Situation invoice
|
||||
*/
|
||||
const TYPE_SITUATION = 5;
|
||||
/**
|
||||
* Situation invoice
|
||||
*/
|
||||
const TYPE_SITUATION = 5;
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
@@ -102,16 +102,16 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
public function getRemainToPay($multicurrency = 0)
|
||||
{
|
||||
$alreadypaid = 0.0;
|
||||
$alreadypaid += $this->getSommePaiement($multicurrency);
|
||||
$alreadypaid += $this->getSumDepositsUsed($multicurrency);
|
||||
$alreadypaid += $this->getSumCreditNotesUsed($multicurrency);
|
||||
$alreadypaid = 0.0;
|
||||
$alreadypaid += $this->getSommePaiement($multicurrency);
|
||||
$alreadypaid += $this->getSumDepositsUsed($multicurrency);
|
||||
$alreadypaid += $this->getSumCreditNotesUsed($multicurrency);
|
||||
|
||||
$remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT');
|
||||
if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
|
||||
$remaintopay = 0.0;
|
||||
}
|
||||
return $remaintopay;
|
||||
$remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT');
|
||||
if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
|
||||
$remaintopay = 0.0;
|
||||
}
|
||||
return $remaintopay;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +151,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all deposits invoices used by invoice.
|
||||
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
|
||||
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
|
||||
*
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return float <0 if KO, Sum of deposits amount otherwise
|
||||
@@ -159,21 +159,21 @@ abstract class CommonInvoice extends CommonObject
|
||||
public function getSumDepositsUsed($multicurrency = 0)
|
||||
{
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
// TODO
|
||||
return 0.0;
|
||||
}
|
||||
{
|
||||
// TODO
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
$discountstatic = new DiscountAbsolute($this->db);
|
||||
$result = $discountstatic->getSumDepositsUsed($this, $multicurrency);
|
||||
if ($result >= 0) {
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
$discountstatic = new DiscountAbsolute($this->db);
|
||||
$result = $discountstatic->getSumDepositsUsed($this, $multicurrency);
|
||||
if ($result >= 0) {
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,16 +184,16 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
public function getSumCreditNotesUsed($multicurrency = 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
$discountstatic = new DiscountAbsolute($this->db);
|
||||
$result = $discountstatic->getSumCreditNotesUsed($this, $multicurrency);
|
||||
if ($result >= 0) {
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
$discountstatic = new DiscountAbsolute($this->db);
|
||||
$result = $discountstatic->getSumCreditNotesUsed($this, $multicurrency);
|
||||
if ($result >= 0) {
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,16 +204,16 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
public function getSumFromThisCreditNotesNotUsed($multicurrency = 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
$discountstatic = new DiscountAbsolute($this->db);
|
||||
$result = $discountstatic->getSumFromThisCreditNotesNotUsed($this, $multicurrency);
|
||||
if ($result >= 0) {
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
$discountstatic = new DiscountAbsolute($this->db);
|
||||
$result = $discountstatic->getSumFromThisCreditNotesNotUsed($this, $multicurrency);
|
||||
if ($result >= 0) {
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,7 +329,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$tmp = array('amount'=>$obj->amount,'type'=>$obj->code, 'date'=>$obj->datep, 'num'=>$obj->num, 'ref'=>$obj->ref);
|
||||
if (!empty($field3)) {
|
||||
$tmp['ref_ext'] = $obj->ref_ext;
|
||||
$tmp['ref_ext'] = $obj->ref_ext;
|
||||
}
|
||||
$retarray[]=$tmp;
|
||||
$i++;
|
||||
@@ -385,7 +385,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return if an invoice can be deleted
|
||||
* Rule is:
|
||||
@@ -399,9 +399,9 @@ abstract class CommonInvoice extends CommonObject
|
||||
*
|
||||
* @return int <=0 if no, >0 if yes
|
||||
*/
|
||||
public function is_erasable()
|
||||
{
|
||||
// phpcs:enable
|
||||
public function is_erasable()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
// We check if invoice is a temporary number (PROVxxxx)
|
||||
@@ -486,15 +486,15 @@ abstract class CommonInvoice extends CommonObject
|
||||
*
|
||||
* @return string Label of type of invoice
|
||||
*/
|
||||
public function getLibType()
|
||||
public function getLibType()
|
||||
{
|
||||
global $langs;
|
||||
if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard");
|
||||
elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
|
||||
elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
|
||||
elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
|
||||
elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
|
||||
elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
|
||||
if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard");
|
||||
elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
|
||||
elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
|
||||
elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
|
||||
elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
|
||||
elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
|
||||
return $langs->trans("Unknown");
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return label of a status
|
||||
*
|
||||
@@ -523,52 +523,52 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load('bills');
|
||||
|
||||
$statusType = 'status0';
|
||||
$prefix = 'Short';
|
||||
if (!$paye) {
|
||||
if ($status == 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusDraft');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusDraft');
|
||||
} elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedUnpaid');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedUnpaid');
|
||||
$statusType = 'status5';
|
||||
} elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially');
|
||||
$statusType = 'status9';
|
||||
} elseif ($alreadypaid == 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid');
|
||||
$statusType = 'status1';
|
||||
} else {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusStarted');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusStarted');
|
||||
$statusType = 'status3';
|
||||
}
|
||||
if ($status == 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusDraft');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusDraft');
|
||||
} elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedUnpaid');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedUnpaid');
|
||||
$statusType = 'status5';
|
||||
} elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially');
|
||||
$statusType = 'status9';
|
||||
} elseif ($alreadypaid == 0) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid');
|
||||
$statusType = 'status1';
|
||||
} else {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusStarted');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusStarted');
|
||||
$statusType = 'status3';
|
||||
}
|
||||
} else {
|
||||
$statusType = 'status6';
|
||||
$statusType = 'status6';
|
||||
|
||||
if ($type == self::TYPE_CREDIT_NOTE) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusPaidBackOrConverted'); // credit note
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
|
||||
} elseif ($type == self::TYPE_DEPOSIT) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusConverted'); // deposit invoice
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusConverted'); // deposit invoice
|
||||
} else {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusPaid');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid');
|
||||
}
|
||||
if ($type == self::TYPE_CREDIT_NOTE) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusPaidBackOrConverted'); // credit note
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
|
||||
} elseif ($type == self::TYPE_DEPOSIT) {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusConverted'); // deposit invoice
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusConverted'); // deposit invoice
|
||||
} else {
|
||||
$labelStatus = $langs->transnoentitiesnoconv('BillStatusPaid');
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid');
|
||||
}
|
||||
}
|
||||
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Returns an invoice payment deadline based on the invoice settlement
|
||||
* conditions and billing date.
|
||||
@@ -576,15 +576,15 @@ abstract class CommonInvoice extends CommonObject
|
||||
* @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
|
||||
* @return integer Date limite de reglement si ok, <0 si ko
|
||||
*/
|
||||
public function calculate_date_lim_reglement($cond_reglement = 0)
|
||||
public function calculate_date_lim_reglement($cond_reglement = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
if (!$cond_reglement) $cond_reglement = $this->cond_reglement_code;
|
||||
if (!$cond_reglement) $cond_reglement = $this->cond_reglement_id;
|
||||
|
||||
$cdr_nbjour = 0;
|
||||
$cdr_type = 0;
|
||||
$cdr_decalage = 0;
|
||||
$cdr_type = 0;
|
||||
$cdr_decalage = 0;
|
||||
|
||||
$sqltemp = 'SELECT c.type_cdr, c.nbjour, c.decalage';
|
||||
$sqltemp .= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
|
||||
@@ -643,7 +643,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
// 2 : application of the rule, the N of the current or next month
|
||||
elseif ($cdr_type == 2 && !empty($cdr_decalage))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$datelim = $this->date + ($cdr_nbjour * 3600 * 24);
|
||||
|
||||
$date_piece = dol_mktime(0, 0, 0, date('m', $datelim), date('d', $datelim), date('Y', $datelim)); // Sans les heures minutes et secondes
|
||||
|
||||
@@ -8039,6 +8039,18 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Delete llx_ecm_files
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !empty($this->isextrafieldmanaged))
|
||||
{
|
||||
$result = $this->deleteExtraFields();
|
||||
|
||||
@@ -422,7 +422,7 @@ class FormTicket
|
||||
|
||||
print '</table>';
|
||||
|
||||
if ($withdolfichehead) dol_fiche_end();
|
||||
if ($withdolfichehead) print dol_get_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" name="add" value="'.$langs->trans(($this->withthreadid > 0 ? "SendResponse" : "NewTicket")).'" />';
|
||||
|
||||
@@ -113,7 +113,7 @@ class Translate
|
||||
} else $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
|
||||
} else { // If it's for a codetouse that is a short code xx
|
||||
// Array to convert short lang code into long code.
|
||||
$longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'nb'=>'nb_NO', 'no'=>'nb_NO');
|
||||
$longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO');
|
||||
if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])];
|
||||
elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
|
||||
else $srclang = 'en_US';
|
||||
|
||||
@@ -758,7 +758,7 @@ if ($sql) {
|
||||
print '<div>';
|
||||
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
dol_fiche_end();
|
||||
print dol_get_fiche_end();
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@@ -235,7 +235,7 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
|
||||
|
||||
|
||||
@@ -1258,7 +1258,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
|
||||
* @param array $links Array of tabs. Currently initialized by calling a function xxx_admin_prepare_head
|
||||
* @param string $active Active tab name (document', 'info', 'ldap', ....)
|
||||
* @param string $title Title
|
||||
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
|
||||
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
|
||||
* @param string $picto Add a picto on tab title
|
||||
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
|
||||
* @param string $morehtmlright Add more html content on right of tabs title
|
||||
@@ -1279,7 +1279,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0
|
||||
* @param array $links Array of tabs
|
||||
* @param string $active Active tab name
|
||||
* @param string $title Title
|
||||
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
|
||||
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
|
||||
* @param string $picto Add a picto on tab title
|
||||
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
|
||||
* @param string $morehtmlright Add more html content on right of tabs title
|
||||
@@ -1456,6 +1456,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
*
|
||||
* @param int $notab -1 or 0=Add tab footer, 1=no tab footer
|
||||
* @return void
|
||||
* @deprecated Use print dol_get_fiche_end() instead
|
||||
*/
|
||||
function dol_fiche_end($notab = 0)
|
||||
{
|
||||
@@ -3316,9 +3317,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
|
||||
$enabledisablehtml = '<span class="'.$fa.' '.$fakey.($marginleftonlyshort ? ($marginleftonlyshort == 1 ? ' marginleftonlyshort' : ' marginleftonly') : '');
|
||||
$enabledisablehtml .= ($morecss ? ' '.$morecss : '').'" style="'.($fasize ? ('font-size: '.$fasize.';') : '').($facolor ? (' color: '.$facolor.';') : '').($morestyle ? ' '.$morestyle : '').'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt : '').'>';
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
/*if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$enabledisablehtml .= $titlealt;
|
||||
}
|
||||
}*/
|
||||
$enabledisablehtml .= '</span>';
|
||||
|
||||
return $enabledisablehtml;
|
||||
@@ -3952,7 +3953,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
|
||||
* However, one must try to call it only within php pages, classes must return their error through their property "error".
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string|[string] $error String or array of errors strings to show
|
||||
* @param string|string[] $error String or array of errors strings to show
|
||||
* @param array $errors Array of errors
|
||||
* @return void
|
||||
* @see dol_htmloutput_errors()
|
||||
@@ -6691,7 +6692,7 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1)
|
||||
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function.
|
||||
* Note: Prefer to use setEventMessages instead.
|
||||
*
|
||||
* @param string|[string] $mesgs Message string or array
|
||||
* @param string|string[] $mesgs Message string or array
|
||||
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
|
||||
* @return void
|
||||
* @see dol_htmloutput_events()
|
||||
@@ -6700,10 +6701,10 @@ function setEventMessage($mesgs, $style = 'mesgs')
|
||||
{
|
||||
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function
|
||||
if (!is_array($mesgs)) {
|
||||
// If mesgs is a string
|
||||
// If mesgs is a string
|
||||
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;
|
||||
} else {
|
||||
// If mesgs is an array
|
||||
// If mesgs is an array
|
||||
foreach ($mesgs as $mesg)
|
||||
{
|
||||
if ($mesg) $_SESSION['dol_events'][$style][] = $mesg;
|
||||
@@ -8994,8 +8995,7 @@ function addSummaryTableLine($tableColumnCount, $num, $nbofloop = 0, $total = 0,
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a file on output using a lo memory.
|
||||
* It can return very large files with no need of memory.
|
||||
* Return a file on output using a low memory. It can return very large files with no need of memory.
|
||||
* WARNING: This close output buffers.
|
||||
*
|
||||
* @param string $fullpath_original_file_osencoded Full path of file to return.
|
||||
|
||||
@@ -227,12 +227,12 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_creation))
|
||||
{
|
||||
if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($object->user_creation->id) print $object->user_creation->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@@ -261,12 +261,12 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_modification))
|
||||
{
|
||||
if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($object->user_modification->id) print $object->user_modification->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@@ -295,12 +295,12 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_validation))
|
||||
{
|
||||
if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($object->user_validation->id) print $object->user_validation->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@@ -329,12 +329,12 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_approve))
|
||||
{
|
||||
if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($object->user_approve->id) print $object->user_approve->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@@ -363,7 +363,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
else print ': ';
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_approve_id2);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
if ($usetable) print '</td></tr>';
|
||||
else print '<br>';
|
||||
@@ -392,12 +392,12 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_closing))
|
||||
{
|
||||
if ($object->user_closing->id) print $object->user_closing->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($object->user_closing->id) print $object->user_closing->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_closing);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@@ -427,7 +427,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_rappro))
|
||||
{
|
||||
if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0);
|
||||
if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(-1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
@@ -492,7 +492,7 @@ function dolAddEmailTrackId($email, $trackingid)
|
||||
function isValidMailDomain($mail)
|
||||
{
|
||||
list($user, $domain) = explode("@", $mail, 2);
|
||||
return ($domain ? isValidMXRecord($domain, "MX") : 0);
|
||||
return ($domain ? isValidMXRecord($domain) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1641,7 +1641,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
|
||||
$liste[$obj->id.':'.$key] = ($obj->label ? $obj->label : $obj->doc_template_name).' '.$val['name'];
|
||||
}
|
||||
} else {
|
||||
// Common usage
|
||||
// Common usage
|
||||
$liste[$obj->id] = $obj->label ? $obj->label : $obj->doc_template_name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2008-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,20 +18,24 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/geturl.lib.php
|
||||
* \brief This file contains functions dedicated to get URL.
|
||||
* \brief This file contains functions dedicated to get URLs.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function to get a content from an URL (use proxy if proxy defined)
|
||||
* Function to get a content from an URL (use proxy if proxy defined).
|
||||
* Support Dolibarr setup for timeout and proxy.
|
||||
* Enhancement of CURL to add an anti SSRF protection.
|
||||
*
|
||||
* @param string $url URL to call.
|
||||
* @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'DELETE'
|
||||
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED
|
||||
* @param integer $followlocation 1=Follow location, 0=Do not follow
|
||||
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with $postorget='PUTALREADYFORMATED'
|
||||
* @param integer $followlocation 0=Do not follow, 1=Follow location.
|
||||
* @param string[] $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
|
||||
* @param string[] $allowedschemes List of schemes that are allowed ('http' + 'https' only by default)
|
||||
* @param int $localurl 0=Only external URL are possible, 1=Only local URL, 2=Both external and local URL are allowed.
|
||||
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
||||
*/
|
||||
function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array())
|
||||
function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array(), $allowedschemes = array('http', 'https'), $localurl = 0)
|
||||
{
|
||||
//declaring of global variables
|
||||
global $conf;
|
||||
@@ -50,13 +54,14 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
|
||||
print $USE_PROXY."-".$gv_ApiErrorURL."<br>";
|
||||
print $nvpStr;
|
||||
exit;*/
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
|
||||
|
||||
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation ?true:false)); // We use @ here because this may return warning if safe mode is on or open_basedir is on
|
||||
// We use @ here because this may return warning if safe mode is on or open_basedir is on (following location is forbidden when safe mode is on).
|
||||
// We force value to false so we will manage redirection ourself later.
|
||||
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
||||
|
||||
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
|
||||
if (is_array($addheaders) && count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
|
||||
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
|
||||
|
||||
// By default use tls decied by PHP.
|
||||
@@ -64,25 +69,33 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
|
||||
if (!empty($conf->global->MAIN_CURL_SSLVERSION)) curl_setopt($ch, CURLOPT_SSLVERSION, $conf->global->MAIN_CURL_SSLVERSION);
|
||||
//curl_setopt($ch, CURLOPT_SSLVERSION, 6); for tls 1.2
|
||||
|
||||
//turning off the server and peer verification(TrustManager Concept).
|
||||
// Turning off the server and peer verification(TrustManager Concept).
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
||||
// Restrict use to some protocols only
|
||||
$protocols = 0;
|
||||
if (is_array($allowedschemes)) {
|
||||
foreach($allowedschemes as $allowedscheme) {
|
||||
if ($allowedscheme == 'http') $protocols |= CURLPROTO_HTTP;
|
||||
if ($allowedscheme == 'https') $protocols |= CURLPROTO_HTTPS;
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_PROTOCOLS, $protocols);
|
||||
curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, $protocols);
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
|
||||
|
||||
//curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response
|
||||
if ($postorget == 'POST')
|
||||
{
|
||||
if ($postorget == 'POST') {
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // POST
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields
|
||||
} elseif ($postorget == 'POSTALREADYFORMATED')
|
||||
{
|
||||
} elseif ($postorget == 'POSTALREADYFORMATED') {
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); // HTTP request is 'POST' but param string is taken as it is
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string
|
||||
} elseif ($postorget == 'PUT')
|
||||
{
|
||||
} elseif ($postorget == 'PUT') {
|
||||
$array_param = null;
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
|
||||
if (!is_array($param)) parse_str($param, $array_param);
|
||||
@@ -91,32 +104,90 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
|
||||
$array_param = $param;
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields
|
||||
} elseif ($postorget == 'PUTALREADYFORMATED')
|
||||
{
|
||||
} elseif ($postorget == 'PUTALREADYFORMATED') {
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string
|
||||
} elseif ($postorget == 'HEAD')
|
||||
{
|
||||
} elseif ($postorget == 'HEAD') {
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
|
||||
curl_setopt($ch, CURLOPT_NOBODY, true);
|
||||
} elseif ($postorget == 'DELETE')
|
||||
{
|
||||
} elseif ($postorget == 'DELETE') {
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_POST, 0); // GET
|
||||
}
|
||||
|
||||
//if USE_PROXY constant set at begin of this method.
|
||||
if ($USE_PROXY)
|
||||
{
|
||||
if ($USE_PROXY) {
|
||||
dol_syslog("getURLContent set proxy to ".$PROXY_HOST.":".$PROXY_PORT." - ".$PROXY_USER.":".$PROXY_PASS);
|
||||
//curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // Curl 7.10
|
||||
curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT);
|
||||
if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER.":".$PROXY_PASS);
|
||||
}
|
||||
|
||||
//getting response from server
|
||||
$response = curl_exec($ch);
|
||||
$newUrl = $url;
|
||||
$maxRedirection = 5;
|
||||
$info = array();
|
||||
$response = '';
|
||||
|
||||
do
|
||||
{
|
||||
if ($maxRedirection < 1) break;
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $newUrl);
|
||||
|
||||
// Parse $newUrl
|
||||
$newUrlArray = parse_url($newUrl);
|
||||
$hosttocheck = $newUrlArray['host'];
|
||||
$hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6
|
||||
|
||||
if (in_array($hosttocheck, array('localhost', 'localhost.domain'))) {
|
||||
$iptocheck = '127.0.0.1';
|
||||
} else {
|
||||
// TODO Resolve $iptocheck to get an IP and set CURLOPT_CONNECT_TO to use this ip
|
||||
$iptocheck = $hosttocheck;
|
||||
}
|
||||
|
||||
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) { // This is not an IP
|
||||
$iptocheck = 0; //
|
||||
}
|
||||
|
||||
if ($iptocheck) {
|
||||
if ($localurl == 0) { // Only external url allowed (dangerous, may allow to get malware)
|
||||
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
$info['http_code'] = 400;
|
||||
$info['content'] = 'Error bad hostname IP (private or reserved range). Must be an external URL.';
|
||||
break;
|
||||
}
|
||||
if (in_array($iptocheck, array('100.100.100.200'))) {
|
||||
$info['http_code'] = 400;
|
||||
$info['content'] = 'Error bad hostname IP (Used by Alibaba metadata). Must be an external URL.';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($localurl == 1) { // Only local url allowed (dangerous, may allow to get metadata on server or make internal port scanning)
|
||||
if (filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
$info['http_code'] = 400;
|
||||
$info['content'] = 'Error bad hostname. Must be a local URL.';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Getting response from server
|
||||
$response = curl_exec($ch);
|
||||
|
||||
$info = curl_getinfo($ch); // Reading of request must be done after sending request
|
||||
$http_code = $info['http_code'];
|
||||
if ($followlocation && ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307)) {
|
||||
$newUrl = $info['redirect_url'];
|
||||
$maxRedirection--;
|
||||
// TODO Use $info['local_ip'] and $info['primary_ip'] ?
|
||||
continue;
|
||||
} else {
|
||||
$http_code = 0;
|
||||
}
|
||||
}
|
||||
while($http_code);
|
||||
|
||||
$request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
|
||||
|
||||
@@ -136,7 +207,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
|
||||
|
||||
dol_syslog("getURLContent response array is ".join(',', $rep));
|
||||
} else {
|
||||
$info = curl_getinfo($ch);
|
||||
//$info = curl_getinfo($ch);
|
||||
|
||||
// Ad keys to $rep
|
||||
$rep = $info;
|
||||
@@ -148,11 +219,11 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
|
||||
$rep['content'] = $response;
|
||||
$rep['curl_error_no'] = '';
|
||||
$rep['curl_error_msg'] = '';
|
||||
|
||||
//closing the curl
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
//closing the curl
|
||||
curl_close($ch);
|
||||
|
||||
return $rep;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
*/
|
||||
function loan_prepare_head($object)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$tab = 0;
|
||||
$head = array();
|
||||
$tab = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/card.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans('Card');
|
||||
@@ -47,17 +47,17 @@ function loan_prepare_head($object)
|
||||
$head[$tab][2] = 'FinancialCommitment';
|
||||
$tab++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan');
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->loan->dir_output."/".dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
@@ -73,14 +73,14 @@ function loan_prepare_head($object)
|
||||
$tab++;
|
||||
}
|
||||
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Info");
|
||||
$head[$tab][2] = 'info';
|
||||
$tab++;
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Info");
|
||||
$head[$tab][2] = 'info';
|
||||
$tab++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove');
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove');
|
||||
|
||||
return $head;
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,42 +95,42 @@ function loan_prepare_head($object)
|
||||
*/
|
||||
function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
|
||||
{
|
||||
global $conf, $db;
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||
$object = new LoanSchedule($db);
|
||||
$output = array();
|
||||
global $conf, $db;
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||
$object = new LoanSchedule($db);
|
||||
$output = array();
|
||||
|
||||
// If mensuality is 0 we don't pay interests and remaining capital not modified
|
||||
if ($mens == 0) {
|
||||
$int = 0;
|
||||
$cap_rest = $capital;
|
||||
} else {
|
||||
$int = ($capital * ($rate / 12));
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
|
||||
// If mensuality is 0 we don't pay interests and remaining capital not modified
|
||||
if ($mens == 0) {
|
||||
$int = 0;
|
||||
$cap_rest = $capital;
|
||||
} else {
|
||||
$int = ($capital * ($rate / 12));
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
|
||||
|
||||
$echance++;
|
||||
$capital = $cap_rest;
|
||||
while ($echance <= $nbterm) {
|
||||
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
|
||||
$echance++;
|
||||
$capital = $cap_rest;
|
||||
while ($echance <= $nbterm) {
|
||||
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
|
||||
|
||||
$int = ($capital * ($rate / 12));
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
$int = ($capital * ($rate / 12));
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
|
||||
$output[$echance] = array(
|
||||
'cap_rest' => $cap_rest,
|
||||
'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency),
|
||||
'interet' => $int,
|
||||
'interet_str' => price($int, 0, '', 1, -1, -1, $conf->currency),
|
||||
'mens' => $mens,
|
||||
);
|
||||
$output[$echance] = array(
|
||||
'cap_rest' => $cap_rest,
|
||||
'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency),
|
||||
'interet' => $int,
|
||||
'interet_str' => price($int, 0, '', 1, -1, -1, $conf->currency),
|
||||
'mens' => $mens,
|
||||
);
|
||||
|
||||
$capital = $cap_rest;
|
||||
$echance++;
|
||||
}
|
||||
$capital = $cap_rest;
|
||||
$echance++;
|
||||
}
|
||||
|
||||
return $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ function show_stats_for_company($product, $socid)
|
||||
print '<td class="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Customer proposals
|
||||
// Customer proposals
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
$nblines++;
|
||||
@@ -509,7 +509,6 @@ function show_stats_for_company($product, $socid)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// MO
|
||||
if (!empty($conf->mrp->enabled) && $user->rights->mrp->read)
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ function report_header($reportname, $notused, $period, $periodlink, $description
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@ function user_prepare_head($object)
|
||||
$langs->load("users");
|
||||
|
||||
$canreadperms = true;
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
$canreadperms = ($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
|
||||
}
|
||||
|
||||
@@ -52,8 +51,7 @@ function user_prepare_head($object)
|
||||
$h++;
|
||||
|
||||
if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
|
||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin)))
|
||||
{
|
||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) {
|
||||
$langs->load("ldap");
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("LDAPCard");
|
||||
@@ -61,8 +59,7 @@ function user_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($canreadperms)
|
||||
{
|
||||
if ($canreadperms) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Rights").(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>' : '');
|
||||
$head[$h][2] = 'rights';
|
||||
@@ -74,15 +71,13 @@ function user_prepare_head($object)
|
||||
$head[$h][2] = 'guisetup';
|
||||
$h++;
|
||||
|
||||
if (!empty($conf->agenda->enabled))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
|
||||
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
|
||||
|
||||
$i = 1;
|
||||
$nbagenda = 0;
|
||||
while ($i <= $MAXAGENDA)
|
||||
{
|
||||
while ($i <= $MAXAGENDA) {
|
||||
$key = $i;
|
||||
$name = 'AGENDA_EXT_NAME_'.$object->id.'_'.$key;
|
||||
$src = 'AGENDA_EXT_SRC_'.$object->id.'_'.$key;
|
||||
@@ -99,8 +94,7 @@ function user_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (!empty($conf->clicktodial->enabled))
|
||||
{
|
||||
if (!empty($conf->clicktodial->enabled)) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ClickToDial");
|
||||
$head[$h][2] = 'clicktodial';
|
||||
@@ -108,19 +102,16 @@ function user_prepare_head($object)
|
||||
}
|
||||
|
||||
// Notifications
|
||||
if ($user->socid == 0 && !empty($conf->notification->enabled))
|
||||
{
|
||||
if ($user->socid == 0 && !empty($conf->notification->enabled)) {
|
||||
$nbNote = 0;
|
||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
|
||||
$sql .= " WHERE fk_user = ".$object->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbNote = $obj->nb;
|
||||
$i++;
|
||||
@@ -147,8 +138,7 @@ function user_prepare_head($object)
|
||||
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))
|
||||
|| (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
|
||||
|| (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all))
|
||||
)
|
||||
{
|
||||
) {
|
||||
// Bank
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("HRAndBank");
|
||||
@@ -157,8 +147,7 @@ function user_prepare_head($object)
|
||||
}
|
||||
|
||||
// Such info on users is visible only by internal user
|
||||
if (empty($user->socid))
|
||||
{
|
||||
if (empty($user->socid)) {
|
||||
// Notes
|
||||
$nbNote = 0;
|
||||
if (!empty($object->note)) $nbNote++;
|
||||
@@ -202,8 +191,7 @@ function group_prepare_head($object)
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$canreadperms = true;
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
$canreadperms = ($user->admin || $user->rights->user->group_advance->readperms);
|
||||
}
|
||||
|
||||
@@ -216,8 +204,7 @@ function group_prepare_head($object)
|
||||
$h++;
|
||||
|
||||
if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
|
||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin)))
|
||||
{
|
||||
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) {
|
||||
$langs->load("ldap");
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("LDAPCard");
|
||||
@@ -225,8 +212,7 @@ function group_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($canreadperms)
|
||||
{
|
||||
if ($canreadperms) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("GroupRights").'<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>';
|
||||
$head[$h][2] = 'rights';
|
||||
@@ -305,10 +291,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
$formother = new FormOther($db);
|
||||
|
||||
$dirthemes = array('/theme');
|
||||
if (!empty($conf->modules_parts['theme'])) // Using this feature slow down application
|
||||
{
|
||||
foreach ($conf->modules_parts['theme'] as $reldir)
|
||||
{
|
||||
if (!empty($conf->modules_parts['theme'])) { // Using this feature slow down application
|
||||
foreach ($conf->modules_parts['theme'] as $reldir) {
|
||||
$dirthemes = array_merge($dirthemes, (array) ($reldir.'theme'));
|
||||
}
|
||||
}
|
||||
@@ -334,8 +318,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<table class="noborder centpercent'.($edit ? ' editmode' : '').' tableforfield">';
|
||||
|
||||
// Title
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
|
||||
print '<th colspan="2"> </th>';
|
||||
print '</tr>';
|
||||
@@ -348,8 +331,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '</tr>';
|
||||
} else {
|
||||
$dirthemestring = '';
|
||||
foreach ($dirthemes as $dirtheme)
|
||||
{
|
||||
foreach ($dirthemes as $dirtheme) {
|
||||
$dirthemestring .= '"'.$dirtheme.'" ';
|
||||
}
|
||||
|
||||
@@ -369,22 +351,17 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
|
||||
|
||||
$i = 0;
|
||||
foreach ($dirthemes as $dir)
|
||||
{
|
||||
foreach ($dirthemes as $dir) {
|
||||
//print $dirroot.$dir;exit;
|
||||
$dirtheme = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
|
||||
$urltheme = dol_buildpath($dir, 1);
|
||||
|
||||
if (is_dir($dirtheme))
|
||||
{
|
||||
if (is_dir($dirtheme)) {
|
||||
$handle = opendir($dirtheme);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($subdir = readdir($handle)) !== false)
|
||||
{
|
||||
if (is_resource($handle)) {
|
||||
while (($subdir = readdir($handle)) !== false) {
|
||||
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
||||
&& substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir))
|
||||
{
|
||||
&& substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
|
||||
// Disable not stable themes (dir ends with _exp or _dev)
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue;
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue;
|
||||
@@ -398,8 +375,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
else $title = $langs->trans("ShowPreview");
|
||||
print '<img class="img-skinthumb shadow" src="'.$url.'" alt="'.$title.'" title="'.$title.'" style="border: none; margin-bottom: 5px;">';
|
||||
print '</a><br>';
|
||||
if ($subdir == $selected_theme)
|
||||
{
|
||||
if ($subdir == $selected_theme) {
|
||||
print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
|
||||
} else {
|
||||
print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
|
||||
@@ -435,14 +411,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Show logo
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
// Nothing
|
||||
} else {
|
||||
// Show logo
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableShowLogo").'</td><td>';
|
||||
if ($edit)
|
||||
{
|
||||
if ($edit) {
|
||||
print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
|
||||
//print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
|
||||
} else {
|
||||
@@ -457,8 +431,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
|
||||
|
||||
// TopMenuDisableImages
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
|
||||
@@ -469,7 +442,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td>';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''),'THEME_TOPMENU_DISABLE_IMAGE','formcolor',1).' ';
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''),'THEME_TOPMENU_DISABLE_IMAGE','',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -484,8 +457,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
if ($edit) {
|
||||
print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1);
|
||||
//print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
|
||||
} else {
|
||||
@@ -498,8 +470,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Background color THEME_ELDY_BACKBODY
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
@@ -510,7 +481,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td>';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -525,9 +496,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td>'.$langs->trans("BackgroundColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
//var_dump($conf->global->THEME_ELDY_BACKBODY);
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', 'formcolor', 1, '', '', 'colorbackbody').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
|
||||
} else {
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
@@ -540,8 +510,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// TopMenuBackgroundColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
@@ -552,7 +521,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td>';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -568,9 +537,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', 'formcolor', 1, '', '', 'colorbackhmenu1').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
|
||||
} else {
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
@@ -583,8 +551,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// LeftMenuBackgroundColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
@@ -595,7 +562,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td>';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -611,9 +578,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', 'formcolor', 1, '', '', 'colorbackvmenu1').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
|
||||
} else {
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
@@ -626,17 +592,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// TextTitleColor for title of Pages
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
} else {
|
||||
$default = (empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TextTitleColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', 'formcolor', 1, '', '', 'colortexttitlenotab').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
|
||||
} else {
|
||||
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
|
||||
}
|
||||
@@ -648,17 +612,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// BackgroundTableTitleColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
} else {
|
||||
$default = (empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', 'formcolor', 1, '', '', 'colorbacktitle1').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
|
||||
} else {
|
||||
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
|
||||
}
|
||||
@@ -670,17 +632,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// TextTitleColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
} else {
|
||||
$default = (empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', 'formcolor', 1, '', '', 'colortexttitle').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
|
||||
} else {
|
||||
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
|
||||
}
|
||||
@@ -692,17 +652,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// TextTitleLinkColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
} else {
|
||||
$default=(empty($colortexttitlelink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlelink)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', 'formcolor', 1, '', '', 'colortexttitlelink').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
|
||||
} else {
|
||||
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
|
||||
}
|
||||
@@ -715,17 +673,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// BackgroundTableLineOddColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
} else {
|
||||
$default = (empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', 'formcolor', 1, '', '', 'colorbacklinepair2').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
|
||||
} else {
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
@@ -738,17 +694,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// BackgroundTableLineEvenColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
} else {
|
||||
$default = (empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1)));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', 'formcolor', 1, '', '', 'colorbacklineimpair2').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
|
||||
} else {
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
@@ -761,8 +715,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Text LinkColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
@@ -773,7 +726,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td>';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -789,9 +742,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("LinkColor").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', 'formcolor', 1, '', '', 'colortextlink').' ';
|
||||
if ($edit) {
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
|
||||
} else {
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
@@ -808,8 +760,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Use Hover
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
/* Must first change option to choose color of highlight instead of yes or no.
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
|
||||
@@ -828,16 +779,14 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
|
||||
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
if ($edit)
|
||||
{
|
||||
if ($edit) {
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
|
||||
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1, '', '', 'colorbacklinepairhover').' ';
|
||||
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' ';
|
||||
} else {
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
|
||||
if ($color)
|
||||
{
|
||||
if ($color) {
|
||||
if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
} else print $langs->trans("Default");
|
||||
@@ -848,8 +797,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Use Checked
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
/* Must first change option to choose color of highlight instead of yes or no.
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
|
||||
@@ -868,16 +816,14 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
|
||||
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
if ($edit)
|
||||
{
|
||||
if ($edit) {
|
||||
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
|
||||
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', 'formcolor', 1, '', '', 'colorbacklinepairchecked').' ';
|
||||
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' ';
|
||||
} else {
|
||||
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
|
||||
if ($color)
|
||||
{
|
||||
if ($color) {
|
||||
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
} else print $langs->trans("Default");
|
||||
@@ -889,20 +835,17 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Use MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
|
||||
$default = $langs->trans('No');
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
//print ajax_constantonoff("MAIN_OPTIMIZEFORTEXTBROWSER", array(), null, 0, 0, 1, 0);
|
||||
if ($edit)
|
||||
{
|
||||
if ($edit) {
|
||||
print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER, 1);
|
||||
} else {
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
print yn($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER);
|
||||
} else {
|
||||
print yn(1);
|
||||
@@ -937,8 +880,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
|
||||
|
||||
// Use MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
if ($foruserprofile)
|
||||
{
|
||||
if ($foruserprofile) {
|
||||
//$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
|
||||
$default = $langs->trans('No');
|
||||
print '<tr class="oddeven">';
|
||||
@@ -953,8 +895,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
'tritanopes' => $langs->trans('Tritanopes'),
|
||||
);
|
||||
|
||||
if ($edit)
|
||||
{
|
||||
if ($edit) {
|
||||
print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND, 0);
|
||||
} else {
|
||||
if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])) {
|
||||
|
||||
@@ -320,7 +320,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@@ -320,7 +320,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@@ -31,15 +31,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/project/task/modules_task.php';
|
||||
class mod_task_universal extends ModeleNumRefTask
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
@@ -54,17 +54,17 @@ class mod_task_universal extends ModeleNumRefTask
|
||||
public $name = 'Universal';
|
||||
|
||||
|
||||
/**
|
||||
* Returns the description of the numbering model
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
/**
|
||||
* Returns the description of the numbering model
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("projects", "admin"));
|
||||
$langs->loadLangs(array("projects", "admin"));
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@@ -93,37 +93,37 @@ class mod_task_universal extends ModeleNumRefTask
|
||||
$texte .= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
/**
|
||||
* Return an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
$old_code_client = $mysoc->code_client;
|
||||
$mysoc->code_client = 'CCCCCCCCCC';
|
||||
$numExample = $this->getNextValue($mysoc, '');
|
||||
$old_code_client = $mysoc->code_client;
|
||||
$mysoc->code_client = 'CCCCCCCCCC';
|
||||
$numExample = $this->getNextValue($mysoc, '');
|
||||
$mysoc->code_client = $old_code_client;
|
||||
|
||||
if (!$numExample) {
|
||||
$numExample = $langs->trans('NotConfigured');
|
||||
}
|
||||
return $numExample;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Task $object Object task
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
{
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Task $object Object task
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
@@ -143,17 +143,17 @@ class mod_task_universal extends ModeleNumRefTask
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return next reference not yet used as a reference
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Task $object Object task
|
||||
* @return string Next not used reference
|
||||
*/
|
||||
public function project_get_num($objsoc = 0, $object = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
return $this->getNextValue($objsoc, $object);
|
||||
}
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return next reference not yet used as a reference
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Task $object Object task
|
||||
* @return string Next not used reference
|
||||
*/
|
||||
public function project_get_num($objsoc = 0, $object = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
return $this->getNextValue($objsoc, $object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@@ -323,7 +323,7 @@ class doc_generic_stock_odt extends ModelePDFStock
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@@ -312,7 +312,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
|
||||
'__FROM_EMAIL__' => $this->issuer->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@@ -349,7 +349,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@@ -115,9 +115,9 @@ class mod_ticket_simple extends ModeleNumRefTicket
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Project $ticket Object ticket
|
||||
* @return string Value if OK, 0 if KO
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Ticket $ticket Object ticket
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
public function getNextValue($objsoc, $ticket)
|
||||
{
|
||||
|
||||
@@ -116,9 +116,9 @@ class mod_ticket_universal extends ModeleNumRefTicket
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Project $ticket Object ticket
|
||||
* @return string Value if OK, 0 if KO
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Ticket $ticket Object ticket
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
public function getNextValue($objsoc, $ticket)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ class mod_ticket_universal extends ModeleNumRefTicket
|
||||
return 0;
|
||||
}
|
||||
|
||||
$date = empty($ticket->date_c) ? dol_now() : $ticket->datec;
|
||||
$date = empty($ticket->datec) ? dol_now() : $ticket->datec;
|
||||
$numFinal = get_next_value($db, $mask, 'ticket', 'ref', '', $objsoc->code_client, $date);
|
||||
|
||||
return $numFinal;
|
||||
|
||||
@@ -330,7 +330,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
@@ -211,7 +211,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php<br>Contact:con
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
<?php dol_fiche_end(); ?>
|
||||
<?php print dol_get_fiche_end(); ?>
|
||||
|
||||
<div class="center"><input type="submit" name="button" class="button" value="<?php echo $langs->trans("Save"); ?>">
|
||||
<input type="submit" name="button" class="button" value="<?php echo $langs->trans("Cancel"); ?>"></div>
|
||||
|
||||
@@ -298,7 +298,7 @@ if (in_array($type, array_keys($typewecanchangeinto)))
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
<?php dol_fiche_end(); ?>
|
||||
<?php print dol_get_fiche_end(); ?>
|
||||
|
||||
<div class="center"><input type="submit" name="button" class="button" value="<?php echo $langs->trans("Save"); ?>">
|
||||
<input type="submit" name="button" class="button" value="<?php echo $langs->trans("Cancel"); ?>"></div>
|
||||
|
||||
@@ -292,5 +292,5 @@ if ($action == 'presend')
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
print dol_get_fiche_end();
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ if ($permission)
|
||||
<?php
|
||||
$tmpobject = $object;
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc;
|
||||
echo $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal');
|
||||
$formcompany->selectTypeContact($tmpobject, '', 'type', 'internal');
|
||||
?></div>
|
||||
<div class="tagtd"> </div>
|
||||
<div class="tagtd center"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div>
|
||||
@@ -117,8 +117,7 @@ if ($permission)
|
||||
<?php
|
||||
}
|
||||
|
||||
if (empty($hideaddcontactforthirdparty))
|
||||
{
|
||||
if (empty($hideaddcontactforthirdparty)) {
|
||||
?>
|
||||
|
||||
<form class="tagtr pair nohover" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
||||
|
||||
@@ -52,7 +52,14 @@ $arrayofjs = array(
|
||||
'/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)),
|
||||
'/core/js/dst.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION))
|
||||
);
|
||||
$titleofloginpage = $langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version.
|
||||
|
||||
// We display application title instead Login term
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$titleofloginpage = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
} else {
|
||||
$titleofloginpage = $langs->trans('Login');
|
||||
}
|
||||
$titleofloginpage.= ' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version.
|
||||
|
||||
$disablenofollow = 1;
|
||||
if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow = 0;
|
||||
@@ -290,9 +297,9 @@ if (!empty($_SESSION['dol_loginmesg']))
|
||||
if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (substr($langs->defaultlang, 0, 2) == 'fr') {
|
||||
$resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/");
|
||||
$resgetcommitstrip = getURLContent("https://www.commitstrip.com/fr/feed/");
|
||||
} else {
|
||||
$resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/");
|
||||
$resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
|
||||
}
|
||||
if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200')
|
||||
{
|
||||
|
||||
@@ -160,7 +160,7 @@ if ($massaction == 'presend')
|
||||
print $formmail->get_form();
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
print dol_get_fiche_end();
|
||||
}
|
||||
// Allow Pre-Mass-Action hook (eg for confirmation dialog)
|
||||
$parameters = array(
|
||||
|
||||
@@ -70,8 +70,19 @@ abstract class DolibarrTriggers
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* @var string module is in development
|
||||
*/
|
||||
const VERSION_DEVELOPMENT = 'development';
|
||||
|
||||
/**
|
||||
* @var string module is experimental
|
||||
*/
|
||||
const VERSION_EXPERIMENTAL = 'experimental';
|
||||
|
||||
/**
|
||||
* @var string module is dolibarr ready
|
||||
*/
|
||||
const VERSION_DOLIBARR = 'dolibarr';
|
||||
|
||||
/**
|
||||
@@ -84,8 +95,7 @@ abstract class DolibarrTriggers
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($this->name))
|
||||
{
|
||||
if (empty($this->name)) {
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,20 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceLogevents extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'technic';
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
public $family = 'core';
|
||||
|
||||
public $description = "Triggers of this module allows to add security event records inside Dolibarr.";
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "core";
|
||||
$this->description = "Triggers of this module allows to add security event records inside Dolibarr.";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'technic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr security audit event is done.
|
||||
@@ -70,8 +72,7 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
$date = dol_now();
|
||||
|
||||
// Actions
|
||||
if ($action == 'USER_LOGIN')
|
||||
{
|
||||
if ($action == 'USER_LOGIN') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$langs->load("users");
|
||||
@@ -80,89 +81,72 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
$text .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
|
||||
$desc = "(UserLogged,".$object->login.")";
|
||||
$desc .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
|
||||
}
|
||||
if ($action == 'USER_LOGIN_FAILED')
|
||||
{
|
||||
} elseif ($action == 'USER_LOGIN_FAILED') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = $object->trigger_mesg; // Message direct
|
||||
$desc = $object->trigger_mesg; // Message direct
|
||||
}
|
||||
if ($action == 'USER_LOGOUT')
|
||||
{
|
||||
} elseif ($action == 'USER_LOGOUT') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = "(UserLogoff,".$object->login.")";
|
||||
$desc = "(UserLogoff,".$object->login.")";
|
||||
}
|
||||
if ($action == 'USER_CREATE')
|
||||
{
|
||||
} elseif ($action == 'USER_CREATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = $langs->transnoentities("NewUserCreated", $object->login);
|
||||
$desc = $langs->transnoentities("NewUserCreated", $object->login);
|
||||
} elseif ($action == 'USER_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'USER_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = $langs->transnoentities("EventUserModified", $object->login);
|
||||
$desc = $langs->transnoentities("EventUserModified", $object->login);
|
||||
} elseif ($action == 'USER_NEW_PASSWORD')
|
||||
{
|
||||
} elseif ($action == 'USER_NEW_PASSWORD') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = $langs->transnoentities("NewUserPassword", $object->login);
|
||||
$desc = $langs->transnoentities("NewUserPassword", $object->login);
|
||||
} elseif ($action == 'USER_ENABLEDISABLE')
|
||||
{
|
||||
} elseif ($action == 'USER_ENABLEDISABLE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
if ($object->statut == 0) {
|
||||
$text = $langs->transnoentities("UserEnabled", $object->login);
|
||||
$desc = $langs->transnoentities("UserEnabled", $object->login);
|
||||
}
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
if ($object->statut == 1) {
|
||||
$text = $langs->transnoentities("UserDisabled", $object->login);
|
||||
$desc = $langs->transnoentities("UserDisabled", $object->login);
|
||||
}
|
||||
} elseif ($action == 'USER_DELETE')
|
||||
{
|
||||
} elseif ($action == 'USER_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = $langs->transnoentities("UserDeleted", $object->login);
|
||||
$desc = $langs->transnoentities("UserDeleted", $object->login);
|
||||
}
|
||||
|
||||
// Groupes
|
||||
elseif ($action == 'USERGROUP_CREATE')
|
||||
{
|
||||
} elseif ($action == 'USERGROUP_CREATE') {
|
||||
// Groups
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = $langs->transnoentities("NewGroupCreated", $object->name);
|
||||
$desc = $langs->transnoentities("NewGroupCreated", $object->name);
|
||||
} elseif ($action == 'USERGROUP_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'USERGROUP_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text = $langs->transnoentities("GroupModified", $object->name);
|
||||
$desc = $langs->transnoentities("GroupModified", $object->name);
|
||||
} elseif ($action == 'USERGROUP_DELETE')
|
||||
{
|
||||
} elseif ($action == 'USERGROUP_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
@@ -193,8 +177,7 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
$event->user_agent = $_SERVER["HTTP_USER_AGENT"];
|
||||
|
||||
$result = $event->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
return 1;
|
||||
} else {
|
||||
$error = "Failed to insert security event: ".$event->error;
|
||||
|
||||
@@ -32,19 +32,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
|
||||
class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'technic';
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
public $family = 'core';
|
||||
public $description = "Triggers of this module allows to manage workflows";
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "core";
|
||||
$this->description = "Triggers of this module allows to manage workflows";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'technic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
@@ -62,11 +65,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing
|
||||
|
||||
// Proposals to order
|
||||
if ($action == 'PROPAL_CLOSE_SIGNED')
|
||||
{
|
||||
if ($action == 'PROPAL_CLOSE_SIGNED') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER))
|
||||
{
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$newobject = new Commande($this->db);
|
||||
|
||||
@@ -81,11 +82,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Order to invoice
|
||||
if ($action == 'ORDER_CLOSE')
|
||||
{
|
||||
if ($action == 'ORDER_CLOSE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE))
|
||||
{
|
||||
if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$newobject = new Facture($this->db);
|
||||
|
||||
@@ -100,24 +99,18 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Order classify billed proposal
|
||||
if ($action == 'ORDER_CLASSIFY_BILLED')
|
||||
{
|
||||
if ($action == 'ORDER_CLASSIFY_BILLED') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL))
|
||||
{
|
||||
if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL)) {
|
||||
$object->fetchObjectLinked('', 'propal', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects))
|
||||
{
|
||||
if (!empty($object->linkedObjects)) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['propal'] as $element)
|
||||
{
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
|
||||
{
|
||||
foreach ($object->linkedObjects['propal'] as $element)
|
||||
{
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
$ret = $element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
@@ -127,27 +120,21 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// classify billed order & billed propososal
|
||||
if ($action == 'BILL_VALIDATE')
|
||||
{
|
||||
if ($action == 'BILL_VALIDATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$ret = 0;
|
||||
|
||||
// First classify billed the order to allow the proposal classify process
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
|
||||
{
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) {
|
||||
$object->fetchObjectLinked('', 'commande', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects))
|
||||
{
|
||||
if (!empty($object->linkedObjects)) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
|
||||
{
|
||||
foreach ($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
$ret = $element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
@@ -155,21 +142,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Second classify billed the proposal.
|
||||
if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL))
|
||||
{
|
||||
if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL)) {
|
||||
$object->fetchObjectLinked('', 'propal', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects))
|
||||
{
|
||||
if (!empty($object->linkedObjects)) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['propal'] as $element)
|
||||
{
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
|
||||
{
|
||||
foreach ($object->linkedObjects['propal'] as $element)
|
||||
{
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['propal'] as $element) {
|
||||
$ret = $element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
@@ -180,26 +162,20 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// classify billed order & billed propososal
|
||||
if ($action == 'BILL_SUPPLIER_VALIDATE')
|
||||
{
|
||||
if ($action == 'BILL_SUPPLIER_VALIDATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// First classify billed the order to allow the proposal classify process
|
||||
if (!empty($conf->fournisseur->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER))
|
||||
{
|
||||
if (!empty($conf->fournisseur->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) {
|
||||
$object->fetchObjectLinked('', 'order_supplier', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects))
|
||||
{
|
||||
if (!empty($object->linkedObjects)) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['order_supplier'] as $element)
|
||||
{
|
||||
foreach ($object->linkedObjects['order_supplier'] as $element) {
|
||||
if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
|
||||
{
|
||||
foreach ($object->linkedObjects['order_supplier'] as $element)
|
||||
{
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['order_supplier'] as $element) {
|
||||
$ret = $element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
@@ -208,21 +184,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Second classify billed the proposal.
|
||||
if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL))
|
||||
{
|
||||
if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) {
|
||||
$object->fetchObjectLinked('', 'supplier_proposal', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects))
|
||||
{
|
||||
if (!empty($object->linkedObjects)) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['supplier_proposal'] as $element)
|
||||
{
|
||||
foreach ($object->linkedObjects['supplier_proposal'] as $element) {
|
||||
if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
|
||||
{
|
||||
foreach ($object->linkedObjects['supplier_proposal'] as $element)
|
||||
{
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['supplier_proposal'] as $element) {
|
||||
$ret = $element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
@@ -232,25 +203,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Invoice classify billed order
|
||||
if ($action == 'BILL_PAYED')
|
||||
{
|
||||
if ($action == 'BILL_PAYED') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER))
|
||||
{
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) {
|
||||
$object->fetchObjectLinked('', 'commande', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects))
|
||||
{
|
||||
if (!empty($object->linkedObjects)) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
|
||||
{
|
||||
foreach ($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||
foreach ($object->linkedObjects['commande'] as $element) {
|
||||
$ret = $element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
@@ -259,12 +224,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'SHIPPING_VALIDATE')
|
||||
{
|
||||
if ($action == 'SHIPPING_VALIDATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING))
|
||||
{
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) {
|
||||
$qtyshipped = array();
|
||||
$qtyordred = array();
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@@ -318,25 +281,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
// classify billed reception
|
||||
if ($action == 'BILL_SUPPLIER_VALIDATE')
|
||||
{
|
||||
if ($action == 'BILL_SUPPLIER_VALIDATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
||||
|
||||
if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION))
|
||||
{
|
||||
if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
|
||||
$object->fetchObjectLinked('', 'reception', $object->id, $object->element);
|
||||
if (!empty($object->linkedObjects))
|
||||
{
|
||||
if (!empty($object->linkedObjects)) {
|
||||
$totalonlinkedelements = 0;
|
||||
foreach ($object->linkedObjects['reception'] as $element)
|
||||
{
|
||||
foreach ($object->linkedObjects['reception'] as $element) {
|
||||
if ($element->statut == Reception::STATUS_VALIDATED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if ($totalonlinkedelements == $object->total_ht)
|
||||
{
|
||||
foreach ($object->linkedObjects['reception'] as $element)
|
||||
{
|
||||
if ($totalonlinkedelements == $object->total_ht) {
|
||||
foreach ($object->linkedObjects['reception'] as $element) {
|
||||
$ret = $element->set_billed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,19 +34,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceActionsAuto extends DolibarrTriggers
|
||||
{
|
||||
public $family = 'agenda';
|
||||
public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
|
||||
/**
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'action';
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "agenda";
|
||||
$this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'action';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
@@ -87,8 +90,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
if (empty($object->actiontypecode)) $object->actiontypecode = 'AC_OTH_AUTO';
|
||||
|
||||
// Actions
|
||||
if ($action == 'COMPANY_CREATE')
|
||||
{
|
||||
if ($action == 'COMPANY_CREATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "companies"));
|
||||
|
||||
@@ -97,8 +99,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$object->sendtoid = 0;
|
||||
$object->socid = $object->id;
|
||||
} elseif ($action == 'COMPANY_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'COMPANY_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -106,8 +107,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'CONTACT_CREATE')
|
||||
{
|
||||
} elseif ($action == 'CONTACT_CREATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "companies"));
|
||||
|
||||
@@ -116,8 +116,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$object->sendtoid = array($object->id => $object->id);
|
||||
$object->socid = $object->socid;
|
||||
} elseif ($action == 'CONTRACT_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'CONTRACT_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "contracts"));
|
||||
|
||||
@@ -125,21 +124,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'CONTRACT_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'CONTRACT_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "contracts"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("ContractSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'PROPAL_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'PROPAL_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
@@ -147,21 +143,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROPAL_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'PROPAL_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'PROPAL_CLOSE_SIGNED')
|
||||
{
|
||||
} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
@@ -169,8 +162,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROPAL_CLASSIFY_BILLED')
|
||||
{
|
||||
} elseif ($action == 'PROPAL_CLASSIFY_BILLED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
@@ -178,8 +170,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROPAL_CLOSE_REFUSED')
|
||||
{
|
||||
} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
@@ -187,8 +178,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'ORDER_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "orders"));
|
||||
|
||||
@@ -196,8 +186,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_CLOSE')
|
||||
{
|
||||
} elseif ($action == 'ORDER_CLOSE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -205,8 +194,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_CLASSIFY_BILLED')
|
||||
{
|
||||
} elseif ($action == 'ORDER_CLASSIFY_BILLED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -214,8 +202,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_CANCEL')
|
||||
{
|
||||
} elseif ($action == 'ORDER_CANCEL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -223,21 +210,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("OrderSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'BILL_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'BILL_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -245,8 +229,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'BILL_UNVALIDATE')
|
||||
{
|
||||
} elseif ($action == 'BILL_UNVALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -254,21 +237,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'BILL_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'BILL_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'BILL_PAYED')
|
||||
{
|
||||
} elseif ($action == 'BILL_PAYED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -277,8 +257,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'BILL_CANCEL')
|
||||
{
|
||||
} elseif ($action == 'BILL_CANCEL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -286,8 +265,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'FICHINTER_CREATE')
|
||||
{
|
||||
} elseif ($action == 'FICHINTER_CREATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
|
||||
@@ -297,8 +275,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = 0;
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'FICHINTER_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'FICHINTER_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
|
||||
@@ -308,8 +285,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = 0;
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'FICHINTER_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'FICHINTER_MODIFY') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
|
||||
@@ -319,21 +295,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = 0;
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'FICHINTER_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'FICHINTER_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("InterventionSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
|
||||
{
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_BILLED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
|
||||
@@ -341,8 +314,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED')
|
||||
{
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
|
||||
@@ -350,8 +322,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'FICHINTER_DELETE')
|
||||
{
|
||||
} elseif ($action == 'FICHINTER_DELETE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
|
||||
@@ -361,62 +332,53 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = 0;
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'SHIPPING_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'SHIPPING_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "sendings"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'SHIPPING_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'SHIPPING_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "sendings"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("ShippingSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'RECEPTION_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'RECEPTION_VALIDATE') {
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("receptions");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'RECEPTION_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'RECEPTION_SENTBYMAIL') {
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("receptions");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
@@ -424,21 +386,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED')
|
||||
{
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
@@ -446,8 +405,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED')
|
||||
{
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
|
||||
@@ -455,8 +413,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CREATE')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CREATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -464,8 +421,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -473,8 +429,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_APPROVE')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_APPROVE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -482,8 +437,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_REFUSE')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_REFUSE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -491,8 +445,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SUBMIT')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SUBMIT') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -500,8 +453,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_RECEIVE')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_RECEIVE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
|
||||
@@ -509,33 +461,28 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills", "orders"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED')
|
||||
{
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills", "orders"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
|
||||
}
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'BILL_SUPPLIER_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'BILL_SUPPLIER_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -543,8 +490,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'BILL_SUPPLIER_UNVALIDATE')
|
||||
{
|
||||
} elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -552,21 +498,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
|
||||
{
|
||||
} elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills", "orders"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
if (empty($object->actionmsg)) {
|
||||
$object->actionmsg = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'BILL_SUPPLIER_PAYED')
|
||||
{
|
||||
} elseif ($action == 'BILL_SUPPLIER_PAYED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -574,8 +517,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'BILL_SUPPLIER_CANCELED')
|
||||
{
|
||||
} elseif ($action == 'BILL_SUPPLIER_CANCELED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -586,8 +528,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Members
|
||||
elseif ($action == 'MEMBER_VALIDATE')
|
||||
{
|
||||
elseif ($action == 'MEMBER_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
|
||||
@@ -597,8 +538,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'MEMBER_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_MODIFY') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
|
||||
@@ -608,14 +548,12 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
|
||||
$member = $this->context['member'];
|
||||
if (!is_object($member)) // This should not happen
|
||||
{
|
||||
if (!is_object($member)) { // This should not happen
|
||||
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$member = new Adherent($this->db);
|
||||
$member->fetch($this->fk_adherent);
|
||||
@@ -630,14 +568,12 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$object->sendtoid = 0;
|
||||
if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
|
||||
$member = $this->context['member'];
|
||||
if (!is_object($member)) // This should not happen
|
||||
{
|
||||
if (!is_object($member)) { // This should not happen
|
||||
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$member = new Adherent($this->db);
|
||||
$member->fetch($this->fk_adherent);
|
||||
@@ -652,8 +588,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$object->sendtoid = 0;
|
||||
if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
|
||||
@@ -666,8 +601,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$object->sendtoid = 0;
|
||||
if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
|
||||
} elseif ($action == 'MEMBER_RESILIATE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_RESILIATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
|
||||
@@ -677,8 +611,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'MEMBER_DELETE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_DELETE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
|
||||
@@ -691,8 +624,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Projects
|
||||
elseif ($action == 'PROJECT_CREATE')
|
||||
{
|
||||
elseif ($action == 'PROJECT_CREATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -701,8 +633,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROJECT_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'PROJECT_VALIDATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -711,8 +642,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROJECT_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'PROJECT_MODIFY') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -724,8 +654,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Project tasks
|
||||
elseif ($action == 'TASK_CREATE')
|
||||
{
|
||||
elseif ($action == 'TASK_CREATE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -734,8 +663,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'TASK_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'TASK_MODIFY') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -744,8 +672,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'TASK_DELETE')
|
||||
{
|
||||
} elseif ($action == 'TASK_DELETE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -754,23 +681,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'TICKET_ASSIGNED')
|
||||
{
|
||||
} elseif ($action == 'TICKET_ASSIGNED') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
|
||||
$object->actionmsg = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
|
||||
if ($object->oldcopy->fk_user_assign > 0)
|
||||
{
|
||||
if ($object->oldcopy->fk_user_assign > 0) {
|
||||
$tmpuser = new User($this->db);
|
||||
$tmpuser->fetch($object->oldcopy->fk_user_assign);
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs);
|
||||
} else {
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$langs->trans("None");
|
||||
}
|
||||
if ($object->fk_user_assign > 0)
|
||||
{
|
||||
if ($object->fk_user_assign > 0) {
|
||||
$tmpuser = new User($this->db);
|
||||
$tmpuser->fetch($object->fk_user_assign);
|
||||
$object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs);
|
||||
@@ -816,11 +740,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
// Add entry in event table
|
||||
$now = dol_now();
|
||||
|
||||
if (isset($_SESSION['listofnames-'.$object->trackid]))
|
||||
{
|
||||
if (isset($_SESSION['listofnames-'.$object->trackid])) {
|
||||
$attachs = $_SESSION['listofnames-'.$object->trackid];
|
||||
if ($attachs && strpos($action, 'SENTBYMAIL'))
|
||||
{
|
||||
if ($attachs && strpos($action, 'SENTBYMAIL')) {
|
||||
$object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
|
||||
}
|
||||
}
|
||||
@@ -830,8 +752,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$societeforaction = new Societe($this->db);
|
||||
// Set contactforaction if there is only 1 contact.
|
||||
|
||||
if (is_array($object->sendtoid))
|
||||
{
|
||||
if (is_array($object->sendtoid)) {
|
||||
if (count($object->sendtoid) == 1) $contactforaction->fetch(reset($object->sendtoid));
|
||||
} else {
|
||||
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
|
||||
@@ -846,8 +767,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$elementid = $object->id; // id of object
|
||||
$elementtype = $object->element;
|
||||
$elementmodule = $object->module;
|
||||
if ($object->element == 'subscription')
|
||||
{
|
||||
if ($object->element == 'subscription') {
|
||||
$elementid = $object->fk_adherent;
|
||||
$elementtype = 'member';
|
||||
}
|
||||
@@ -881,8 +801,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
|
||||
// for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources.
|
||||
if (!in_array($elementtype, array('societe', 'contact', 'project')))
|
||||
{
|
||||
if (!in_array($elementtype, array('societe', 'contact', 'project'))) {
|
||||
$actioncomm->fk_element = $elementid;
|
||||
$actioncomm->elementtype = $elementtype.($elementmodule ? '@'.$elementmodule : '');
|
||||
}
|
||||
@@ -901,8 +820,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$ret = $actioncomm->create($user); // User creating action
|
||||
|
||||
if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)
|
||||
{
|
||||
if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO) {
|
||||
if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
|
||||
foreach ($object->attachedfiles['paths'] as $key=>$filespath) {
|
||||
$srcfile = $filespath;
|
||||
@@ -918,8 +836,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
|
||||
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
$_SESSION['LAST_ACTION_CREATED'] = $ret;
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
@@ -30,19 +30,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
{
|
||||
public $family = 'system';
|
||||
public $description = "Triggers of this module add action for BlockedLog module (Module of unalterable logs).";
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
|
||||
/**
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'technic';
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "system";
|
||||
$this->description = "Triggers of this module add action for BlockedLog module (Module of unalterable logs).";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'technic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called on Dolibarr payment or invoice event.
|
||||
@@ -68,8 +71,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
$b = new BlockedLog($this->db);
|
||||
|
||||
// Tracked events
|
||||
if (!in_array($action, array_keys($b->trackedevents)))
|
||||
{
|
||||
if (!in_array($action, array_keys($b->trackedevents))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -84,15 +86,13 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
|| (in_array($object->element, array('facture', 'supplier_invoice')) && $action === 'DOC_DOWNLOAD' && $object->statut != 0)
|
||||
|| (in_array($object->element, array('facture', 'supplier_invoice')) && $action === 'DOC_PREVIEW' && $object->statut != 0)
|
||||
|| (!empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED) && in_array($action, explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED)))
|
||||
)
|
||||
{
|
||||
) {
|
||||
$qualified++;
|
||||
|
||||
if (in_array($action, array(
|
||||
'MEMBER_SUBSCRIPTION_CREATE', 'MEMBER_SUBSCRIPTION_MODIFY', 'MEMBER_SUBSCRIPTION_DELETE',
|
||||
'DON_VALIDATE', 'DON_MODIFY', 'DON_DELETE'))) $amounts = (double) $object->amount;
|
||||
elseif ($action == 'CASHCONTROL_VALIDATE')
|
||||
{
|
||||
elseif ($action == 'CASHCONTROL_VALIDATE') {
|
||||
$amounts = (double) $object->cash + (double) $object->cheque + (double) $object->card;
|
||||
} else $amounts = (double) $object->total_ttc;
|
||||
}
|
||||
@@ -103,8 +103,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
$amounts= (double) $object->total_ttc;
|
||||
}*/
|
||||
if ($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_SUPPLIER_CREATE' || $action === 'DONATION_PAYMENT_CREATE'
|
||||
|| $action === 'PAYMENT_CUSTOMER_DELETE' || $action === 'PAYMENT_SUPPLIER_DELETE' || $action === 'DONATION_PAYMENT_DELETE')
|
||||
{
|
||||
|| $action === 'PAYMENT_CUSTOMER_DELETE' || $action === 'PAYMENT_SUPPLIER_DELETE' || $action === 'DONATION_PAYMENT_DELETE') {
|
||||
$qualified++;
|
||||
$amounts = 0;
|
||||
if (!empty($object->amounts)) {
|
||||
@@ -112,23 +111,20 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
$amounts += price2num($amount);
|
||||
}
|
||||
}
|
||||
} elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK')))
|
||||
{
|
||||
} elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK'))) {
|
||||
$qualified++;
|
||||
$amounts = (double) $object->amount;
|
||||
}
|
||||
|
||||
// Another protection.
|
||||
// May be used when event is DOC_DOWNLOAD or DOC_PREVIEW and element is not an invoice
|
||||
if (!$qualified)
|
||||
{
|
||||
if (!$qualified) {
|
||||
return 0; // not implemented action log
|
||||
}
|
||||
|
||||
$result = $b->setObjectData($object, $action, $amounts, $user); // Set field date_object, ref_object, fk_object, element, object_data
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$this->error = $b->error;
|
||||
$this->errors = $b->errors;
|
||||
return -1;
|
||||
@@ -136,8 +132,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
|
||||
$res = $b->create($user);
|
||||
|
||||
if ($res < 0)
|
||||
{
|
||||
if ($res < 0) {
|
||||
$this->error = $b->error;
|
||||
$this->errors = $b->errors;
|
||||
return -1;
|
||||
|
||||
@@ -31,19 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
{
|
||||
public $family = 'ldap';
|
||||
public $description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database.";
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
|
||||
/**
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'technic';
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "ldap";
|
||||
$this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database.";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'technic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
@@ -61,8 +64,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing
|
||||
if (defined('DISABLE_LDAP_SYNCHRO')) return 0; // If constant defined, we do nothing
|
||||
|
||||
if (!function_exists('ldap_connect'))
|
||||
{
|
||||
if (!function_exists('ldap_connect')) {
|
||||
dol_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
@@ -73,16 +75,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$result = 0;
|
||||
|
||||
// Users
|
||||
if ($action == 'USER_CREATE')
|
||||
{
|
||||
if ($action == 'USER_CREATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@@ -91,18 +90,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'USER_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'USER_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy))
|
||||
{
|
||||
if ($result > 0) {
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
|
||||
dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
|
||||
$object->oldcopy = clone $object;
|
||||
}
|
||||
@@ -114,8 +109,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -129,18 +123,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'USER_NEW_PASSWORD')
|
||||
{
|
||||
} elseif ($action == 'USER_NEW_PASSWORD') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy))
|
||||
{
|
||||
if ($result > 0) {
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
|
||||
dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
|
||||
$object->oldcopy = clone $object;
|
||||
}
|
||||
@@ -152,8 +142,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -165,19 +154,15 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'USER_ENABLEDISABLE')
|
||||
{
|
||||
} elseif ($action == 'USER_ENABLEDISABLE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
} elseif ($action == 'USER_DELETE')
|
||||
{
|
||||
} elseif ($action == 'USER_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@@ -186,20 +171,16 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'USER_SETINGROUP')
|
||||
{
|
||||
} elseif ($action == 'USER_SETINGROUP') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
// Must edit $object->newgroupid
|
||||
$usergroup = new UserGroup($this->db);
|
||||
if ($object->newgroupid > 0)
|
||||
{
|
||||
if ($object->newgroupid > 0) {
|
||||
$usergroup->fetch($object->newgroupid);
|
||||
|
||||
$oldinfo = $usergroup->_load_ldap_info();
|
||||
@@ -209,8 +190,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $usergroup->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -223,20 +203,16 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'USER_REMOVEFROMGROUP')
|
||||
{
|
||||
} elseif ($action == 'USER_REMOVEFROMGROUP') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
// Must edit $object->newgroupid
|
||||
$usergroup = new UserGroup($this->db);
|
||||
if ($object->oldgroupid > 0)
|
||||
{
|
||||
if ($object->oldgroupid > 0) {
|
||||
$usergroup->fetch($object->oldgroupid);
|
||||
|
||||
$oldinfo = $usergroup->_load_ldap_info();
|
||||
@@ -246,8 +222,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $usergroup->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -263,16 +238,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Groupes
|
||||
elseif ($action == 'USERGROUP_CREATE')
|
||||
{
|
||||
elseif ($action == 'USERGROUP_CREATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@@ -286,18 +258,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'USERGROUP_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'USERGROUP_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy))
|
||||
{
|
||||
if ($result > 0) {
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
|
||||
dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
|
||||
$object->oldcopy = clone $object;
|
||||
}
|
||||
@@ -309,8 +277,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -322,16 +289,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'USERGROUP_DELETE')
|
||||
{
|
||||
} elseif ($action == 'USERGROUP_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@@ -343,16 +307,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Contacts
|
||||
elseif ($action == 'CONTACT_CREATE')
|
||||
{
|
||||
elseif ($action == 'CONTACT_CREATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_CONTACT_ACTIVE))
|
||||
{
|
||||
if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@@ -361,18 +322,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'CONTACT_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'CONTACT_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_CONTACT_ACTIVE))
|
||||
{
|
||||
if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy))
|
||||
{
|
||||
if ($result > 0) {
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
|
||||
dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
|
||||
$object->oldcopy = clone $object;
|
||||
}
|
||||
@@ -384,8 +341,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -397,16 +353,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'CONTACT_DELETE')
|
||||
{
|
||||
} elseif ($action == 'CONTACT_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_CONTACT_ACTIVE))
|
||||
{
|
||||
if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@@ -418,26 +371,21 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Members
|
||||
elseif ($action == 'MEMBER_CREATE')
|
||||
{
|
||||
elseif ($action == 'MEMBER_CREATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
$result = $ldap->add($dn, $info, $user);
|
||||
|
||||
// For member type
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||
{
|
||||
if ($object->typeid > 0)
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
||||
if ($object->typeid > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php";
|
||||
$membertype = new AdherentType($this->db);
|
||||
$membertype->fetch($object->typeid);
|
||||
@@ -450,8 +398,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $membertype->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -465,19 +412,15 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
} elseif ($action == 'MEMBER_VALIDATE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_VALIDATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
||||
// If status field is setup to be synchronized
|
||||
if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS))
|
||||
{
|
||||
if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
$olddn = $dn; // We know olddn=dn as we change only status
|
||||
@@ -488,23 +431,19 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
||||
// If subscriptions fields are setup to be synchronized
|
||||
if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE
|
||||
|| $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT
|
||||
|| $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE
|
||||
|| $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT
|
||||
|| $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)
|
||||
{
|
||||
|| $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
$olddn = $dn; // We know olddn=dn as we change only subscriptions
|
||||
@@ -515,18 +454,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'MEMBER_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy))
|
||||
{
|
||||
if ($result > 0) {
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
|
||||
dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
|
||||
$object->oldcopy = clone $object;
|
||||
}
|
||||
@@ -538,8 +473,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -551,8 +485,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent);
|
||||
|
||||
// For member type
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
||||
require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php";
|
||||
|
||||
/*
|
||||
@@ -569,8 +502,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $newmembertype->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$newmembertype->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -579,8 +511,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
|
||||
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||
|
||||
if ($object->oldcopy->typeid != $object->typeid)
|
||||
{
|
||||
if ($object->oldcopy->typeid != $object->typeid) {
|
||||
/*
|
||||
* Remove member in old member type
|
||||
*/
|
||||
@@ -595,8 +526,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $oldmembertype->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$oldmembertype->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -608,24 +538,19 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
$this->errors[] = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'MEMBER_NEW_PASSWORD')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_NEW_PASSWORD') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
||||
// If password field is setup to be synchronized
|
||||
if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED)
|
||||
{
|
||||
if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
$olddn = $dn; // We know olddn=dn as we change only password
|
||||
@@ -633,25 +558,20 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
$this->errors[] = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'MEMBER_RESILIATE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_RESILIATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
||||
// If status field is setup to be synchronized
|
||||
if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS))
|
||||
{
|
||||
if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
$olddn = $dn; // We know olddn=dn as we change only status
|
||||
@@ -659,32 +579,26 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
$this->errors[] = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'MEMBER_DELETE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
$result = $ldap->delete($dn);
|
||||
|
||||
// For member type
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||
{
|
||||
if ($object->typeid > 0)
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
||||
if ($object->typeid > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php";
|
||||
|
||||
/*
|
||||
@@ -701,8 +615,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $membertype->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -714,24 +627,20 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
$this->errors[] = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Members types
|
||||
elseif ($action == 'MEMBER_TYPE_CREATE')
|
||||
{
|
||||
elseif ($action == 'MEMBER_TYPE_CREATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@@ -743,23 +652,18 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$result = $ldap->add($dn, $info, $user);
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
$this->errors[] = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'MEMBER_TYPE_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_TYPE_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy))
|
||||
{
|
||||
if ($result > 0) {
|
||||
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
|
||||
dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
|
||||
$object->oldcopy = clone $object;
|
||||
}
|
||||
@@ -773,8 +677,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
if (count($records) && $records['count'] == 0) {
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
@@ -790,24 +693,20 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$this->errors[] = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'MEMBER_TYPE_DELETE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_TYPE_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
$result = $ldap->delete($dn);
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
$this->errors[] = "ErrorLDAP ".$ldap->error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
{
|
||||
public $family = 'mailmanspip';
|
||||
public $description = "Triggers of this module allows to synchronize Mailman an Spip.";
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
|
||||
/**
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'technic';
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "mailmanspip";
|
||||
$this->description = "Triggers of this module allows to synchronize Mailman an Spip.";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'technic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
@@ -61,13 +64,11 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
require_once DOL_DOCUMENT_ROOT."/mailmanspip/class/mailmanspip.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
|
||||
|
||||
if ($action == 'CATEGORY_LINK')
|
||||
{
|
||||
if ($action == 'CATEGORY_LINK') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// We add subscription if we change category (new category may means more mailing-list to subscribe)
|
||||
if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0)
|
||||
{
|
||||
if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0) {
|
||||
$this->error = $object->context['linkto']->error;
|
||||
$this->errors = $object->context['linkto']->errors;
|
||||
$return = -1;
|
||||
@@ -76,13 +77,11 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
return $return;
|
||||
} elseif ($action == 'CATEGORY_UNLINK')
|
||||
{
|
||||
} elseif ($action == 'CATEGORY_UNLINK') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// We remove subscription if we change category (lessw category may means less mailing-list to subscribe)
|
||||
if (is_object($object->context['unlinkoff']) && method_exists($object->context['unlinkoff'], 'del_to_abo') && $object->context['unlinkoff']->del_to_abo() < 0)
|
||||
{
|
||||
if (is_object($object->context['unlinkoff']) && method_exists($object->context['unlinkoff'], 'del_to_abo') && $object->context['unlinkoff']->del_to_abo() < 0) {
|
||||
$this->error = $object->context['unlinkoff']->error;
|
||||
$this->errors = $object->context['unlinkoff']->errors;
|
||||
$return = -1;
|
||||
@@ -94,13 +93,11 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Members
|
||||
elseif ($action == 'MEMBER_VALIDATE')
|
||||
{
|
||||
elseif ($action == 'MEMBER_VALIDATE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$return = 0;
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
if ($object->add_to_abo() < 0) {
|
||||
$this->errors = $object->errors;
|
||||
if (!empty($object->error)) $this->errors[] = $object->error;
|
||||
$return = -1;
|
||||
@@ -109,28 +106,23 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
return $return;
|
||||
} elseif ($action == 'MEMBER_MODIFY')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_MODIFY') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$return = 0;
|
||||
// Add user into some linked tools (mailman, spip, etc...)
|
||||
if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))
|
||||
{
|
||||
if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) // If email has changed or if list has changed we delete mailman subscription for old email
|
||||
{
|
||||
if ($object->oldcopy->del_to_abo() < 0)
|
||||
{
|
||||
if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) {
|
||||
if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) { // If email has changed or if list has changed we delete mailman subscription for old email
|
||||
if ($object->oldcopy->del_to_abo() < 0) {
|
||||
$this->errors = $object->oldcopy->errors;
|
||||
if (!empty($object->oldcopy->error)) $this->errors[] = $object->oldcopy->error;
|
||||
$return = -1;
|
||||
} else {
|
||||
} else {
|
||||
$return = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// We add subscription if new email or new type (new type may means more mailing-list to subscribe)
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
if ($object->add_to_abo() < 0) {
|
||||
$this->errors = $object->errors;
|
||||
if (!empty($object->error)) $this->errors[] = $object->error;
|
||||
$return = -1;
|
||||
@@ -140,14 +132,12 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
return $return;
|
||||
} elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE')
|
||||
{
|
||||
} elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$return = 0;
|
||||
// Remove from external tools (mailman, spip, etc...)
|
||||
if ($object->del_to_abo() < 0)
|
||||
{
|
||||
if ($object->del_to_abo() < 0) {
|
||||
$this->errors = $object->errors;
|
||||
if (!empty($object->error)) $this->errors[] = $object->error;
|
||||
$return = -1;
|
||||
|
||||
@@ -30,20 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceNotification extends DolibarrTriggers
|
||||
{
|
||||
public $family = 'notification';
|
||||
public $description = "Triggers of this module send email notifications according to Notification module setup.";
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
|
||||
/**
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'email';
|
||||
|
||||
// @todo Defined also into notify.class.php)
|
||||
public $listofmanagedevents = array(
|
||||
'BILL_VALIDATE',
|
||||
@@ -63,6 +49,23 @@ class InterfaceNotification extends DolibarrTriggers
|
||||
'HOLIDAY_APPROVE'
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "notification";
|
||||
$this->description = "Triggers of this module send email notifications according to Notification module setup.";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'email';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
|
||||
@@ -107,20 +110,17 @@ class InterfaceNotification extends DolibarrTriggers
|
||||
$sql .= $this->db->order("rang, elementtype, code");
|
||||
dol_syslog("getListOfManagedEvents Get list of notifications", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$qualified = 0;
|
||||
// Check is this event is supported by notification module
|
||||
if (in_array($obj->code, $this->listofmanagedevents)) $qualified = 1;
|
||||
// Check if module for this event is active
|
||||
if ($qualified)
|
||||
{
|
||||
if ($qualified) {
|
||||
//print 'xx'.$obj->code;
|
||||
$element = $obj->elementtype;
|
||||
|
||||
@@ -133,8 +133,7 @@ class InterfaceNotification extends DolibarrTriggers
|
||||
elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expensereport')) && empty($conf->$element->enabled)) $qualified = 0;
|
||||
}
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
if ($qualified) {
|
||||
$ret[] = array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'label'=>$obj->label, 'description'=>$obj->description, 'elementtype'=>$obj->elementtype);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceTicketEmail extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -47,53 +42,10 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "ticket";
|
||||
$this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties";
|
||||
$this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR; // 'development', 'experimental', 'dolibarr' or version
|
||||
$this->picto = 'ticket';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return name of trigger file
|
||||
*
|
||||
* @return string Name of trigger file
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return description of trigger file
|
||||
*
|
||||
* @return string Description of trigger file
|
||||
*/
|
||||
public function getDesc()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return version of trigger file
|
||||
*
|
||||
* @return string Version of trigger file
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'development') {
|
||||
return $langs->trans("Development");
|
||||
} elseif ($this->version == 'experimental') {
|
||||
return $langs->trans("Experimental");
|
||||
} elseif ($this->version == 'dolibarr') {
|
||||
return DOL_VERSION;
|
||||
} elseif ($this->version) {
|
||||
return $this->version;
|
||||
} else {
|
||||
return $langs->trans("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers
|
||||
@@ -115,16 +67,13 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
case 'TICKET_ASSIGNED':
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id)
|
||||
{
|
||||
if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id) {
|
||||
$userstat = new User($this->db);
|
||||
$res = $userstat->fetch($object->fk_user_assign);
|
||||
if ($res > 0)
|
||||
{
|
||||
if ($res > 0) {
|
||||
// Send email to notification email
|
||||
|
||||
if (empty($conf->global->TICKET_DISABLE_ALL_MAILS))
|
||||
{
|
||||
if (empty($conf->global->TICKET_DISABLE_ALL_MAILS)) {
|
||||
// Init to avoid errors
|
||||
$filepath = array();
|
||||
$filename = array();
|
||||
@@ -184,10 +133,8 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
|
||||
// Send email to notification email
|
||||
$sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail']))
|
||||
{
|
||||
if ($sendto)
|
||||
{
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) {
|
||||
if ($sendto) {
|
||||
// Init to avoid errors
|
||||
$filepath = array();
|
||||
$filename = array();
|
||||
@@ -248,8 +195,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
|
||||
// Send email to customer
|
||||
|
||||
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create)
|
||||
{
|
||||
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) {
|
||||
$sendto = '';
|
||||
if (empty($user->socid) && empty($user->email)) {
|
||||
$object->fetch_thirdparty();
|
||||
@@ -272,16 +218,13 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
$message_customer .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
|
||||
|
||||
// Extrafields
|
||||
foreach ($this->attributes[$object->table_element]['label'] as $key => $value)
|
||||
{
|
||||
foreach ($this->attributes[$object->table_element]['label'] as $key => $value) {
|
||||
$enabled = 1;
|
||||
if ($enabled && isset($this->attributes[$object->table_element]['list'][$key]))
|
||||
{
|
||||
if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) {
|
||||
$enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
|
||||
}
|
||||
$perms = 1;
|
||||
if ($perms && isset($this->attributes[$object->table_element]['perms'][$key]))
|
||||
{
|
||||
if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceStripe extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -52,31 +47,10 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = 'stripe';
|
||||
$this->description = "Triggers of the module Stripe";
|
||||
$this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR; // 'development', 'experimental', 'dolibarr' or version
|
||||
$this->picto = 'stripe';
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger name
|
||||
*
|
||||
* @return string Name of trigger file
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger description
|
||||
*
|
||||
* @return string Description of trigger file
|
||||
*/
|
||||
public function getDesc()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
* All functions "runTrigger" are triggered if file
|
||||
@@ -104,8 +78,7 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha'))
|
||||
{
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 1;
|
||||
}
|
||||
@@ -118,8 +91,7 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
|
||||
if ($object->client != 0) {
|
||||
$customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); // This make a network request
|
||||
if ($customer)
|
||||
{
|
||||
if ($customer) {
|
||||
$namecleaned = $object->name ? $object->name : null;
|
||||
$vatcleaned = $object->tva_intra ? $object->tva_intra : null; // Example of valid numbers are 'FR12345678901' or 'FR12345678902'
|
||||
$desccleaned = $object->name_alias ? $object->name_alias : null;
|
||||
@@ -147,15 +119,13 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
if ($desccleaned != $customer->description) $changerequested++;
|
||||
if (($customer->tax_exempt == 'exempt' && !$object->tva_assuj) || (!$customer->tax_exempt == 'exempt' && empty($object->tva_assuj))) $changerequested++;
|
||||
if (!isset($customer->tax_ids['data']) && !is_null($vatcleaned)) $changerequested++;
|
||||
elseif (isset($customer->tax_ids['data']))
|
||||
{
|
||||
elseif (isset($customer->tax_ids['data'])) {
|
||||
$taxinfo = reset($customer->tax_ids['data']);
|
||||
if (empty($taxinfo) && !empty($vatcleaned)) $changerequested++;
|
||||
if (isset($taxinfo->value) && $vatcleaned != $taxinfo->value) $changerequested++;
|
||||
}
|
||||
|
||||
if ($changerequested)
|
||||
{
|
||||
if ($changerequested) {
|
||||
/*if (! empty($object->email)) $customer->email = $object->email;
|
||||
$customer->description = $namecleaned;
|
||||
if (empty($taxinfo)) $customer->tax_info = array('type'=>'vat', 'tax_id'=>null);
|
||||
@@ -167,22 +137,17 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
|
||||
try {
|
||||
// Update Tax info on Stripe
|
||||
if (!empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer
|
||||
{
|
||||
if (!empty($vatcleaned))
|
||||
{
|
||||
if (!empty($conf->global->STRIPE_SAVE_TAX_IDS)) { // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer
|
||||
if (!empty($vatcleaned)) {
|
||||
$isineec = isInEEC($object);
|
||||
if ($object->country_code && $isineec)
|
||||
{
|
||||
if ($object->country_code && $isineec) {
|
||||
//$taxids = $customer->allTaxIds($customer->id);
|
||||
$customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned));
|
||||
}
|
||||
} else {
|
||||
$taxids = $customer->allTaxIds($customer->id);
|
||||
if (is_array($taxids->data))
|
||||
{
|
||||
foreach ($taxids->data as $taxidobj)
|
||||
{
|
||||
if (is_array($taxids->data)) {
|
||||
foreach ($taxids->data as $taxidobj) {
|
||||
$customer->deleteTaxId($customer->id, $taxidobj->id);
|
||||
}
|
||||
}
|
||||
@@ -191,8 +156,7 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
|
||||
// Update Customer on Stripe
|
||||
$customer->save();
|
||||
} catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
//var_dump(\Stripe\Stripe::getApiVersion());
|
||||
$this->errors[] = $e->getMessage();
|
||||
$ok = -1;
|
||||
@@ -209,12 +173,10 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.
|
||||
|
||||
$customer = $stripe->customerStripe($object, $stripeacc, $servicestatus);
|
||||
if ($customer)
|
||||
{
|
||||
if ($customer) {
|
||||
try {
|
||||
$customer->delete();
|
||||
} catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
dol_syslog("Failed to delete Stripe customer ".$e->getMessage(), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
@@ -232,13 +194,11 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
if (!empty($object->stripe_card_ref))
|
||||
{
|
||||
if (!empty($object->stripe_card_ref)) {
|
||||
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.
|
||||
$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this
|
||||
|
||||
if ($stripecu)
|
||||
{
|
||||
if ($stripecu) {
|
||||
// Get customer (required to get a card)
|
||||
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
||||
$customer = \Stripe\Customer::retrieve($stripecu);
|
||||
@@ -246,15 +206,13 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
$customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc));
|
||||
}
|
||||
|
||||
if ($customer)
|
||||
{
|
||||
if ($customer) {
|
||||
$card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus);
|
||||
if ($card) {
|
||||
$card->metadata = array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']));
|
||||
try {
|
||||
$card->save();
|
||||
} catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$ok = -1;
|
||||
$this->error = $e->getMessages();
|
||||
}
|
||||
@@ -266,13 +224,11 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card') {
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
if (!empty($object->stripe_card_ref))
|
||||
{
|
||||
if (!empty($object->stripe_card_ref)) {
|
||||
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.
|
||||
$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this
|
||||
|
||||
if ($stripecu)
|
||||
{
|
||||
if ($stripecu) {
|
||||
// Get customer (required to get a card)
|
||||
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
||||
$customer = \Stripe\Customer::retrieve($stripecu);
|
||||
@@ -280,8 +236,7 @@ class InterfaceStripe extends DolibarrTriggers
|
||||
$customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc));
|
||||
}
|
||||
|
||||
if ($customer)
|
||||
{
|
||||
if ($customer) {
|
||||
$card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus);
|
||||
if ($card) {
|
||||
if (method_exists($card, 'detach')) $card->detach();
|
||||
|
||||
@@ -33,23 +33,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceContactRoles extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
public $family = 'agenda';
|
||||
|
||||
public $description = "Triggers of this module auto link contact to company.";
|
||||
|
||||
/**
|
||||
* Version of the trigger
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $version = self::VERSION_DOLIBARR;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string Image of the trigger
|
||||
*/
|
||||
public $picto = 'action';
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "agenda";
|
||||
$this->description = "Triggers of this module auto link contact to company.";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'action';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
/* Copyright (C) 2017-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -39,11 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
*/
|
||||
class InterfaceZapierTriggers extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* @var DoliDB Database handler
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -57,31 +52,10 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
||||
$this->family = "technic";
|
||||
$this->description = "Zapier triggers.";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'development';
|
||||
$this->version = self::VERSION_DEVELOPMENT;
|
||||
$this->picto = 'zapier';
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger name
|
||||
*
|
||||
* @return string Name of trigger file
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger description
|
||||
*
|
||||
* @return string Description of trigger file
|
||||
*/
|
||||
public function getDesc()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
* All functions "runTrigger" are triggered if file
|
||||
@@ -96,7 +70,6 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
||||
*/
|
||||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||
{
|
||||
global $db;
|
||||
if (empty($conf->zapier->enabled)) {
|
||||
// Module not active, we do nothing
|
||||
return 0;
|
||||
@@ -403,7 +376,7 @@ function cleanObjectDatas($toclean)
|
||||
// Remove $db object property for object
|
||||
unset($toclean->db);
|
||||
|
||||
// Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses
|
||||
// Remove linkedObjects. We should already have linkedObjectsIds that avoid huge responses
|
||||
unset($toclean->linkedObjects);
|
||||
|
||||
unset($toclean->lines); // should be ->lines
|
||||
|
||||
Reference in New Issue
Block a user