Merge branch 'develop' into socid

This commit is contained in:
Laurent Destailleur 2019-11-02 12:01:06 +01:00 committed by GitHub
commit 25e64b0610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
82 changed files with 1000 additions and 723 deletions

View File

@ -27,6 +27,7 @@ Following changes may create regressions for some external modules, but were nec
* If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu.
* All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'.
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
* All properties 'type_libelle' were renamed into 'type_label'.
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.

View File

@ -431,10 +431,10 @@ class Subscription extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $status Id status
* @return string Label
*/
public function LibStatut($statut)
public function LibStatut($status)
{
// phpcs:enable
global $langs;

View File

@ -42,7 +42,7 @@ if (empty($sortorder)) { $sortorder="ASC"; }
if (empty($sortfield)) { $sortfield="d.login"; }
if (! isset($statut))
{
$statut = 1 ;
$statut = 1;
}
if (! isset($cotis))
@ -54,7 +54,7 @@ if (! isset($cotis))
$sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = $statut ";
$sql .= " WHERE d.statut = ".$statut;
if ($cotis==1)
{
$sql .= " AND datefin > '".$db->idate($now)."'";

View File

@ -236,7 +236,7 @@ foreach($listofnotifiedevents as $notifiedevent)
$s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail=explode(',', $value);
$showwarning=0;
foreach($arrayemail as $key=>$valuedet)
foreach($arrayemail as $keydet => $valuedet)
{
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet, 1)) $showwarning++;

View File

@ -458,7 +458,7 @@ if ($mode == 'searchkey')
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
$title = $langs->trans("TranslationKeySearch");
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')';
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit);
print '<input type="hidden" id="action" name="action" value="search">';
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
@ -466,7 +466,7 @@ if ($mode == 'searchkey')
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder).'</td>';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);

View File

@ -45,43 +45,67 @@ class ActionComm extends CommonObject
*/
public $table_element = 'actioncomm';
/**
* @var string Name of id column
*/
public $table_rowid = 'id';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
* @var string Name of icon for actioncomm object. Filename of icon is object_action.png
*/
public $picto = 'action';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 1;
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user, 2=Same than 1 but accept record if fksoc is empty
* @var integer
* @var integer 0=Default
* 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* 2=Same than 1 but accept record if fksoc is empty
*/
public $restrictiononfksoc = 2;
/**
* Id of the event
* @var int
* @var int Id of the event
*/
public $id;
/**
* Id of the event. Use $id as possible
* @var int
* @var int Id of the event. Use $id as possible
*/
public $ref;
public $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set)
public $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
/**
* @var int Id into parent table llx_c_actioncomm (used only if option to use type is set)
*/
public $type_id;
/**
* @var string Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
*/
public $type_code;
/**
* @var string Type label
*/
public $type_label;
public $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set)
public $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set)
public $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
/**
* @var string Label into parent table llx_c_actioncomm (used only if option to use type is set)
*/
public $type;
/**
* @var string Color into parent table llx_c_actioncomm (used only if option to use type is set)
*/
public $type_color;
/**
* @var string Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
*/
public $code;
/**
* @var string Agenda event label
@ -89,72 +113,56 @@ class ActionComm extends CommonObject
public $label;
/**
* Date creation record (datec)
*
* @var integer
* @var integer Date creation record (datec)
*/
public $datec;
/**
* Date end record (datef)
*
* @var integer
* @var integer Date end record (datef)
*/
public $datef;
/**
* Duration (duree)
*
* @var integer
* @var integer Duration (duree)
*/
public $duree;
/**
* Date modification record (tms)
*
* @var integer
* @var integer Date modification record (tms)
*/
public $datem;
/**
* Object user that create action
* @var User
* @var User Object user that create action
* @deprecated
* @see $authorid
*/
public $author;
/**
* Object user that modified action
* @var User
* @var User Object user that modified action
* @deprecated
* @see $usermodid
*/
public $usermod;
/**
* Id user that create action
* @var int
* @var int Id user that create action
*/
public $authorid;
/**
* Id user that modified action
* @var int
* @var int Id user that modified action
*/
public $usermodid;
/**
* Date action start (datep)
*
* @var integer
* @var integer Date action start (datep)
*/
public $datep;
/**
* Date action end (datep2)
*
* @var integer
* @var integer Date action end (datep2)
*/
public $datep2;
@ -163,90 +171,178 @@ class ActionComm extends CommonObject
* @deprecated
*/
public $durationp = -1;
public $fulldayevent = 0; // 1=Event on full day
/**
* Milestone
* @var int
* @var int 1=Event on full day
*/
public $fulldayevent = 0;
/**
* @var int Milestone
* @deprecated Milestone is already event with end date = start date
*/
public $punctual = 1;
public $percentage; // Percentage
public $location; // Location
public $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
public $priority; // Small int (0 By default)
/**
* @var integer Percentage
*/
public $percentage;
public $userassigned = array(); // Array of user ids
public $userownerid; // Id of user owner = fk_user_action into table
public $userdoneid; // Id of user done (deprecated)
/**
* @var string Location
*/
public $location;
public $socpeopleassigned = array(); // Array of contact ids
/**
* @var int Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
*/
public $transparency;
public $otherassigned = array(); // Array of other contact emails (not user, not contact)
/**
* @var int (0 By default)
*/
public $priority;
/**
* @var int[] Array of user ids
*/
public $userassigned = array();
/**
* @var int Id of user owner = fk_user_action into table
*/
public $userownerid;
/**
* @var int Id of user done (deprecated)
* @deprecated
*/
public $userdoneid;
/**
* @var int[] Array of contact ids
*/
public $socpeopleassigned = array();
/**
* @var int[] Array of other contact emails (not user, not contact)
*/
public $otherassigned = array();
/**
* Object user of owner
* @var User
/**
* @var User Object user of owner
* @deprecated
* @see userownerid
*/
public $usertodo;
/**
* Object user that did action
* @var User
* @var User Object user that did action
* @deprecated
* @see userdoneid
*/
public $userdone;
/**
* @var int thirdparty id linked to action
*/
public $socid;
/**
* @var int socpeople id linked to action
*/
public $contactid;
/**
* Company linked to action (optional)
* @var Societe|null
* @var Societe|null Company linked to action (optional)
* @deprecated
* @see socid
*/
public $societe;
/**
* Contact linked to action (optional)
* @var Contact|null
* @var Contact|null Contact linked to action (optional)
* @deprecated
* @see contactid
*/
public $contact;
// Properties for links to other objects
/**
* @var int Id of linked object
*/
public $fk_element; // Id of record
public $elementid; // Id of record alternative for API
public $elementtype; // Type of record. This if property ->element of object linked to.
// Ical
/**
* @var int Id of record alternative for API
*/
public $elementid;
/**
* @var string Type of record. This if property ->element of object linked to.
*/
public $elementtype;
/**
* @var string Ical name
*/
public $icalname;
/**
* @var string Ical color
*/
public $icalcolor;
/**
* @var array Actions
*/
public $actions=array();
// Fields for emails
/**
* @var string Email msgid
*/
public $email_msgid;
/**
* @var string Email from
*/
public $email_from;
/**
* @var string Email sender
*/
public $email_sender;
/**
* @var string Email to
*/
public $email_to;
/**
* @var string Email tocc
*/
public $email_tocc;
/**
* @var string Email tobcc
*/
public $email_tobcc;
/**
* @var string Email subject
*/
public $email_subject;
/**
* @var string Email errors to
*/
public $errors_to;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{

View File

@ -488,7 +488,7 @@ if ($resql)
if (! empty($arrayfields['a.tms']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.percent']['checked'])) {
print '<td class="liste_titre center">';
print $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
print ajax_combobox('selectstatus');
print '</td>';
}

View File

@ -13,7 +13,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -95,8 +95,17 @@ class Propal extends CommonObject
*/
public $socid;
/**
* ID of the contact
* @var int
*/
public $contactid;
public $author;
/**
* Ref from thirdparty
* @var string
*/
public $ref_client;
/**
@ -240,7 +249,7 @@ class Propal extends CommonObject
* @param int $socid Id third party
* @param int $propalid Id proposal
*/
public function __construct($db, $socid = "", $propalid = 0)
public function __construct($db, $socid = 0, $propalid = 0)
{
global $conf,$langs;

View File

@ -53,19 +53,22 @@ class Commande extends CommonOrder
public $table_element='commande';
/**
* @var int Name of subtable line
* @var string Name of subtable line
*/
public $table_element_line = 'commandedet';
/**
* @var string Name of class line
*/
public $class_element_line = 'OrderLine';
/**
* @var int Field with ID of parent key if this field has a parent
* @var string Field name with ID of parent key if this field has a parent
*/
public $fk_element = 'fk_commande';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
* @var string String with name of icon for commande class. Here is object_order.png
*/
public $picto = 'order';
@ -87,13 +90,23 @@ class Commande extends CommonOrder
protected $table_ref_field = 'ref';
/**
* Client ID
* @var int
* @var int Thirparty ID
*/
public $socid;
/**
* @var string Thirparty ref of order
*/
public $ref_client;
/**
* @var string Internal ref for order
*/
public $ref_int;
/**
* @var int Contact ID
*/
public $contactid;
/**
@ -103,10 +116,9 @@ class Commande extends CommonOrder
public $statut;
/**
* Billed
* @var int
* @var int Status Billed or not
*/
public $billed; // billed or not
public $billed;
/**
* @var int Draft Status of the order
@ -115,25 +127,22 @@ class Commande extends CommonOrder
public $cond_reglement_code;
/**
* @var int ID
* @var int bank account ID
*/
public $fk_account;
/**
* It holds the label of the payment mode. Use it in case translation cannot be found.
* @var string
* @var string It holds the label of the payment mode. Use it in case translation cannot be found.
*/
public $mode_reglement;
/**
* Payment mode id
* @var int
* @var int Payment mode id
*/
public $mode_reglement_id;
/**
* Payment mode code
* @var string
* @var string Payment mode code
*/
public $mode_reglement_code;
@ -157,9 +166,13 @@ class Commande extends CommonOrder
public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...)
public $demand_reason_code;
public $date; // Date commande
/**
* @var int Date of order
*/
public $date;
/**
* @var int Date of order
* @deprecated
* @see $date
*/
@ -182,7 +195,14 @@ class Commande extends CommonOrder
public $linked_objects=array();
/**
* @var int User author ID
*/
public $user_author_id;
/**
* @var int User validator ID
*/
public $user_valid;
/**
@ -192,7 +212,7 @@ class Commande extends CommonOrder
// Multicurrency
/**
* @var int ID
* @var int Currency ID
*/
public $fk_multicurrency;
@ -202,6 +222,9 @@ class Commande extends CommonOrder
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
/**
* @var Commande clone of order object
*/
public $oldcopy;
//! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...)

View File

@ -138,7 +138,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print "</tr>\n";
$sql = "SELECT c.id, c.libelle as lib,";
$sql = "SELECT c.id, c.libelle as label,";
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql.= " pct.code as payment_code,";
@ -185,12 +185,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
// Label
print '<td>';
$socialcontrib->id=$obj->rowid;
$socialcontrib->ref=$obj->libelle;
$socialcontrib->lib=$obj->libelle;
$socialcontrib->ref=$obj->label;
$socialcontrib->label=$obj->label;
print $socialcontrib->getNomUrl(1, '20');
print '</td>';
// Type
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->label.'</a></td>';
// Expected to pay
print '<td class="right">'.price($obj->total).'</td>';
// Ref payment

View File

@ -624,12 +624,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$chargestatic=new ChargeSociales($db);
$sql = "SELECT c.rowid, c.amount, c.date_ech, c.paye,";
$sql.= " cc.libelle,";
$sql.= " cc.libelle as label,";
$sql.= " SUM(pc.amount) as sumpaid";
$sql.= " FROM (".MAIN_DB_PREFIX."c_chargesociales as cc, ".MAIN_DB_PREFIX."chargesociales as c)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = c.rowid";
$sql.= " WHERE c.fk_type = cc.id";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.entity IN (".getEntity('tax').')';
$sql.= " AND c.paye = 0";
// Add where from hooks
$parameters=array();
@ -661,8 +661,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$obj = $db->fetch_object($resql);
$chargestatic->id=$obj->rowid;
$chargestatic->ref=$obj->libelle;
$chargestatic->lib=$obj->libelle;
$chargestatic->ref=$obj->rowid;
$chargestatic->label=$obj->label;
$chargestatic->paye=$obj->paye;
print '<tr class="oddeven">';
@ -672,6 +672,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print '<td class="nowrap right">'.price($obj->sumpaid).'</td>';
print '<td align="center">'.$chargestatic->getLibStatut(3).'</td>';
print '</tr>';
$tot_ttc+=$obj->amount;
$i++;
}

View File

@ -220,7 +220,7 @@ print $form->editfieldval("Date", 'datep', $object->date, $object, $user->rights
print '</td></tr>';
// Payment type (VIR, LIQ, ...)
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_label;
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'.$labeltype;
print $object->num_paiement?' - '.$object->num_paiement:'';
print '</td></tr>';

View File

@ -78,7 +78,7 @@ class Paiement extends CommonObject
/**
* @var string type libelle
*/
public $type_libelle;
public $type_label;
/**
* @var string type code
@ -160,7 +160,7 @@ class Paiement extends CommonObject
public function fetch($id, $ref = '', $fk_bank = '')
{
$sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,';
$sql.= ' c.code as type_code, c.libelle as type_libelle,';
$sql.= ' c.code as type_code, c.libelle as type_label,';
$sql.= ' p.num_paiement as num_payment, p.note,';
$sql.= ' b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
@ -188,7 +188,7 @@ class Paiement extends CommonObject
$this->montant = $obj->amount; // deprecated
$this->amount = $obj->amount;
$this->note = $obj->note;
$this->type_libelle = $obj->type_libelle;
$this->type_label = $obj->type_label;
$this->type_code = $obj->type_code;
$this->statut = $obj->statut;
$this->ext_payment_id = $obj->ext_payment_id;

View File

@ -202,7 +202,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_label."</td></tr>\n";
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode, 'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->label."</td></tr>\n";
/*print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";

View File

@ -259,7 +259,7 @@ if ($resql)
print "</td>\n";
// Type
print '<td>';
print $socialcontrib->type_libelle;
print $socialcontrib->type_label;
/*print $socialcontrib->type;*/
print "</td>\n";
// Label

View File

@ -514,7 +514,7 @@ if ($id > 0)
print '<table class="border" width="100%">';
// Type
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_label."</td>";
print "</tr>";
// Period end date

View File

@ -57,7 +57,7 @@ class ChargeSociales extends CommonObject
public $date_ech;
public $label;
public $type;
public $type_libelle;
public $type_label;
public $amount;
public $paye;
public $periode;
@ -136,7 +136,7 @@ class ChargeSociales extends CommonObject
$this->lib = $obj->label;
$this->label = $obj->label;
$this->type = $obj->fk_type;
$this->type_libelle = $obj->libelle;
$this->type_label = $obj->libelle;
$this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
@ -556,8 +556,8 @@ class ChargeSociales extends CommonObject
$label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->label))
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $this->label;
if (! empty($this->type_libelle))
$label .= '<br><b>'.$langs->trans('Type') . ':</b> ' . $this->type_libelle;
if (! empty($this->type_label))
$label .= '<br><b>'.$langs->trans('Type') . ':</b> ' . $this->type_label;
$linkclose='';
if (empty($notooltip) && $user->rights->facture->lire)
@ -689,6 +689,6 @@ class ChargeSociales extends CommonObject
$this->amount=100;
$this->label = 'Social contribution label';
$this->type = 1;
$this->type_libelle = 'Type of social contribution';
$this->type_label = 'Type of social contribution';
}
}

