mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-13 04:51:25 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into membership-rework
This commit is contained in:
@@ -139,6 +139,8 @@ class box_commandes extends ModeleBoxes
|
||||
$commandestatic->total_ht = $objp->total_ht;
|
||||
$commandestatic->total_tva = $objp->total_tva;
|
||||
$commandestatic->total_ttc = $objp->total_ttc;
|
||||
$commandestatic->date = $date;
|
||||
$commandestatic->date_modification = $datem;
|
||||
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
@@ -179,8 +181,8 @@ class box_commandes extends ModeleBoxes
|
||||
}
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@@ -155,9 +155,9 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
|
||||
}
|
||||
|
||||
if ($num == 0 || $nboutstandingbillreachedcustomers == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=> '<span class="opacitymedium">'.$langs->trans("None").'</span>'
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=> '<span class="opacitymedium">'.$langs->trans("None").'</span>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class box_factures extends ModeleBoxes
|
||||
$sql .= ", f.ref, f.type, f.total_ht";
|
||||
$sql .= ", f.total_tva";
|
||||
$sql .= ", f.total_ttc";
|
||||
$sql .= ", f.datef as df";
|
||||
$sql .= ", f.datef as date";
|
||||
$sql .= ", f.paye, f.fk_statut as status, f.datec, f.tms";
|
||||
$sql .= ", f.date_lim_reglement as datelimite";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
@@ -130,7 +130,7 @@ class box_factures extends ModeleBoxes
|
||||
while ($line < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$datelimite = $this->db->jdate($objp->datelimite);
|
||||
$date = $this->db->jdate($objp->df);
|
||||
$date = $this->db->jdate($objp->date);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
@@ -141,6 +141,7 @@ class box_factures extends ModeleBoxes
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
$facturestatic->date = $this->db->jdate($objp->date);
|
||||
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
|
||||
$facturestatic->alreadypaid = $objp->paye;
|
||||
|
||||
@@ -185,8 +186,8 @@ class box_factures extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@@ -95,7 +95,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$sql .= ", f.total_tva";
|
||||
$sql .= ", f.total_ttc";
|
||||
$sql .= ", f.paye, f.fk_statut as status";
|
||||
$sql .= ', f.datef as df';
|
||||
$sql .= ', f.datef as date';
|
||||
$sql .= ', f.datec as datec';
|
||||
$sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@@ -129,7 +129,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$datelimite = $this->db->jdate($objp->datelimite);
|
||||
$date = $this->db->jdate($objp->df);
|
||||
$date = $this->db->jdate($objp->date);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
@@ -137,6 +137,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->date = $date;
|
||||
$facturestatic->date_echeance = $datelimite;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
@@ -188,8 +189,8 @@ class box_factures_fourn extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@@ -132,6 +132,7 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->date_echeance = $datelimite;
|
||||
$facturestatic->date = $date;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
|
||||
@@ -175,7 +176,7 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateDue").': '.dol_print_date($datelimite, 'day', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datelimite, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
$sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql .= ", f.ref, f.date_lim_reglement as datelimite";
|
||||
$sql .= ", f.type";
|
||||
$sql .= ", f.datef as df";
|
||||
$sql .= ", f.datef as date";
|
||||
$sql .= ", f.total_ht";
|
||||
$sql .= ", f.total_tva";
|
||||
$sql .= ", f.total_ttc";
|
||||
@@ -156,6 +156,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
$facturestatic->date = $this->db->jdate($objp->date);
|
||||
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
|
||||
$facturestatic->alreadypaid = $objp->paye;
|
||||
|
||||
@@ -200,7 +201,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateDue").': '.dol_print_date($datelimite, 'day', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datelimite, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ class box_ficheinter extends ModeleBoxes
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($resql);
|
||||
$datec = $this->db->jdate($objp->datec);
|
||||
$datem = $this->db->jdate($objp->datem);
|
||||
|
||||
$ficheinterstatic->statut = $objp->status;
|
||||
$ficheinterstatic->status = $objp->status;
|
||||
@@ -144,8 +145,8 @@ class box_ficheinter extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($datec, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
|
||||
@@ -134,7 +134,7 @@ class box_fournisseurs extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, "day", 'tzuserrel'),
|
||||
);
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
);
|
||||
|
||||
if ($user->rights->ticket->read) {
|
||||
$sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email ";
|
||||
$sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.tms as datem, t.date_read, t.date_close, t.origin_email ";
|
||||
$sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label";
|
||||
$sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
|
||||
@@ -113,6 +113,7 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($resql);
|
||||
$datec = $this->db->jdate($objp->datec);
|
||||
$datem = $this->db->jdate($objp->datem);
|
||||
|
||||
$ticket = new Ticket($this->db);
|
||||
$ticket->id = $objp->id;
|
||||
@@ -120,6 +121,10 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
$ticket->ref = $objp->ref;
|
||||
$ticket->fk_statut = $objp->fk_statut;
|
||||
$ticket->subject = $objp->subject;
|
||||
$ticket->date_creation = $datec;
|
||||
$ticket->date_modification = $datem;
|
||||
$ticket->fk_statut = $objp->fk_statut;
|
||||
$ticket->fk_statut = $objp->fk_statut;
|
||||
if ($objp->fk_soc > 0) {
|
||||
$thirdparty = new Societe($this->db);
|
||||
$thirdparty->id = $objp->fk_soc;
|
||||
@@ -161,8 +166,8 @@ class box_last_modified_ticket extends ModeleBoxes
|
||||
|
||||
// Date creation
|
||||
$this->info_box_contents[$i][$r] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($datec, 'dayhour', 'tzuserrel')
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'dayhour', 'tzuserrel')
|
||||
);
|
||||
$r++;
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ class box_last_ticket extends ModeleBoxes
|
||||
|
||||
// Date creation
|
||||
$this->info_box_contents[$i][$r] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'),
|
||||
);
|
||||
$r++;
|
||||
|
||||
@@ -148,6 +148,7 @@ class box_produits extends ModeleBoxes
|
||||
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
|
||||
$productstatic->date_modification = $datem;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
|
||||
@@ -190,7 +191,7 @@ class box_produits extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ class box_propales extends ModeleBoxes
|
||||
$propalstatic->total_ttc = $objp->total_ttc;
|
||||
$propalstatic->statut = $objp->status;
|
||||
$propalstatic->status = $objp->status;
|
||||
$propalstatic->date = $date;
|
||||
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
@@ -165,8 +166,8 @@ class box_propales extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@@ -141,7 +141,7 @@ class box_prospect extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, "day", 'tzuserrel'),
|
||||
);
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ class box_services_contracts extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
'text2'=> $late,
|
||||
);
|
||||
|
||||
@@ -151,7 +151,7 @@ class box_services_expired extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateEndPlanned").': '.dol_print_date($dateline, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($dateline, 'day', 'tzuserrel'),
|
||||
'text2'=> $late,
|
||||
);
|
||||
|
||||
@@ -123,6 +123,9 @@ class box_supplier_orders extends ModeleBoxes
|
||||
$supplierorderstatic->id = $objp->rowid;
|
||||
$supplierorderstatic->ref = $objp->ref;
|
||||
$supplierorderstatic->statut = $objp->status;
|
||||
$supplierorderstatic->status = $objp->status;
|
||||
$supplierorderstatic->date = $date;
|
||||
$supplierorderstatic->date_modification = $datem;
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
@@ -152,8 +155,8 @@ class box_supplier_orders extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($date, 'day', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@@ -172,7 +172,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center"',
|
||||
'text' => $langs->trans("NoSupplierOrder"),
|
||||
'text' => '<span class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</span>',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
||||
} else {
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => 'class="nohover opacitymedium left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||
'text' => '<span class="opacitymedium">'.$langs->trans("ReadPermissionNotAllowed").'</span>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,13 +169,13 @@ abstract class CommonObject
|
||||
public $canvas;
|
||||
|
||||
/**
|
||||
* @var Project The related project
|
||||
* @var Project The related project object
|
||||
* @see fetch_projet()
|
||||
*/
|
||||
public $project;
|
||||
|
||||
/**
|
||||
* @var int The related project ID
|
||||
* @var int The related project ID
|
||||
* @see setProject(), project
|
||||
*/
|
||||
public $fk_project;
|
||||
@@ -188,24 +188,24 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see fk_project
|
||||
* @see $fk_project
|
||||
*/
|
||||
public $fk_projet;
|
||||
|
||||
/**
|
||||
* @var Contact a related contact
|
||||
* @var Contact A related contact object
|
||||
* @see fetch_contact()
|
||||
*/
|
||||
public $contact;
|
||||
|
||||
/**
|
||||
* @var int The related contact ID
|
||||
* @var int The related contact ID
|
||||
* @see fetch_contact()
|
||||
*/
|
||||
public $contact_id;
|
||||
|
||||
/**
|
||||
* @var Societe A related thirdparty
|
||||
* @var Societe A related thirdparty object
|
||||
* @see fetch_thirdparty()
|
||||
*/
|
||||
public $thirdparty;
|
||||
@@ -254,7 +254,7 @@ abstract class CommonObject
|
||||
public $newref;
|
||||
|
||||
/**
|
||||
* @var int The object's status
|
||||
* @var int The object's status. Prefer use of status.
|
||||
* @see setStatut()
|
||||
*/
|
||||
public $statut;
|
||||
@@ -265,6 +265,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public $status;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @see getFullAddress()
|
||||
@@ -319,6 +320,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public $region;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @see fetch_barcode()
|
||||
@@ -518,6 +520,47 @@ abstract class CommonObject
|
||||
*/
|
||||
public $date_modification; // Date last change (tms field)
|
||||
|
||||
/**
|
||||
* @var User|int User author/creation
|
||||
* @TODO Merge with user_creation
|
||||
*/
|
||||
public $user_author;
|
||||
/**
|
||||
* @var User|int User author/creation
|
||||
* @TODO Remove type id
|
||||
*/
|
||||
public $user_creation;
|
||||
/**
|
||||
* @var int User id author/creation
|
||||
*/
|
||||
public $user_creation_id;
|
||||
|
||||
/**
|
||||
* @var User|int User of validation
|
||||
* @TODO Merge with user_validation
|
||||
*/
|
||||
public $user_valid;
|
||||
/**
|
||||
* @var User|int User of validation
|
||||
* @TODO Remove type id
|
||||
*/
|
||||
public $user_validation;
|
||||
/**
|
||||
* @var int User id of validation
|
||||
*/
|
||||
public $user_validation_id;
|
||||
|
||||
/**
|
||||
* @var User|int User last modifier
|
||||
* @TODO Remove type id
|
||||
*/
|
||||
public $user_modification;
|
||||
/**
|
||||
* @var int User id last modifier
|
||||
*/
|
||||
public $user_modification_id;
|
||||
|
||||
|
||||
public $next_prev_filter;
|
||||
|
||||
/**
|
||||
@@ -535,6 +578,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public $alreadypaid;
|
||||
|
||||
|
||||
/**
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
@@ -4291,7 +4335,7 @@ abstract class CommonObject
|
||||
if ($elementTable == 'commande_fournisseur_dispatch') {
|
||||
$fieldstatus = "status";
|
||||
}
|
||||
if (is_array($this->fields) && array_key_exists('status', $this->fields)) {
|
||||
if (isset($this->fields) && is_array($this->fields) && array_key_exists('status', $this->fields)) {
|
||||
$fieldstatus = 'status';
|
||||
}
|
||||
|
||||
@@ -8402,8 +8446,6 @@ abstract class CommonObject
|
||||
$photo = '';
|
||||
$file = $val['name'];
|
||||
|
||||
//if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
||||
|
||||
//if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
|
||||
if (image_format_supported($file) >= 0) {
|
||||
$nbphoto++;
|
||||
|
||||
@@ -51,7 +51,7 @@ class Conf
|
||||
public $use_javascript_ajax;
|
||||
//! To store if javascript/ajax is enabked
|
||||
public $disable_compute;
|
||||
//! Used to store current currency (ISO code like 'USD', 'EUR', ...)
|
||||
//! Used to store current currency (ISO code like 'USD', 'EUR', ...). To get the currency symbol: $langs->getCurrencySymbol($this->currency)
|
||||
public $currency;
|
||||
|
||||
//! Used to store current css (from theme)
|
||||
|
||||
@@ -372,7 +372,7 @@ class EvalMath
|
||||
/**
|
||||
* Evaluate postfix notation
|
||||
*
|
||||
* @param string $tokens An array of expression to evaluate ('operators'). The operand are into ->stack.
|
||||
* @param array $tokens Expression
|
||||
* @param array $vars Array
|
||||
* @return string Output
|
||||
*/
|
||||
|
||||
@@ -1273,10 +1273,12 @@ class ExtraFields
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($data as $data_key => $data_value) {
|
||||
$out .= '<option value="'.$data_key.'"';
|
||||
$out .= ($value == $data_key ? ' selected' : '');
|
||||
$out .= '>'.$data_value.'</option>';
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $data_key => $data_value) {
|
||||
$out .= '<option value="'.$data_key.'"';
|
||||
$out .= ($value == $data_key ? ' selected' : '');
|
||||
$out .= '>'.$data_value.'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ class Fiscalyear extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$sql = "SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,";
|
||||
$sql .= " fy.tms";
|
||||
$sql .= " fy.tms as datem";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear as fy";
|
||||
$sql .= " WHERE fy.rowid = ".((int) $id);
|
||||
|
||||
@@ -426,18 +426,10 @@ class Fiscalyear extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
if ($obj->fk_user_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
|
||||
@@ -4784,7 +4784,7 @@ class Form
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $include [=0] Removed or 1=Keep only
|
||||
* @param string $morecss More CSS
|
||||
* @return string
|
||||
* @return string|array
|
||||
* @see select_categories()
|
||||
*/
|
||||
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0, $morecss = '')
|
||||
@@ -5848,12 +5848,13 @@ class Form
|
||||
/**
|
||||
* Retourne la liste des devises, dans la langue de l'utilisateur
|
||||
*
|
||||
* @param string $selected preselected currency code
|
||||
* @param string $htmlname name of HTML select list
|
||||
* @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code
|
||||
* @param string $selected preselected currency code
|
||||
* @param string $htmlname name of HTML select list
|
||||
* @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code
|
||||
* @param string $useempty '1'=Allow empty value
|
||||
* @return string
|
||||
*/
|
||||
public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0)
|
||||
public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0, $useempty = '')
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@@ -5866,6 +5867,9 @@ class Form
|
||||
}
|
||||
|
||||
$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if ($useempty) {
|
||||
$out .= '<option value="-1" selected></option>';
|
||||
}
|
||||
foreach ($langs->cache_currencies as $code_iso => $currency) {
|
||||
$labeltoshow = $currency['label'];
|
||||
if ($mode == 1) {
|
||||
|
||||
@@ -233,6 +233,12 @@ abstract class Stats
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $year year number
|
||||
* @return int value
|
||||
*/
|
||||
protected abstract function getAverageByMonth($year);
|
||||
|
||||
/**
|
||||
* Return average of entity by month for several years
|
||||
*
|
||||
|
||||
@@ -42,6 +42,34 @@
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
|
||||
if (!function_exists('utf8_encode')) {
|
||||
/**
|
||||
* Implement utf8_encode for PHP that does not support it.
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function utf8_encode($elements)
|
||||
{
|
||||
return mb_convert_encoding($elements, 'UTF-8', 'ISO-8859-1');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('utf8_decode')) {
|
||||
/**
|
||||
* Implement utf8_decode for PHP that does not support it.
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function utf8_decode($elements)
|
||||
{
|
||||
return mb_convert_encoding($elements, 'ISO-8859-1', 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return dolibarr global constant string value
|
||||
* @param string $key key to return value, return '' if not set
|
||||
@@ -5355,7 +5383,8 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
||||
print '</li>';
|
||||
}
|
||||
if ((int) $limit > 0 && empty($hideselectlimit)) {
|
||||
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000,25000:25000';
|
||||
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000';
|
||||
$pagesizechoices .= ',5000:5000,10000:10000,20000:20000';
|
||||
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
|
||||
//$pagesizechoices.=',2:2';
|
||||
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) {
|
||||
@@ -6431,6 +6460,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id
|
||||
function yn($yesno, $case = 1, $color = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result = 'unknown';
|
||||
$classname = '';
|
||||
if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0
|
||||
@@ -10448,14 +10478,14 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
||||
$TCompiledAttr[] = $key.'="'.$value.'"';
|
||||
}
|
||||
|
||||
$compiledAttributes = !empty($TCompiledAttr) ?implode(' ', $TCompiledAttr) : '';
|
||||
$compiledAttributes = empty($TCompiledAttr) ? '' : implode(' ', $TCompiledAttr);
|
||||
|
||||
$tag = !empty($attr['href']) ? 'a' : 'span';
|
||||
|
||||
|
||||
$parameters = array(
|
||||
'TCompiledAttr' => $TCompiledAttr,
|
||||
'compiledAttributes' => $compiledAttributes,
|
||||
'TCompiledAttr' => $TCompiledAttr, // array
|
||||
'compiledAttributes' => $compiledAttributes, // string
|
||||
'attr' => $attr,
|
||||
'tag' => $tag,
|
||||
'label' => $label,
|
||||
|
||||
@@ -286,7 +286,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_creation, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_creation, "dayhour", "tzuserrel").' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_creation, "dayhour", "tzuserrel").' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -341,7 +341,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_modification, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_modification, "dayhour", "tzuserrel").' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_modification, "dayhour", "tzuserrel").' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -396,7 +396,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_validation, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -451,7 +451,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_approve, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -498,7 +498,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_approve2, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -553,7 +553,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_signature, 'dayhour');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans('CurrentHour').' / '.dol_print_date($object->date_signature, 'dayhour', 'tzuserrel').' '.$langs->trans('ClientHour');
|
||||
print ' <span class="opacitymedium">'.$langs->trans('CurrentHour').'</span> / '.dol_print_date($object->date_signature, 'dayhour', 'tzuserrel').' <span class="opacitymedium">'.$langs->trans('ClientHour').'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -614,7 +614,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_closing, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -669,7 +669,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_rappro, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
@@ -691,7 +691,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
print dol_print_date($object->date_envoi, 'dayhour', 'tzserver');
|
||||
if ($deltadateforuser) {
|
||||
print ' '.$langs->trans("CurrentHour").' / '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' '.$langs->trans("ClientHour");
|
||||
print ' <span class="opacitymedium">'.$langs->trans("CurrentHour").'</span> / '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' <span class="opacitymedium">'.$langs->trans("ClientHour").'</span>';
|
||||
}
|
||||
if ($usetable) {
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
|
||||
// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
|
||||
$supportedoauth2array = array(
|
||||
'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google'),
|
||||
'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/'),
|
||||
);
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest');
|
||||
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive');
|
||||
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'');
|
||||
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'');
|
||||
}
|
||||
$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub');
|
||||
$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('payment', 'stripe'));
|
||||
|
||||
$servicename = $langs->transnoentitiesnoconv('Online');
|
||||
$servicename = ''; // Link is a generic link for all payments services (paypal, stripe, ...)
|
||||
|
||||
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>';
|
||||
$url = getOnlinePaymentUrl(0, $type, $ref);
|
||||
|
||||
@@ -286,7 +286,7 @@ class modMultiCurrency extends DolibarrModules
|
||||
|
||||
$multicurrency = new MultiCurrency($this->db);
|
||||
|
||||
if (!$multicurrency->checkCodeAlreadyExists($conf->currency)) {
|
||||
if (! $multicurrency->checkCodeAlreadyExists($conf->currency)) {
|
||||
$langs->loadCacheCurrencies('');
|
||||
|
||||
$multicurrency->code = $conf->currency;
|
||||
|
||||
@@ -34,9 +34,12 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtourl = GETPOST('backtourl', 'alpha');
|
||||
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
|
||||
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
|
||||
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -64,9 +67,11 @@ $serviceFactory->setHttpClient($httpClient);
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_GITHUB'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_GITHUB'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_GITHUB_ID,
|
||||
$conf->global->OAUTH_GITHUB_SECRET,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
@@ -81,13 +86,20 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
//var_dump($requestedpermissionsarray);exit;
|
||||
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
$apiService = $serviceFactory->createService('GitHub', $credentials, $storage, $requestedpermissionsarray);
|
||||
$apiService = $serviceFactory->createService('GitHub'.($keyforprovider ? '-'.$keyforprovider : ''), $credentials, $storage, $requestedpermissionsarray);
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
//$apiService->setAccessType('offline');
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
if (!getDolGlobalString($keyforparamid)) {
|
||||
accessforbidden('Setup of service is not complete. Customer ID is missing');
|
||||
}
|
||||
if (!getDolGlobalString($keyforparamsecret)) {
|
||||
accessforbidden('Setup of service is not complete. Secret key is missing');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -140,14 +152,15 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
} else // If entry on page with no parameter, we arrive here
|
||||
{
|
||||
} else { // If entry on page with no parameter, we arrive here
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
// This may create record into oauth_state before the header redirect.
|
||||
// Creation of record with state in this tables depend on the Provider used (see its constructor).
|
||||
if (GETPOST('state')) {
|
||||
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
|
||||
$url = $apiService->getAuthorizationUri(array('state' => GETPOST('state')));
|
||||
} else {
|
||||
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtourl = GETPOST('backtourl', 'alpha');
|
||||
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
|
||||
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
|
||||
// If we are coming from the Oauth page
|
||||
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -63,23 +68,25 @@ $httpClient = new \OAuth\Common\Http\Client\CurlClient();
|
||||
//$httpClient->setCurlParameters($params);
|
||||
$serviceFactory->setHttpClient($httpClient);
|
||||
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_GOOGLE'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_GOOGLE'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_GOOGLE_ID,
|
||||
$conf->global->OAUTH_GOOGLE_SECRET,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
$state = GETPOST('state');
|
||||
$statewithscopeonly = '';
|
||||
$statewithanticsrfonly = '';
|
||||
|
||||
$requestedpermissionsarray = array();
|
||||
if ($state) {
|
||||
// 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back
|
||||
$statewithscopeonly = preg_replace('/\-.*$/', '', $state);
|
||||
$requestedpermissionsarray = explode(',', $statewithscopeonly); // Example: 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print'.
|
||||
$statewithanticsrfonly = preg_replace('/^.*\-/', '', $state);
|
||||
}
|
||||
if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
print 'Error, parameter state is not defined';
|
||||
@@ -88,6 +95,8 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
//var_dump($requestedpermissionsarray);exit;
|
||||
|
||||
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf, $keyforprovider);
|
||||
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
// $requestedpermissionsarray contains list of scopes.
|
||||
@@ -101,6 +110,13 @@ $apiService->setAccessType('offline');
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
if (!getDolGlobalString($keyforparamid)) {
|
||||
accessforbidden('Setup of service is not complete. Customer ID is missing');
|
||||
}
|
||||
if (!getDolGlobalString($keyforparamsecret)) {
|
||||
accessforbidden('Setup of service is not complete. Secret key is missing');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -117,7 +133,7 @@ if ($action == 'delete') {
|
||||
}
|
||||
|
||||
if (GETPOST('code')) { // We are coming from oauth provider page.
|
||||
dol_syslog("We are coming from the oauth provider page");
|
||||
dol_syslog("We are coming from the oauth provider page keyforprovider=".$keyforprovider);
|
||||
|
||||
// We must validate that the $state is the same than the one into $_SESSION['oauthstateanticsrf'], return error if not.
|
||||
if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) {
|
||||
@@ -174,8 +190,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page.
|
||||
}
|
||||
} else {
|
||||
// If we enter this page without 'code' parameter, we arrive here. this is the case when we want to get the redirect
|
||||
// to the OAuth provider login page
|
||||
// to the OAuth provider login page.
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
if (!preg_match('/^forlogin/', $state)) {
|
||||
$apiService->setApprouvalPrompt('force');
|
||||
|
||||
@@ -34,9 +34,12 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtourl = GETPOST('backtourl', 'alpha');
|
||||
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
|
||||
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
|
||||
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -64,9 +67,11 @@ $serviceFactory->setHttpClient($httpClient);
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_STRIPE_LIVE'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_STRIPE_LIVE'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_STRIPE_LIVE_ID,
|
||||
$conf->global->STRIPE_LIVE_SECRET_KEY,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
@@ -84,7 +89,8 @@ if (GETPOST('state')) {
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeLive', entity=".$conf->entity;
|
||||
$servicesuffix = ($keyforprovider ? '-'.$keyforprovider : '');
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token SET service = 'StripeLive".$db->escape($servicesuffix)."', entity = ".((int) $conf->entity);
|
||||
$db->query($sql);
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
@@ -92,6 +98,13 @@ $db->query($sql);
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
if (!getDolGlobalString($keyforparamid)) {
|
||||
accessforbidden('Setup of service is not complete. Customer ID is missing');
|
||||
}
|
||||
if (!getDolGlobalString($keyforparamsecret)) {
|
||||
accessforbidden('Setup of service is not complete. Secret key is missing');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -148,6 +161,8 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} else // If entry on page with no parameter, we arrive here
|
||||
{
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
// This may create record into oauth_state before the header redirect.
|
||||
// Creation of record with state in this tables depend on the Provider used (see its constructor).
|
||||
@@ -156,7 +171,7 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} else {
|
||||
//$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
//https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
|
||||
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_LIVE_ID.'&scope=read_write';
|
||||
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write';
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
|
||||
@@ -34,9 +34,12 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtourl = GETPOST('backtourl', 'alpha');
|
||||
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
|
||||
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
|
||||
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -64,9 +67,11 @@ $serviceFactory->setHttpClient($httpClient);
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_STRIPE_TEST'.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_STRIPE_TEST'.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
$conf->global->OAUTH_STRIPE_TEST_ID,
|
||||
$conf->global->STRIPE_TEST_SECRET_KEY,
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
@@ -84,7 +89,8 @@ if (GETPOST('state')) {
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeTest', entity=".$conf->entity;
|
||||
$servicesuffix = ($keyforprovider ? '-'.$keyforprovider : '');
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token SET service = 'StripeTest".$db->escape($servicesuffix)."', entity = ".((int) $conf->entity);
|
||||
$db->query($sql);
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
@@ -92,6 +98,13 @@ $db->query($sql);
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
if (!getDolGlobalString($keyforparamid)) {
|
||||
accessforbidden('Setup of service is not complete. Customer ID is missing');
|
||||
}
|
||||
if (!getDolGlobalString($keyforparamsecret)) {
|
||||
accessforbidden('Setup of service is not complete. Secret key is missing');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -148,6 +161,8 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} else // If entry on page with no parameter, we arrive here
|
||||
{
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
// This may create record into oauth_state before the header redirect.
|
||||
// Creation of record with state in this tables depend on the Provider used (see its constructor).
|
||||
@@ -156,7 +171,7 @@ if (!empty($_GET['code'])) { // We are coming from oauth provider page
|
||||
} else {
|
||||
//$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
//https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
|
||||
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_TEST_ID.'&scope=read_write';
|
||||
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write';
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
|
||||
@@ -65,6 +65,9 @@ class mod_lot_advanced extends ModeleNumRefBatch
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// We get cursor rule
|
||||
$mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : '';
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@@ -80,13 +83,13 @@ class mod_lot_advanced extends ModeleNumRefBatch
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskLot" value="'.$conf->global->LOT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskLot" value="'.$mask.'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
// Option to enable custom masks per product
|
||||
$texte .= '<td class="right">';
|
||||
if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) {
|
||||
if (!empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS)) {
|
||||
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
@@ -139,7 +142,7 @@ class mod_lot_advanced extends ModeleNumRefBatch
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask = $conf->global->LOT_ADVANCED_MASK;
|
||||
$mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : '';
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@@ -65,6 +65,9 @@ class mod_sn_advanced extends ModeleNumRefBatch
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// We get cursor rule
|
||||
$mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : '';
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@@ -80,13 +83,13 @@ class mod_sn_advanced extends ModeleNumRefBatch
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskSN" value="'.$conf->global->SN_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskSN" value="'.$mask.'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit" name="Button" value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
// Option to enable custom masks per product
|
||||
$texte .= '<td class="right">';
|
||||
if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) {
|
||||
if (!empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)) {
|
||||
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
@@ -139,7 +142,7 @@ class mod_sn_advanced extends ModeleNumRefBatch
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask = $conf->global->SN_ADVANCED_MASK;
|
||||
$mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : '';
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@@ -54,7 +54,7 @@ if (!empty($conf->commande->enabled)) {
|
||||
}
|
||||
if (isModEnabled('facture')) {
|
||||
print '<div id="invoice"></div>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
|
||||
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("bills");
|
||||
@@ -76,7 +76,7 @@ if (isModEnabled('facture')) {
|
||||
}
|
||||
if (!empty($conf->contrat->enabled)) {
|
||||
print '<div id="contractline"></div>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
|
||||
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("contracts");
|
||||
@@ -98,7 +98,7 @@ if (!empty($conf->contrat->enabled)) {
|
||||
}
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
print '<div id="membersubscription"></div>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
|
||||
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("members");
|
||||
@@ -120,7 +120,7 @@ if (!empty($conf->adherent->enabled)) {
|
||||
}
|
||||
if (!empty($conf->don->enabled)) {
|
||||
print '<div id="donation"></div>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
|
||||
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$langs->load("members");
|
||||
|
||||
Reference in New Issue
Block a user