View File

@ -236,7 +236,7 @@ class PaymentSocialContribution extends CommonObject
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
@ -267,7 +267,7 @@ class PaymentSocialContribution extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
@ -592,7 +592,7 @@ class PaymentSocialContribution extends CommonObject
{
$socialcontrib = new ChargeSociales($this->db);
$socialcontrib->fetch($key);
$result=$acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_libelle.(($socialcontrib->lib && $socialcontrib->lib!=$socialcontrib->type_libelle)?' ('.$socialcontrib->lib.')':''), 'sc');
$result=$acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib!=$socialcontrib->type_label)?' ('.$socialcontrib->lib.')':''), 'sc');
if ($result <= 0) dol_print_error($this->db);
}
}

View File

@ -79,8 +79,8 @@ dol_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, 'bill');
$morehtmlref='<div class="refidno">';
// Label of social contribution
$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled))
{

View File

@ -110,8 +110,8 @@ $chargesociale_static=new ChargeSociales($db);
llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
$sql.= " c.libelle as type_lib,";
$sql.= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
$sql.= " c.libelle as type_label,";
$sql.= " SUM(pc.amount) as alreadypayed";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
@ -261,8 +261,8 @@ if ($resql)
$chargesociale_static->id=$obj->id;
$chargesociale_static->ref=$obj->id;
$chargesociale_static->lib=$obj->libelle;
$chargesociale_static->type_libelle=$obj->type_lib;
$chargesociale_static->label=$obj->label;
$chargesociale_static->type_label=$obj->type_label;
print '<tr class="oddeven">';
@ -272,10 +272,10 @@ if ($resql)
print '</td>';
// Label
print '<td>'.dol_trunc($obj->libelle, 42).'</td>';
print '<td>'.dol_trunc($obj->label, 42).'</td>';
// Type
print '<td>'.$obj->type_lib.'</td>';
print '<td>'.$obj->type_label.'</td>';
// Date end period
print '<td align="center">';

View File

@ -176,8 +176,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
// Label
print '<td>';
$socialcontrib->id=$obj->rowid;
$socialcontrib->ref=$obj->libelle;
$socialcontrib->lib=$obj->libelle;
$socialcontrib->ref=$obj->rowid;
$socialcontrib->label=$obj->libelle;
print $socialcontrib->getNomUrl(1, '20');
print '</td>';
// Type

View File

@ -2068,10 +2068,10 @@ class Contrat extends CommonObject
/**
* Return list of line rowid
*
* @param int $statut Status of lines to get
* @param int $status Status of lines to get
* @return array|int Array of line's rowid or <0 if error
*/
public function array_detail($statut = -1)
public function array_detail($status = -1)
{
// phpcs:enable
$tab=array();
@ -2079,7 +2079,7 @@ class Contrat extends CommonObject
$sql = "SELECT cd.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " WHERE fk_contrat =".$this->id;
if ($statut >= 0) $sql.= " AND statut = '$statut'";
if ($status >= 0) $sql.= " AND statut = ".$status;
dol_syslog(get_class($this)."::array_detail()", LOG_DEBUG);
$resql=$this->db->query($sql);

View File

@ -135,7 +135,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
@ -180,7 +181,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$endyear.'.png';
$px2 = new DolGraph();

View File

@ -132,7 +132,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$year.'.png';
$px1 = new DolGraph();
@ -143,7 +144,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$px1->SetData($data1);
unset($data1);
$i=$startyear;$legend=array();
$i=$startyear;
$legend=array();
while ($i <= $endyear)
{
if ($startmonth != 1)
@ -177,7 +179,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$year.'.png';
$px2 = new DolGraph();

View File

@ -135,7 +135,8 @@ class box_graph_orders_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersnbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
@ -144,7 +145,8 @@ class box_graph_orders_permonth extends ModeleBoxes
{
$px1->SetData($data1);
unset($data1);
$i=$startyear;$legend=array();
$i=$startyear;
$legend=array();
while ($i <= $endyear)
{
if ($startmonth != 1)
@ -178,7 +180,8 @@ class box_graph_orders_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=ordersamountinyear-'.$endyear.'.png';
$px2 = new DolGraph();

View File

@ -134,7 +134,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssuppliernbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
@ -143,7 +144,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
{
$px1->SetData($data1);
unset($data1);
$i=$startyear;$legend=array();
$i=$startyear;
$legend=array();
while ($i <= $endyear)
{
if ($startmonth != 1)
@ -177,7 +179,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&amp;file=orderssupplieramountinyear-'.$endyear.'.png';
$px2 = new DolGraph();

View File

@ -1057,13 +1057,13 @@ abstract class CommonObject
/**
* Get array of all contacts for an object
*
* @param int $statut Status of links to get (-1=all)
* @param int $status Status of links to get (-1=all)
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param int $list 0:Return array contains all properties, 1:Return array contains just id
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
* @return array|int Array of contacts, -1 if error
*/
public function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '')
public function liste_contact($status = -1, $source = 'external', $list = 0, $code = '')
{
// phpcs:enable
global $langs;
@ -1086,7 +1086,7 @@ abstract class CommonObject
if ($source == 'internal') $sql.= " AND tc.source = 'internal'";
if ($source == 'external' || $source == 'thirdparty') $sql.= " AND tc.source = 'external'";
$sql.= " AND tc.active=1";
if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'";
if ($status >= 0) $sql.= " AND ec.statut = ".$status;
$sql.=" ORDER BY t.lastname ASC";
dol_syslog(get_class($this)."::liste_contact", LOG_DEBUG);

View File

@ -3765,7 +3765,7 @@ class Form
*
* @param string $selected Id account pre-selected
* @param string $htmlname Name of select zone
* @param int $statut Status of searched accounts (0=open, 1=closed, 2=both)
* @param int $status Status of searched accounts (0=open, 1=closed, 2=both)
* @param string $filtre To filter list
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select
@ -3773,7 +3773,7 @@ class Form
* @param string $morecss More CSS
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
*/
public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
{
// phpcs:enable
global $langs, $conf;
@ -3784,7 +3784,7 @@ class Form
$sql = "SELECT rowid, label, bank, clos as status, currency_code";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity IN (".getEntity('bank_account').")";
if ($statut != 2) $sql.= " AND clos = '".$statut."'";
if ($status != 2) $sql.= " AND clos = ".(int) $status;
if ($filtre) $sql.=" AND ".$filtre;
$sql.= " ORDER BY label";
@ -3815,7 +3815,7 @@ class Form
}
print trim($obj->label);
if ($showcurrency) print ' ('.$obj->currency_code.')';
if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
if ($status == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
print '</option>';
$i++;
}
@ -3823,7 +3823,7 @@ class Form
}
else
{
if ($statut == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
if ($status == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
else print '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
}
}
@ -3839,13 +3839,13 @@ class Form
*
* @param string $selected Id establishment pre-selected
* @param string $htmlname Name of select zone
* @param int $statut Status of searched establishment (0=open, 1=closed, 2=both)
* @param int $status Status of searched establishment (0=open, 1=closed, 2=both)
* @param string $filtre To filter list
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select
* @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...)
*/
public function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '')
public function selectEstablishments($selected = '', $htmlname = 'entity', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '')
{
// phpcs:enable
global $langs, $conf;
@ -3856,7 +3856,7 @@ class Form
$sql = "SELECT rowid, name, fk_country, status, entity";
$sql.= " FROM ".MAIN_DB_PREFIX."establishment";
$sql.= " WHERE 1=1";
if ($statut != 2) $sql.= " AND status = '".$statut."'";
if ($status != 2) $sql.= " AND status = ".(int) $status;
if ($filtre) $sql.=" AND ".$filtre;
$sql.= " ORDER BY name";
@ -3886,7 +3886,7 @@ class Form
print '<option value="'.$obj->rowid.'">';
}
print trim($obj->name);
if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
if ($status == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
print '</option>';
$i++;
}
@ -3894,7 +3894,7 @@ class Form
}
else
{
if ($statut == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
if ($status == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
else print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
}
}
@ -5344,13 +5344,14 @@ class Form
* @param int $disabled Disable input fields
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @param string $openinghours Specify hour strat and hour end for the select ex 8,20
* @param datetime $adddateof Add a link "Date of invoice" using the following date. See also $labeladddateof for the label used.
* @param string $openinghours Specify hour start and hour end for the select ex 8,20
* @param int $stepminutes Specify step for minutes between 1 and 30
* @param string $labeladddateof Label to use for the $adddateof parameter.
* @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1)
public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '')
{
global $conf,$langs;
@ -5737,7 +5738,8 @@ class Form
if ($conf->use_javascript_ajax && $adddateof)
{
$tmparray=dol_getdate($adddateof);
$retstring.=' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$langs->trans("DateInvoice").'</a>';
if (empty($labeladddateof)) $labeladddateof = $langs->trans("DateInvoice");
$retstring.=' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$labeladddateof.'</a>';
}
return $retstring;

View File

@ -1991,56 +1991,48 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $
if ($second< 0 || $second > 60) return '';
}
if (method_exists('DateTime', 'getTimestamp'))
if (empty($gm) || $gm === 'server')
{
if (empty($gm) || $gm === 'server')
{
$default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin'
$default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin'
$localtz = new DateTimeZone($default_timezone);
}
elseif ($gm === 'user')
{
// We use dol_tz_string first because it is more reliable.
$default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin'
try {
$localtz = new DateTimeZone($default_timezone);
}
elseif ($gm === 'user')
catch(Exception $e)
{
// We use dol_tz_string first because it is more reliable.
$default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin'
try {
$localtz = new DateTimeZone($default_timezone);
}
catch(Exception $e)
{
dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING);
$default_timezone=@date_default_timezone_get();
}
dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING);
$default_timezone=@date_default_timezone_get();
}
elseif (strrpos($gm, "tz,") !== false)
{
$timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin'
try
{
$localtz = new DateTimeZone($timezone);
}
catch(Exception $e)
{
dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING);
}
}
if (empty($localtz)) {
$localtz = new DateTimeZone('UTC');
}
//var_dump($localtz);
//var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
$dt = new DateTime(null, $localtz);
$dt->setDate((int) $year, (int) $month, (int) $day);
$dt->setTime((int) $hour, (int) $minute, (int) $second);
$date=$dt->getTimestamp(); // should include daylight saving time
//var_dump($date);
return $date;
}
else
elseif (strrpos($gm, "tz,") !== false)
{
dol_print_error('', 'PHP version must be 5.4+');
return '';
$timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin'
try
{
$localtz = new DateTimeZone($timezone);
}
catch(Exception $e)
{
dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING);
}
}
if (empty($localtz)) {
$localtz = new DateTimeZone('UTC');
}
//var_dump($localtz);
//var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
$dt = new DateTime(null, $localtz);
$dt->setDate((int) $year, (int) $month, (int) $day);
$dt->setTime((int) $hour, (int) $minute, (int) $second);
$date=$dt->getTimestamp(); // should include daylight saving time
//var_dump($date);
return $date;
}

View File

@ -1749,12 +1749,12 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
* @param int $socid Id thirdparty
* @param int $projectsListId Id of project I have permission on
* @param int $mytasks Limited to task I am contact to
* @param int $statut -1=No filter on statut, 0 or 1 = Filter on status
* @param int $status -1=No filter on statut, 0 or 1 = Filter on status
* @param array $listofoppstatus List of opportunity status
* @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', )
* @return void
*/
function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $statut = -1, $listofoppstatus = array(), $hiddenfields = array())
function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array())
{
global $langs,$conf,$user,$bc;
@ -1768,7 +1768,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$project_year_filter=0;
$title=$langs->trans("Projects");
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
if (strcmp($status, '') && $status >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]);
$arrayidtypeofcontact=array();
@ -1797,9 +1797,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
$sql.= " AND ctc.element = 'project_task'";
}
if ($statut >= 0)
if ($status >= 0)
{
$sql.= " AND p.fk_statut = ".$statut;
$sql.= " AND p.fk_statut = ".(int) $status;
}
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE))
{

View File

@ -31,6 +31,10 @@ class mailing_advthirdparties extends MailingTargets
public $require_admin=0;
public $require_module=array("none"); // This module should not be displayed as Selector in mailling
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='company';
/**

View File

@ -37,6 +37,10 @@ class mailing_contacts1 extends MailingTargets
public $desc='Contacts of thirdparties (prospects, customers, suppliers...)';
public $require_module=array("societe"); // Module mailing actif si modules require_module actifs
public $require_admin=0; // Module mailing actif pour user admin ou non
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='contact';
/**

View File

@ -36,6 +36,10 @@ class mailing_example extends MailingTargets
public $tooltip='MyTooltipLangKey';
public $require_module=array();
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='';
/**

View File

@ -40,6 +40,10 @@ class mailing_fraise extends MailingTargets
public $require_admin=0;
public $require_module=array('adherent');
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='user';
/**

View File

@ -35,6 +35,10 @@ class mailing_pomme extends MailingTargets
public $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e
public $require_module=array(); // Module mailing actif si modules require_module actifs
public $require_admin=1; // Module mailing actif pour user admin ou non
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='user';
/**

View File

@ -30,6 +30,10 @@ class mailing_thirdparties extends MailingTargets
public $require_admin=0;
public $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='company';
/**

View File

@ -28,6 +28,10 @@ class mailing_thirdparties_services_expired extends MailingTargets
public $require_admin=0;
public $require_module=array('contrat');
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='company';
/**

View File

@ -35,6 +35,10 @@ class mailing_xinputfile extends MailingTargets
public $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e
public $require_module=array(); // Module mailing actif si modules require_module actifs
public $require_admin=0; // Module mailing actif pour user admin ou non
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='generic';
public $tooltip='UseFormatFileEmailToTarget';

View File

@ -35,6 +35,10 @@ class mailing_xinputuser extends MailingTargets
public $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e
public $require_module=array(); // Module mailing actif si modules require_module actifs
public $require_admin=0; // Module mailing actif pour user admin ou non
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='generic';
public $tooltip='UseFormatInputEmailToTarget';

View File

@ -37,6 +37,10 @@ class printing_printgcp extends PrintingDriver
{
public $name = 'printgcp';
public $desc = 'PrintGCPDesc';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'printer';
public $active = 'PRINTING_PRINTGCP';
public $conf = array();

View File

@ -32,6 +32,10 @@ class printing_printipp extends PrintingDriver
{
public $name = 'printipp';
public $desc = 'PrintIPPDesc';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'printer';
public $active = 'PRINTING_PRINTIPP';
public $conf = array();

View File

@ -564,7 +564,7 @@ if (! empty($id) && $action == 'edit')
}
// Payment mode
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
if ($object->modepaymentid) $selected = $object->modepaymentid;
if ($object->mode_reglement_id) $selected = $object->mode_reglement_id;
else $selected = '';
$form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
print "</td></tr>\n";
@ -708,7 +708,7 @@ if (! empty($id) && $action != 'edit')
// Payment mode
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
$form->form_modes_reglement(null, $object->modepaymentid, 'none');
$form->form_modes_reglement(null, $object->mode_reglement_id, 'none');
print "</td></tr>\n";
// Other attributes

View File

@ -83,6 +83,10 @@ class PaymentDonation extends CommonObject
*/
public $total;
public $type_code;
public $type_label;
/**
* Constructor
*
@ -121,7 +125,7 @@ class PaymentDonation extends CommonObject
if (isset($this->amount)) $this->amount=trim($this->amount);
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
if (isset($this->note)) $this->note=trim($this->note);
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
@ -148,7 +152,7 @@ class PaymentDonation extends CommonObject
$sql.= " VALUES ($this->chid, '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datepaid)."',";
$sql.= " ".$totalamount.",";
$sql.= " ".$this->paymenttype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
$sql.= " ".$this->paymenttype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".$user->id.",";
$sql.= " 0)";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
@ -205,11 +209,11 @@ class PaymentDonation extends CommonObject
$sql.= " t.amount,";
$sql.= " t.fk_typepayment,";
$sql.= " t.num_payment,";
$sql.= " t.note,";
$sql.= " t.note as note_public,";
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@ -234,13 +238,13 @@ class PaymentDonation extends CommonObject
$this->amount = $obj->amount;
$this->fk_typepayment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
@ -275,7 +279,7 @@ class PaymentDonation extends CommonObject
if (isset($this->amount)) $this->amount=trim($this->amount);
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
if (isset($this->note)) $this->note=trim($this->note);
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
@ -292,7 +296,7 @@ class PaymentDonation extends CommonObject
$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
$sql.= " fk_typepayment=".(isset($this->fk_typepayment)?$this->fk_typepayment:"null").",";
$sql.= " num_payment=".(isset($this->num_payment)?"'".$this->db->escape($this->num_payment)."'":"null").",";
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
$sql.= " note=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
$sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").",";
$sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").",";
$sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null")."";
@ -505,7 +509,7 @@ class PaymentDonation extends CommonObject
$this->amount='';
$this->fk_typepayment='';
$this->num_payment='';
$this->note='';
$this->note_public='';
$this->fk_bank='';
$this->fk_user_creat='';
$this->fk_user_modif='';

View File

@ -43,7 +43,7 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.datedon";
$statut=(GETPOST("statut", 'intcomma')!='')?GETPOST("statut", 'intcomma'):"-1";
$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-1";
$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST('search_ref', 'alpha');
$search_company=GETPOST('search_company', 'alpha');
@ -87,13 +87,13 @@ $donationstatic=new Don($db);
// Genere requete de liste des dons
$sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
$sql.= " d.amount, d.fk_statut as statut, ";
$sql.= " d.amount, d.fk_statut as status,";
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
if ($statut != '' && $statut != '-1')
if ($search_status != '' && $search_status != '-1')
{
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
$sql .= " AND d.fk_statut IN (".$db->escape($search_status).")";
}
if (trim($search_ref) != '')
{
@ -135,9 +135,13 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
$param = '&statut='.$statut;
//if ($page > 0) $param.= '&page='.$page;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
$param = '';
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_status && $search_status != -1) $param .= '&search_status='.urlencode($search_status);
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
if ($search_company) $param .= '&search_company='.urlencode($search_company);
if ($search_name) $param .= '&search_name='.urlencode($search_name);
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
$newcardbutton='';
if ($user->rights->don->creer)
@ -257,7 +261,7 @@ if ($resql)
print "</td>\n";
}
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right">'.$donationstatic->LibStatut($objp->statut, 5).'</td>';
print '<td class="right">'.$donationstatic->LibStatut($objp->status, 5).'</td>';
print '<td></td>';
print "</tr>";
$i++;

View File

@ -172,8 +172,8 @@ print '<tr><td>'.$langs->trans('Number').'</td><td>'.$object->num_payment.'</td>
// Amount
print '<tr><td>'.$langs->trans('Amount').'</td><td>'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
// Note
print '<tr><td>'.$langs->trans('Note').'</td><td>'.nl2br($object->note).'</td></tr>';
// Note public
print '<tr><td>'.$langs->trans('Note').'</td><td>'.nl2br($object->note_public).'</td></tr>';
// Bank account
if (! empty($conf->banque->enabled))
@ -282,7 +282,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
}
*/
if ($_GET['action'] == '')
if (empty($action))
{
if ($user->rights->don->supprimer)
{

View File

@ -39,6 +39,8 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$object = new Don($db);
/*
* Actions
@ -59,17 +61,17 @@ if ($action == 'add_payment')
if (! $_POST["paymenttype"] > 0)
{
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
$error++;
}
if ($datepaid == '')
{
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Date"));
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$error++;
}
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
{
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit"));
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
$error++;
}
@ -103,9 +105,9 @@ if ($action == 'add_payment')
$payment->chid = $chid;
$payment->datepaid = $datepaid;
$payment->amounts = $amounts; // Tableau de montant
$payment->paymenttype = $_POST["paymenttype"];
$payment->num_payment = $_POST["num_payment"];
$payment->note = $_POST["note"];
$payment->paymenttype = GETPOST("paymenttype", 'int');
$payment->num_payment = GETPOST("num_payment", 'alphanohtml');
$payment->note_public = GETPOST("note_public", 'none');
if (! $error)
{
@ -143,7 +145,7 @@ if ($action == 'add_payment')
}
}
$_GET["action"]='create';
$action = 'create';
}
@ -151,26 +153,32 @@ if ($action == 'add_payment')
* View
*/
$form=new Form($db);
llxHeader();
$form=new Form($db);
$sql = "SELECT sum(p.amount) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
$sql.= " WHERE p.fk_donation = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
}
// Form to create donation payment
if (GETPOST('action', 'aZ09') == 'create')
if ($action == 'create')
{
$don = new Don($db);
$don->fetch($chid);
$object->fetch($chid);
$total = $don->amount;
$total = $object->amount;
print load_fiche_titre($langs->trans("DoPayment"));
if ($mesg)
{
print "<div class=\"error\">$mesg</div>";
}
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="rowid" value="'.$chid.'">';
@ -179,47 +187,24 @@ if (GETPOST('action', 'aZ09') == 'create')
dol_fiche_head();
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Donation").'</td>';
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/don/card.php?rowid='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td>'.$langs->trans("Date")."</td><td colspan=\"2\">".dol_print_date($don->date, 'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Amount")."</td><td colspan=\"2\">".price($don->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
$sql = "SELECT sum(p.amount) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
$sql.= " WHERE p.fk_donation = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
}
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2">'.price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td colspan="2">'.price($total-$sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
print '<tr class="liste_titre">';
print "<td colspan=\"3\">".$langs->trans("Payment").'</td>';
print '</tr>';
print '<table class="border centpercent tableforfieldcreate">';
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0;
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1, 0, '', '', $object->date, '', 1, $langs->trans("DonationDate"));
print "</td>";
print '</tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td colspan="2">';
$form->select_types_paiements(isset($_POST["paymenttype"])?$_POST["paymenttype"]:$don->paymenttype, "paymenttype");
$form->select_types_paiements(isset($_POST["paymenttype"])?$_POST["paymenttype"]:$object->paymenttype, "paymenttype");
print "</td>\n";
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToCredit').'</td>';
print '<td colspan="2">';
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$don->accountid, "accountid", 0, '', 1); // Show open bank account list
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$object->accountid, "accountid", 0, '', 1); // Show open bank account list
print '</td></tr>';
// Number
@ -230,7 +215,7 @@ if (GETPOST('action', 'aZ09') == 'create')
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td valign="top" colspan="2"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '<td valign="top" colspan="2"><textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '</tr>';
print '</table>';
@ -246,6 +231,7 @@ if (GETPOST('action', 'aZ09') == 'create')
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Donation").'</td>';
print '<td class="right">'.$langs->trans("Amount").'</td>';
print '<td class="right">'.$langs->trans("AlreadyPaid").'</td>';
print '<td class="right">'.$langs->trans("RemainderToPay").'</td>';
@ -257,10 +243,12 @@ if (GETPOST('action', 'aZ09') == 'create')
while ($i < $num)
{
$objp = $don;
$objp = $object;
print '<tr class="oddeven">';
print '<td>'.$object->getNomUrl(1)."</td>";
print '<td class="right">'.price($objp->amount)."</td>";
print '<td class="right">'.price($sumpaid)."</td>";

View File

@ -46,6 +46,10 @@ class ExpenseReport extends CommonObject
public $table_element_line = 'expensereport_det';
public $fk_element = 'fk_expensereport';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'trip';
public $lines=array();

View File

@ -25,8 +25,8 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** \class PaymentExpenseReport
* \brief Class to manage payments of expense report
/**
* Class to manage payments of expense report
*/
class PaymentExpenseReport extends CommonObject
{
@ -83,9 +83,9 @@ class PaymentExpenseReport extends CommonObject
*/
public $fk_user_modif;
//Unknow field
public $chid;
public $total;
public $type_code;
public $type_label;
/**
* Constructor
@ -124,10 +124,10 @@ class PaymentExpenseReport extends CommonObject
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
if (isset($this->note)) $this->note=trim($this->note);
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
if (! empty($this->fk_expensereport)) $this->chid = $this->fk_expensereport;
$totalamount = 0;
foreach ($this->amounts as $key => $value) // How payment is dispatch
@ -148,10 +148,10 @@ class PaymentExpenseReport extends CommonObject
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_expensereport (fk_expensereport, datec, datep, amount,";
$sql.= " fk_typepayment, num_payment, note, fk_user_creat, fk_bank)";
$sql.= " VALUES ($this->chid, '".$this->db->idate($now)."',";
$sql.= " VALUES ($this->fk_expensereport, '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datepaid)."',";
$sql.= " ".$totalamount.",";
$sql.= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
$sql.= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".$user->id.",";
$sql.= " 0)";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
@ -188,7 +188,6 @@ class PaymentExpenseReport extends CommonObject
*/
public function fetch($id)
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.fk_expensereport,";
@ -198,11 +197,11 @@ class PaymentExpenseReport extends CommonObject
$sql.= " t.amount,";
$sql.= " t.fk_typepayment,";
$sql.= " t.num_payment,";
$sql.= " t.note,";
$sql.= " t.note as note_public,";
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@ -227,13 +226,13 @@ class PaymentExpenseReport extends CommonObject
$this->amount = $obj->amount;
$this->fk_typepayment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
@ -540,8 +539,7 @@ class PaymentExpenseReport extends CommonObject
$acc->fetch($accountid);
//Fix me field
$this->total = $this->amount;
$total = $this->total;
$total = $this->amount;
if ($mode == 'payment_expensereport') $amount=$total;

View File

@ -162,8 +162,8 @@ print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$object->num_pa
// Amount
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
// Note
print '<tr><td class="tdtop">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';
// Note public
print '<tr><td class="tdtop">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note_public).'</td></tr>';
$disable_delete = 0;
// Bank account
@ -258,7 +258,7 @@ if ($resql)
print '<td class="right">'.price($objp->amount).'</td>';
// Remain to pay
print '<td class="right">'.price($remaintopay).'</td>';
print '<td class="right">'.price($objp->total_ttc - $objp->amount).'</td>';
// Status
print '<td class="center">'.$expensereport->getLibStatut(4, $objp->amount).'</td>';

View File

@ -113,13 +113,13 @@ if ($action == 'add_payment')
// Create a line of payments
$payment = new PaymentExpenseReport($db);
$payment->chid = $expensereport->id;
$payment->fk_expensereport = $expensereport->id;
$payment->datepaid = $datepaid;
$payment->amounts = $amounts; // Tableau de montant
$payment->total = $total;
$payment->fk_typepayment = $_POST["fk_typepayment"];
$payment->num_payment = $_POST["num_payment"];
$payment->note = $_POST["note"];
$payment->fk_typepayment = GETPOST("fk_typepayment", 'int');
$payment->num_payment = GETPOST("num_payment", 'alphanothtml');
$payment->note_public = GETPOST("note_public", 'none');
if (! $error)
{
@ -239,9 +239,11 @@ if ($action == 'create' || empty($action))
print '</table>';
print '<br>';
print '</div>';
print '<div class="underbanner clearboth"></div>';
dol_fiche_end();
dol_fiche_head();
print '<table class="border centpercent">'."\n";
@ -274,14 +276,14 @@ if ($action == 'create' || empty($action))
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td valign="top" colspan="2"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '<td valign="top" colspan="2"><textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '</tr>';
print '</table>';
print '</div>';
dol_fiche_end();
dol_fiche_end();
print '<br>';
// List of expenses ereport not already paid completely
$num = 1;
@ -289,6 +291,7 @@ if ($action == 'create' || empty($action))
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ExpenseReport").'</td>';
print '<td class="right">'.$langs->trans("Amount").'</td>';
print '<td class="right">'.$langs->trans("AlreadyPaid").'</td>';
print '<td class="right">'.$langs->trans("RemainderToPay").'</td>';
@ -304,6 +307,7 @@ if ($action == 'create' || empty($action))
print '<tr class="oddeven">';
print '<td>'.$expensereport->getNomUrl(1)."</td>";
print '<td class="right">'.price($objp->total_ttc)."</td>";
print '<td class="right">'.price($sumpaid)."</td>";
print '<td class="right">'.price($objp->total_ttc - $sumpaid)."</td>";

View File

@ -42,6 +42,10 @@ class FichinterRec extends Fichinter
public $table_element = 'fichinter_rec';
public $table_element_line = 'fichinter_rec';
public $fk_element = 'fk_fichinter';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'intervention';
public $title;

View File

@ -28,180 +28,180 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
*/
class SupplierOrders extends DolibarrApi
{
/**
*
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'socid'
);
/**
*
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'socid'
);
/**
* @var CommandeFournisseur $order {@type CommandeFournisseur}
*/
public $order;
/**
* @var CommandeFournisseur $order {@type CommandeFournisseur}
*/
public $order;
/**
* Constructor
*/
public function __construct()
{
global $db, $conf;
$this->db = $db;
$this->order = new CommandeFournisseur($this->db);
}
/**
* Constructor
*/
public function __construct()
{
global $db, $conf;
$this->db = $db;
$this->order = new CommandeFournisseur($this->db);
}
/**
* Get properties of a supplier order object
*
* Return an array with supplier order information
*
* @param int $id ID of supplier order
* @return array|mixed data without useless information
*
* @throws RestException
*/
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
throw new RestException(401);
}
/**
* Get properties of a supplier order object
*
* Return an array with supplier order information
*
* @param int $id ID of supplier order
* @return array|mixed data without useless information
*
* @throws RestException
*/
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
throw new RestException(401);
}
$result = $this->order->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Supplier order not found');
}
$result = $this->order->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Supplier order not found');
}
if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->order->fetchObjectLinked();
return $this->_cleanObjectDatas($this->order);
}
$this->order->fetchObjectLinked();
return $this->_cleanObjectDatas($this->order);
}
/**
* List orders
*
* Get a list of supplier orders
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @return array Array of order objects
*
* @throws RestException
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
{
global $db, $conf;
/**
* List orders
*
* Get a list of supplier orders
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @return array Array of order objects
*
* @throws RestException
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
{
global $db, $conf;
$obj_ret = array();
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids;
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t";
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Filter by status
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)";
if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)";
if ($status == 'running') $sql.= " AND t.fk_statut IN (3)";
if ($status == 'received_start') $sql.= " AND t.fk_statut IN (4)";
if ($status == 'received_end') $sql.= " AND t.fk_statut IN (5)";
if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (6,7)";
if ($status == 'refused') $sql.= " AND t.fk_statut IN (9)";
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
// Filter by status
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)";
if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)";
if ($status == 'running') $sql.= " AND t.fk_statut IN (3)";
if ($status == 'received_start') $sql.= " AND t.fk_statut IN (4)";
if ($status == 'received_end') $sql.= " AND t.fk_statut IN (5)";
if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (6,7)";
if ($status == 'refused') $sql.= " AND t.fk_statut IN (9)";
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
$sql.= $db->plimit($limit + 1, $offset);
}
$sql.= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
$i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$order_static = new CommandeFournisseur($db);
if($order_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($order_static);
}
$i++;
}
}
else {
throw new RestException(503, 'Error when retrieve supplier order list : '.$db->lasterror());
}
if( ! count($obj_ret)) {
throw new RestException(404, 'No supplier order found');
}
return $obj_ret;
}
$result = $db->query($sql);
if ($result)
{
$i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$order_static = new CommandeFournisseur($db);
if($order_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($order_static);
}
$i++;
}
}
else {
throw new RestException(503, 'Error when retrieve supplier order list : '.$db->lasterror());
}
if( ! count($obj_ret)) {
throw new RestException(404, 'No supplier order found');
}
return $obj_ret;
}
/**
* Create supplier order object
*
* @param array $request_data Request datas
* @return int ID of supplier order
*/
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
/**
* Create supplier order object
*
* @param array $request_data Request datas
* @return int ID of supplier order
*/
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach($request_data as $field => $value) {
$this->order->$field = $value;
}
if(! array_keys($request_data, 'date')) {
$this->order->date = dol_now();
}
/* We keep lines as an array
foreach($request_data as $field => $value) {
$this->order->$field = $value;
}
if(! array_keys($request_data, 'date')) {
$this->order->date = dol_now();
}
/* We keep lines as an array
if (isset($request_data["lines"])) {
$lines = array();
foreach ($request_data["lines"] as $line) {
@ -210,163 +210,163 @@ class SupplierOrders extends DolibarrApi
$this->order->lines = $lines;
}*/
if ($this->order->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating order", array_merge(array($this->order->error), $this->order->errors));
}
return $this->order->id;
}
if ($this->order->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating order", array_merge(array($this->order->error), $this->order->errors));
}
return $this->order->id;
}
/**
* Update supplier order
*
* @param int $id Id of supplier order to update
* @param array $request_data Datas
* @return int
*/
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
throw new RestException(401);
}
/**
* Update supplier order
*
* @param int $id Id of supplier order to update
* @param array $request_data Datas
* @return int
*/
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
throw new RestException(401);
}
$result = $this->order->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Supplier order not found');
}
$result = $this->order->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Supplier order not found');
}
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->order->$field = $value;
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->order->$field = $value;
}
if($this->order->update($id, DolibarrApiAccess::$user))
return $this->get($id);
if($this->order->update($id, DolibarrApiAccess::$user))
return $this->get($id);
return false;
}
return false;
}
/**
* Delete supplier order
*
* @param int $id Supplier order ID
* @return type
*/
public function delete($id)
{
if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) {
throw new RestException(401);
}
$result = $this->order->fetch($id);
if ( ! $result) {
throw new RestException(404, 'Supplier order not found');
}
/**
* Delete supplier order
*
* @param int $id Supplier order ID
* @return type
*/
public function delete($id)
{
if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) {
throw new RestException(401);
}
$result = $this->order->fetch($id);
if ( ! $result) {
throw new RestException(404, 'Supplier order not found');
}
if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( $this->order->delete(DolibarrApiAccess::$user) < 0) {
throw new RestException(500);
}
if ( $this->order->delete(DolibarrApiAccess::$user) < 0) {
throw new RestException(500);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Supplier order deleted'
)
);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Supplier order deleted'
)
);
}
/**
* Validate an order
*
* @param int $id Order ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
* @url POST {id}/validate
*
* @return array
* FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
* Workaround: send this in the body
* {
* "idwarehouse": 0,
* "notrigger": 0
* }
*/
public function validate($id, $idwarehouse = 0, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
throw new RestException(401);
}
$result = $this->order->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Order not found');
}
/**
* Validate an order
*
* @param int $id Order ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
* @url POST {id}/validate
*
* @return array
* FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
* Workaround: send this in the body
* {
* "idwarehouse": 0,
* "notrigger": 0
* }
*/
public function validate($id, $idwarehouse = 0, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
throw new RestException(401);
}
$result = $this->order->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Order not found');
}
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Order: '.$this->order->error);
}
$result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Order: '.$this->order->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Order validated (Ref='.$this->order->ref.')'
)
);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Order validated (Ref='.$this->order->ref.')'
)
);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param Object $object Object to clean
* @return array Array of cleaned object properties
*/
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param Object $object Object to clean
* @return array Array of cleaned object properties
*/
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->rowid);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
unset($object->barcode_type_coder);
unset($object->rowid);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
unset($object->barcode_type_coder);
return $object;
}
return $object;
}
/**
* Validate fields before create or update object
*
* @param array $data Datas to validate
* @return array
*
* @throws RestException
*/
private function _validate($data)
{
$order = array();
foreach (SupplierOrders::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$order[$field] = $data[$field];
}
return $order;
}
/**
* Validate fields before create or update object
*
* @param array $data Datas to validate
* @return array
*
* @throws RestException
*/
private function _validate($data)
{
$order = array();
foreach (SupplierOrders::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$order[$field] = $data[$field];
}
return $order;
}
}

View File

@ -62,7 +62,10 @@ class CommandeFournisseur extends CommonOrder
*/
public $fk_element = 'fk_commande';
public $picto='order';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='order';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@ -3586,7 +3589,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
* @param int $notrigger 1=Disable call to triggers
* @return int <0 if KO, >0 if OK
*/
public function delete($notrigger)
public function delete($notrigger = 0)
{
global $user;
@ -3594,7 +3597,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->db->begin();
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->rowid;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql=$this->db->query($sql);

View File

@ -63,6 +63,9 @@ class FactureFournisseur extends CommonInvoice
*/
public $fk_element='fk_facture_fourn';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='bill';
/**

View File

@ -46,6 +46,9 @@ class PaiementFourn extends Paiement
*/
public $table_element='paiementfourn';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'payment';
public $statut; //Status of payment. 0 = unvalidated; 1 = validated
@ -56,7 +59,7 @@ class PaiementFourn extends Paiement
* Label of payment type
* @var string
*/
public $type_libelle;
public $type_label;
/**
* Code of Payment type
@ -123,7 +126,7 @@ class PaiementFourn extends Paiement
$this->note = $obj->note;
$this->note_private = $obj->note;
$this->type_code = $obj->paiement_code;
$this->type_libelle = $obj->paiement_type;
$this->type_label = $obj->paiement_type;
$this->statut = $obj->statut;
$error = 1;
}

View File

@ -197,7 +197,7 @@ if ($result > 0)
print '</td></tr>';
// Payment mode
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_label;
print '<tr><td colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype;
print $object->num_paiement?' - '.$object->num_paiement:'';
print '</td></tr>';

View File

@ -54,6 +54,9 @@ class Holiday extends CommonObject
*/
public $fk_element = 'fk_holiday';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'holiday';
/**

View File

@ -173,6 +173,10 @@ llxHeader('', $langs->trans('CPTitreMenu'));
$typeleaves=$holiday->getTypes(1, 1);
$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user.
if ($result < 0) {
setEventMessages($holiday->error, $holiday->errors, 'errors');
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -189,21 +193,14 @@ print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
$lastUpdate = $holiday->getConfCP('lastUpdate');
if ($lastUpdate)
{
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
$yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
print '<strong>'.dol_print_date($db->jdate($holiday->getConfCP('lastUpdate')), 'dayhour', 'tzuser').'</strong>';
print '<br>'.$langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$yearLastUpdate.'-'.$monthLastUpdate.'</strong>'."\n";
if ($lastUpdate) {
print '<strong>'.dol_print_date($db->jdate($lastUpdate), 'dayhour').'</strong>';
print '<br>'.$langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$langs->trans('Month'.substr($lastUpdate, 4, 2)).' '.substr($lastUpdate, 0, 4).'</strong>'."\n";
} else {
print $langs->trans('None');
}
else print $langs->trans('None');
print "</div><br>\n";
$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user.
if ($result < 0)
{
setEventMessages($holiday->error, $holiday->errors, 'errors');
}
$filters = '';

View File

@ -55,7 +55,10 @@ class Establishment extends CommonObject
*/
public $ismultientitymanaged = 1;
public $picto='building';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='building';
/**
* @var int ID

View File

@ -46,6 +46,8 @@ UPDATE llx_c_units SET scale = -3, active = 0 WHERE code IN ('L');
UPDATE llx_c_units SET label = 'VolumeUnitm3' WHERE code IN ('M3');
UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity);
-- For v11

View File

@ -17,6 +17,7 @@ DonationStatusPromiseNotValidatedShort=Draft
DonationStatusPromiseValidatedShort=Validated
DonationStatusPaidShort=Received
DonationTitle=Donation receipt
DonationDate=Donation date
DonationDatePayment=Payment date
ValidPromess=Validate promise
DonationReceipt=Donation receipt

View File

@ -64,7 +64,12 @@ class Livraison extends CommonObject
public $ref_customer;
public $date_delivery; // Date really received
/**
* @var integer|string date_creation
*/
public $date_creation;
public $date_valid;
public $model_pdf;

View File

@ -41,6 +41,9 @@ class Loan extends CommonObject
*/
public $table_element='loan';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'bill';
/**

View File

@ -94,6 +94,10 @@ class LoanSchedule extends CommonObject
*/
public $total;
public $type_code;
public $type_label;
/**
* Constructor
*
@ -213,7 +217,7 @@ class LoanSchedule extends CommonObject
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@ -245,7 +249,7 @@ class LoanSchedule extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;

View File

@ -90,6 +90,10 @@ class PaymentLoan extends CommonObject
*/
public $fk_user_modif;
public $type_code;
public $type_label;
/**
* Constructor
*
@ -208,7 +212,7 @@ class PaymentLoan extends CommonObject
$sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= " pt.code as type_code, pt.libelle as type_label,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id";
@ -242,7 +246,7 @@ class PaymentLoan extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle;
$this->type_label = $obj->type_label;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;

View File

@ -26,6 +26,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
public $enabled=0;
public $require_module=array();
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='mymodule@mymodule';
/**

View File

@ -235,8 +235,11 @@ else
print '</div></div></div>';
$parameters = array('type' => $type, 'user' => $user);
$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, null); // Note that $action and $object may have been modified by hook
$parameters = array(
//'type' => $type,
'user' => $user,
);
$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters);
// End of page
llxFooter();

View File

@ -44,6 +44,9 @@ class Opensurveysondage extends CommonObject
*/
public $table_element='opensurvey_sondage';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'opensurvey';
public $id_sondage;

View File

@ -450,12 +450,13 @@ class Products extends DolibarrApi
* Get prices per customer for a product
*
* @param int $id ID of product
* @param string $thirdparty_id Thirdparty id to filter orders of (example '1') {@pattern /^[0-9,]*$/i}
*
* @return mixed
*
* @url GET {id}/selling_multiprices/per_customer
*/
public function getCustomerPricesPerCustomer($id)
public function getCustomerPricesPerCustomer($id, $thirdparty_id = '')
{
global $conf;
@ -472,12 +473,20 @@ class Products extends DolibarrApi
throw new RestException(404, 'Product not found');
}
if ($result < 0) {
throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors));
if ($result > 0) {
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($this->db);
$filter = array();
$filter['t.fk_product'] .= $id;
if ($thirdparty_id) $filter['t.fk_soc'] .= $thirdparty_id;
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
}
throw new RestException(501, 'Feature not yet available');
//return $result;
if ( empty($prodcustprice->lines)) {
throw new RestException(404, 'Prices not found');
}
return $prodcustprice->lines;
}
/**

View File

@ -44,6 +44,9 @@ class Entrepot extends CommonObject
*/
public $table_element='entrepot';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='stock';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe

View File

@ -45,6 +45,9 @@ class Productlot extends CommonObject
*/
public $table_element = 'product_lot';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='barcode';
/**

View File

@ -60,6 +60,9 @@ class Project extends CommonObject
*/
public $ismultientitymanaged = 1;
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'projectpub';
/**

View File

@ -47,6 +47,9 @@ class Task extends CommonObject
*/
public $fk_element='fk_task';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'task';
/**

View File

@ -48,7 +48,11 @@ class Reception extends CommonObject
public $table_element="reception";
public $table_element_line="commande_fournisseur_dispatch";
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'reception';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'reception';
public $socid;
public $ref_supplier;
@ -80,8 +84,14 @@ class Reception extends CommonObject
* @var int
*/
public $date_reception;
public $date_creation;
public $date_valid;
/**
* @var integer|string date_creation
*/
public $date_creation;
public $date_valid;
public $meths;
public $listmeths; // List of carriers

View File

@ -39,7 +39,10 @@ class Dolresource extends CommonObject
*/
public $table_element='resource';
public $picto = 'resource';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'resource';
public $resource_id;
public $resource_type;

View File

@ -69,6 +69,9 @@ class Societe extends CommonObject
*/
protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm");
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'company';
/**
@ -316,11 +319,12 @@ class Societe extends CommonObject
* @var string
*/
public $user_modification;
/**
* Date of creation
* @var string
* @var integer|string date_creation
*/
public $date_creation;
/**
* User that created the thirdparty
* @var User

View File

@ -124,7 +124,13 @@ class SocieteAccount extends CommonObject
public $date_last_login;
public $date_previous_login;
public $note_private;
/**
* @var integer|string date_creation
*/
public $date_creation;
public $tms;
/**

View File

@ -41,7 +41,7 @@ $socid = GETPOST('socid', 'int');
if ($user->socid) $socid=$user->socid;
// Security check
$result=restrictedArea($user, 'societe', 0, '', '', '', '');
$result = restrictedArea($user, 'societe', 0, '', '', '', '');
$thirdparty_static = new Societe($db);
@ -51,10 +51,10 @@ $thirdparty_static = new Societe($db);
*/
$transAreaType = $langs->trans("ThirdPartiesArea");
$helpurl='EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Terceros';
$helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Terceros';
llxHeader("", $langs->trans("ThirdParties"), $helpurl);
$linkback='';
$linkback = '';
print load_fiche_titre($transAreaType, $linkback, 'companies');
@ -73,26 +73,26 @@ $third = array(
'supplier' => 0,
'other' =>0
);
$total=0;
$total = 0;
$sql = "SELECT s.rowid, s.client, s.fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ' WHERE s.entity IN ('.getEntity('societe').')';
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND s.rowid = ".$socid;
if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
//print $sql;
$result = $db->query($sql);
if ($result)
{
while ($objp = $db->fetch_object($result))
{
$found=0;
if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; }
if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; }
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; }
if (! empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; }
$found = 0;
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found = 1; $third['prospect']++; }
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found = 1; $third['customer']++; }
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found = 1; $third['supplier']++; }
if (!empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found = 1; $third['other']++; }
if ($found) $total++;
}
}
@ -101,14 +101,14 @@ else dol_print_error($db);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover" width="100%">'."\n";
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2))
if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2))
{
print '<tr><td class="center" colspan="2">';
$dataseries=array();
if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array($langs->trans("Prospects"), round($third['prospect']));
if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array($langs->trans("Customers"), round($third['customer']));
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array($langs->trans("Suppliers"), round($third['supplier']));
if (! empty($conf->societe->enabled)) $dataseries[]=array($langs->trans("Others"), round($third['other']));
$dataseries = array();
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[] = array($langs->trans("Prospects"), round($third['prospect']));
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[] = array($langs->trans("Customers"), round($third['customer']));
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[] = array($langs->trans("Suppliers"), round($third['supplier']));
if (!empty($conf->societe->enabled)) $dataseries[] = array($langs->trans("Others"), round($third['other']));
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
@ -122,23 +122,23 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou
}
else
{
if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS))
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS))
{
$statstring = "<tr>";
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td class="right">'.round($third['prospect']).'</td>';
$statstring.= "</tr>";
$statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td class="right">'.round($third['prospect']).'</td>';
$statstring .= "</tr>";
}
if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS))
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS))
{
$statstring.= "<tr>";
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
$statstring.= "</tr>";
$statstring .= "<tr>";
$statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
$statstring .= "</tr>";
}
if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire)
if (!empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire)
{
$statstring2 = "<tr>";
$statstring2.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
$statstring2.= "</tr>";
$statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
$statstring2 .= "</tr>";
}
print $statstring;
print $statstring2;
@ -149,7 +149,7 @@ print '</td></tr>';
print '</table>';
print '</div>';
if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES))
if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES))
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$elementtype = 'societe';
@ -161,41 +161,41 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
print '<tr><td class="center" colspan="2">';
$sql = "SELECT c.label, count(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
$sql.= " WHERE c.type = 2";
if (! is_numeric($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) $sql.= " AND c.label like '".$db->escape($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)."'";
$sql.= " AND c.entity IN (".getEntity('category').")";
$sql.= " GROUP BY c.label";
$total=0;
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
$sql .= " WHERE c.type = 2";
if (!is_numeric($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) $sql .= " AND c.label like '".$db->escape($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)."'";
$sql .= " AND c.entity IN (".getEntity('category').")";
$sql .= " GROUP BY c.label";
$total = 0;
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i=0;
if (! empty($conf->use_javascript_ajax) )
$i = 0;
if (!empty($conf->use_javascript_ajax))
{
$dataseries=array();
$rest=0;
$nbmax=10;
$dataseries = array();
$rest = 0;
$nbmax = 10;
while ($i < $num)
{
$obj = $db->fetch_object($result);
if ($i < $nbmax)
{
$dataseries[]=array($obj->label, round($obj->nb));
$dataseries[] = array($obj->label, round($obj->nb));
}
else
{
$rest+=$obj->nb;
$rest += $obj->nb;
}
$total+=$obj->nb;
$total += $obj->nb;
$i++;
}
if ($i > $nbmax)
{
$dataseries[]=array($langs->trans("Other"), round($rest));
$dataseries[] = array($langs->trans("Other"), round($rest));
}
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
@ -214,7 +214,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS
$obj = $db->fetch_object($result);
print '<tr class="oddeven"><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
$total+=$obj->nb;
$total += $obj->nb;
$i++;
}
}
@ -234,20 +234,20 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Latest modified third parties
*/
$max=15;
$max = 15;
$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
$sql.= ", s.code_client";
$sql.= ", s.code_fournisseur";
$sql.= ", s.logo";
$sql.= ", s.canvas, s.tms as datem, s.status as status";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ' WHERE s.entity IN ('.getEntity('societe').')';
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur != 1 OR s.client != 0)";
$sql.= $db->order("s.tms", "DESC");
$sql.= $db->plimit($max, 0);
$sql .= ", s.code_client";
$sql .= ", s.code_fournisseur";
$sql .= ", s.logo";
$sql .= ", s.canvas, s.tms as datem, s.status as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND s.rowid = ".$socid;
if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
$sql .= $db->order("s.tms", "DESC");
$sql .= $db->plimit($max, 0);
//print $sql;
$result = $db->query($sql);
@ -274,16 +274,16 @@ if ($result)
{
$objp = $db->fetch_object($result);
$thirdparty_static->id=$objp->rowid;
$thirdparty_static->name=$objp->name;
$thirdparty_static->client=$objp->client;
$thirdparty_static->fournisseur=$objp->fournisseur;
$thirdparty_static->id = $objp->rowid;
$thirdparty_static->name = $objp->name;
$thirdparty_static->client = $objp->client;
$thirdparty_static->fournisseur = $objp->fournisseur;
$thirdparty_static->logo = $objp->logo;
$thirdparty_static->datem=$db->jdate($objp->datem);
$thirdparty_static->status=$objp->status;
$thirdparty_static->datem = $db->jdate($objp->datem);
$thirdparty_static->status = $objp->status;
$thirdparty_static->code_client = $objp->code_client;
$thirdparty_static->code_fournisseur = $objp->code_fournisseur;
$thirdparty_static->canvas=$objp->canvas;
$thirdparty_static->canvas = $objp->canvas;
$thirdparty_static->email = $objp->email;
print '<tr class="oddeven">';
@ -293,21 +293,21 @@ if ($result)
print "</td>\n";
// Type
print '<td class="center">';
if ($thirdparty_static->client==1 || $thirdparty_static->client==3)
if ($thirdparty_static->client == 1 || $thirdparty_static->client == 3)
{
$thirdparty_static->name=$langs->trans("Customer");
$thirdparty_static->name = $langs->trans("Customer");
print $thirdparty_static->getNomUrl(0, 'customer', 0, 1);
}
if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print " / ";
if (($thirdparty_static->client==2 || $thirdparty_static->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
if (($thirdparty_static->client == 2 || $thirdparty_static->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
$thirdparty_static->name=$langs->trans("Prospect");
$thirdparty_static->name = $langs->trans("Prospect");
print $thirdparty_static->getNomUrl(0, 'prospect', 0, 1);
}
if (! empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur)
if (!empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur)
{
if ($thirdparty_static->client) print " / ";
$thirdparty_static->name=$langs->trans("Supplier");
$thirdparty_static->name = $langs->trans("Supplier");
print $thirdparty_static->getNomUrl(0, 'supplier', 0, 1);
}
print '</td>';

View File

@ -46,13 +46,13 @@ $stripearrayofkeysbyenv = array(
$stripearrayofkeys = array();
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))
{
$stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
$stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
}
else
{
$stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
$stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
}
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
\Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION)?"2019-05-16":$conf->global->STRIPE_FORCE_VERSION); // force version API
\Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION) ? "2019-05-16" : $conf->global->STRIPE_FORCE_VERSION); // force version API

View File

@ -66,6 +66,9 @@ class SupplierProposal extends CommonObject
*/
public $fk_element='fk_supplier_proposal';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='propal';
/**
@ -1698,22 +1701,22 @@ class SupplierProposal extends CommonObject
* Close the askprice
*
* @param User $user Object user that close
* @param int $statut Statut
* @param int $status Status
* @param string $note Comment
* @return int <0 if KO, >0 if OK
*/
public function cloture($user, $statut, $note)
public function cloture($user, $status, $note)
{
global $langs,$conf;
$this->statut = $statut;
$this->statut = $status;
$error=0;
$now=dol_now();
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal";
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql.= " SET fk_statut = ".$status.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$resql=$this->db->query($sql);
@ -1722,7 +1725,7 @@ class SupplierProposal extends CommonObject
$modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
$trigger_name='SUPPLIER_PROPOSAL_CLOSE_REFUSED';
if ($statut == 2)
if ($status == 2)
{
$trigger_name='SUPPLIER_PROPOSAL_CLOSE_SIGNED';
$modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
@ -1732,7 +1735,7 @@ class SupplierProposal extends CommonObject
$result = $this->updateOrCreatePriceFournisseur($user);
}
}
if ($statut == 4)
if ($status == 4)
{
$trigger_name='SUPPLIER_PROPOSAL_CLASSIFY_BILLED';
}
@ -2258,15 +2261,16 @@ class SupplierProposal extends CommonObject
if ($resql)
{
$label = $labelShort = '';
$status = '';
if ($mode == 'opened') {
$delay_warning=$conf->supplier_proposal->cloture->warning_delay;
$statut = self::STATUS_VALIDATED;
$status = self::STATUS_VALIDATED;
$label = $langs->trans("SupplierProposalsToClose");
$labelShort = $langs->trans("ToAcceptRefuse");
}
if ($mode == 'signed') {
$delay_warning=$conf->supplier_proposal->facturation->warning_delay;
$statut = self::STATUS_SIGNED;
$status = self::STATUS_SIGNED;
$label = $langs->trans("SupplierProposalsToProcess"); // May be billed or ordered
$labelShort = $langs->trans("ToClose");
}
@ -2275,7 +2279,7 @@ class SupplierProposal extends CommonObject
$response->warning_delay = $delay_warning/60/60/24;
$response->label = $label;
$response->labelShort = $labelShort;
$response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$statut;
$response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$status;
$response->img = img_object('', "propal");
// This assignment in condition is not a bug. It allows walking the results.

View File

@ -954,22 +954,22 @@ class User extends CommonObject
/**
* Change status of a user
*
* @param int $statut Status to set
* @param int $status Status to set
* @return int <0 if KO, 0 if nothing is done, >0 if OK
*/
public function setstatus($statut)
public function setstatus($status)
{
global $conf,$langs,$user;
$error=0;
// Check parameters
if ($this->statut == $statut) return 0;
else $this->statut = $statut;
if ($this->statut == $status) return 0;
else $this->statut = $status;
$this->db->begin();
// Deactivate user
// Save in database
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET statut = ".$this->statut;
$sql.= " WHERE rowid = ".$this->id;

View File

@ -52,7 +52,10 @@ class UserGroup extends CommonObject
*/
public $ismultientitymanaged = 1;
public $picto='group';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='group';
/**
* @var int Entity of group