Merge branch 'develop' into new_branch_01_11_2019
This commit is contained in:
commit
c12e66e2a2
35
ChangeLog
35
ChangeLog
@ -25,7 +25,9 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE.
|
||||
* The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS.
|
||||
* 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.
|
||||
@ -47,7 +49,6 @@ FIX: Clean the + of categories on the product view only in POS module
|
||||
FIX: access to public interface when origin email has an alias.
|
||||
FIX: Alias name is not into the email recipient label.
|
||||
FIX: allow standalone credit note even if no invoice
|
||||
FIX: an admin can not access his own permissions after enabling advanced
|
||||
FIX: an admin can not access his own permissions after enabling advanced permissions
|
||||
FIX: Attachement of linked files on ticket when sending a message
|
||||
FIX: avoid non numeric warning
|
||||
@ -116,17 +117,17 @@ FIX: #11752
|
||||
FIX: #11789 FIX: #11790
|
||||
FIX: #11804 list of tickets from a customer card display ALL tickets
|
||||
FIX: #11834
|
||||
FIX: Add char $ and ; in sanitizing of filenames.
|
||||
FIX: Add comment before protected functions
|
||||
FIX: Add log and type of content in dolWebsiteOutput and
|
||||
FIX: Add repair.php option 'restore' to restore user picture after v10
|
||||
FIX: add char $ and ; in sanitizing of filenames
|
||||
FIX: add comment before protected functions
|
||||
FIX: add log and type of content in dolWebsiteOutput and
|
||||
FIX: add repair.php option 'restore' to restore user picture after v10
|
||||
FIX: amount opened on thirdparty card dont care of credit note not converted
|
||||
FIX: Api of documents work with value 'thirdparty'
|
||||
FIX: API of documents work with value 'thirdparty'
|
||||
FIX: author in message / ticket API
|
||||
FIX: avoid sql error if fk_project is empty during update
|
||||
FIX: avoid SQL error if fk_project is empty during update
|
||||
FIX: avoid Warning: A non-numeric value encountered
|
||||
FIX: bad consistency in list of invoice for direct debit order.
|
||||
FIX: Bad error management in zip compress and web site export
|
||||
FIX: bad consistency in list of invoice for direct debit order
|
||||
FIX: bad error management in zip compress and web site export
|
||||
FIX: bad substitution for extrafields type checkbox
|
||||
FIX: better help message with multicompany
|
||||
FIX: calculation of $products_dispatched
|
||||
@ -135,11 +136,11 @@ FIX: Can't delete a draft leave even if it should
|
||||
FIX: Can't save setup of mailman module
|
||||
FIX: column jabberid missing
|
||||
FIX: Confirmation of deletion
|
||||
FIX: Consistency in direct debit order lists.
|
||||
FIX: Consistency in direct debit order lists
|
||||
FIX: Content send before header warning
|
||||
FIX: credit note can be split
|
||||
FIX: credit note used on list
|
||||
FIX: Css was saved on wrong website.
|
||||
FIX: CSS was saved on wrong website
|
||||
FIX: delivery extrafields
|
||||
FIX: Disabling a website does not put it offline
|
||||
FIX: display only stripe sources for customer
|
||||
@ -156,13 +157,13 @@ FIX: Fatal situation if payment removed on expense report. Action
|
||||
FIX: filepath of generated documents doesn't handle products with special characters
|
||||
FIX: for MAIN_MAXTABS_IN_CARD = $i card
|
||||
FIX: gzip and bzip2 must use option -f
|
||||
FIX: It was possible to create cashfence without entering data.
|
||||
FIX: it was possible to create cashfence without entering data
|
||||
FIX: javascript error when using dol_use_jmobile=1
|
||||
FIX: logout redirect to takepos.php
|
||||
FIX: Look and feel v10
|
||||
FIX: Make protected all pfd models functions
|
||||
FIX: management of extrafields in modulebuilder
|
||||
FIX: Missing div for buttons in tax, loan, various payment modules
|
||||
FIX: missing div for buttons in tax, loan, various payment modules
|
||||
FIX: missing include (dol_convert_file not found)
|
||||
FIX: Missing some replacements in website module
|
||||
FIX: missing test on permission on button to delete ledger record
|
||||
@ -186,13 +187,13 @@ FIX: Return code of pdf_einstein.modules.php and proformat
|
||||
FIX: round for application fee in stripe
|
||||
FIX: Sens of the balance (Debit - Credit in accountancy not contrary)
|
||||
FIX: Several pb in export of documents
|
||||
FIX: SQL syntax error and CSRF check on vat reports
|
||||
FIX: SQL syntax error and CSRF check on VAT reports
|
||||
FIX: takepos layout clear or focus search
|
||||
FIX: too many record in sql request. Whena criteria is a filter, we must
|
||||
FIX: too many record in sql request. When a criteria is a filter, we must
|
||||
FIX: Translation of month
|
||||
FIX: USEDOLIBARREDITOR not always set
|
||||
FIX: VAT number for Monaco (it uses FR)
|
||||
FIX: vulenrability in uploading file found by 美创科技安全实验室
|
||||
FIX: vulnerability in uploading file found by 美创科技安全实验室
|
||||
FIX: wrong display (and hidden input) for already dispatched quantity
|
||||
FIX: wrong parameters (same error in branch 9, 10, develop)
|
||||
FIX: Wrong variable. Must be PROJECT_HIDE_UNSELECTABLES
|
||||
|
||||
@ -638,11 +638,11 @@ class AccountingAccount extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -650,34 +650,33 @@ class AccountingAccount extends CommonObject
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
elseif ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
elseif ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
||||
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4');
|
||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5');
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
|
||||
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
|
||||
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
|
||||
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ class Adherent extends CommonObject
|
||||
|
||||
// -1:brouillon, 0:resilie, >=1:valide,paye
|
||||
// def in common object
|
||||
//public $statut;
|
||||
//public $status;
|
||||
|
||||
public $photo;
|
||||
|
||||
@ -2168,61 +2168,61 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $need_subscription 1 if member type need subscription, 0 otherwise
|
||||
* @param int $date_end_subscription Date fin adhesion
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0)
|
||||
public function LibStatut($status, $need_subscription, $date_end_subscription, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load("members");
|
||||
|
||||
$statusType = '';
|
||||
$labelstatut = '';
|
||||
$labelstatutShort = '';
|
||||
$labelStatus = '';
|
||||
$labelStatusShort = '';
|
||||
|
||||
if ($statut == -1)
|
||||
if ($status == -1)
|
||||
{
|
||||
$statusType = 'status0';
|
||||
$labelstatut = $langs->trans("MemberStatusDraft");
|
||||
$labelstatutShort = $langs->trans("MemberStatusDraftShort");
|
||||
$labelStatus = $langs->trans("MemberStatusDraft");
|
||||
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
|
||||
}
|
||||
elseif ($statut >= 1) {
|
||||
elseif ($status >= 1) {
|
||||
if ($need_subscription == 0)
|
||||
{
|
||||
$statusType = 'status4';
|
||||
$labelstatut = $langs->trans("MemberStatusNoSubscription");
|
||||
$labelstatutShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||
$labelStatus = $langs->trans("MemberStatusNoSubscription");
|
||||
$labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||
}
|
||||
elseif (! $date_end_subscription)
|
||||
{
|
||||
$statusType = 'status1';
|
||||
$labelstatut = $langs->trans("MemberStatusActive");
|
||||
$labelstatutShort = $langs->trans("MemberStatusActiveShort");
|
||||
$labelStatus = $langs->trans("MemberStatusActive");
|
||||
$labelStatusShort = $langs->trans("MemberStatusActiveShort");
|
||||
}
|
||||
elseif ($date_end_subscription < time())
|
||||
{
|
||||
$statusType = 'status3';
|
||||
$labelstatut = $langs->trans("MemberStatusActiveLate");
|
||||
$labelstatutShort = $langs->trans("MemberStatusActiveLateShort");
|
||||
$labelStatus = $langs->trans("MemberStatusActiveLate");
|
||||
$labelStatusShort = $langs->trans("MemberStatusActiveLateShort");
|
||||
}
|
||||
else {
|
||||
$statusType = 'status4';
|
||||
$labelstatut = $langs->trans("MemberStatusPaid");
|
||||
$labelstatutShort = $langs->trans("MemberStatusPaidShort");
|
||||
$labelStatus = $langs->trans("MemberStatusPaid");
|
||||
$labelStatusShort = $langs->trans("MemberStatusPaidShort");
|
||||
}
|
||||
}
|
||||
elseif ($statut == 0)
|
||||
elseif ($status == 0)
|
||||
{
|
||||
$statusType = 'status6';
|
||||
$labelstatut = $langs->trans("MemberStatusResiliated");
|
||||
$labelstatutShort = $langs->trans("MemberStatusResiliatedShort");
|
||||
$labelStatus = $langs->trans("MemberStatusResiliated");
|
||||
$labelStatusShort = $langs->trans("MemberStatusResiliatedShort");
|
||||
}
|
||||
|
||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)."'";
|
||||
|
||||
@ -61,7 +61,7 @@ $AdherentsResilies=array();
|
||||
|
||||
$AdherentType=array();
|
||||
|
||||
// Members list
|
||||
// Type of membership
|
||||
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
|
||||
$sql.= " d.statut, count(d.rowid) as somme";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
@ -71,7 +71,7 @@ $sql.= " AND d.entity IN (".getEntity('adherent').")";
|
||||
$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
|
||||
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
||||
|
||||
dol_syslog("index.php::select nb of members by type", LOG_DEBUG);
|
||||
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -294,7 +294,7 @@ print "<br>\n";
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
/*
|
||||
* Last modified members
|
||||
* Latest modified members
|
||||
*/
|
||||
$max=5;
|
||||
|
||||
@ -342,7 +342,7 @@ if ($resql)
|
||||
print '<td>'.$staticmember->getNomUrl(1, 32).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
|
||||
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 5).'</td>';
|
||||
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 3).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ if ($action == 'create') {
|
||||
|
||||
dol_fiche_head(array(), '');
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
//unset($fields[]);
|
||||
|
||||
@ -296,7 +296,7 @@ if (($id || $ref) && $action == 'edit')
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border centpercent">' . "\n";
|
||||
print '<table class="border centpercent tableforfield">' . "\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
||||
@ -448,7 +448,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// Common attributes
|
||||
//$keyforbreak='fieldkeytoswithonsecondcolumn';
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -132,8 +132,8 @@ class DolibarrApi
|
||||
unset($object->statuts_short);
|
||||
unset($object->statuts_logo);
|
||||
unset($object->statuts_long);
|
||||
unset($object->labelstatut);
|
||||
unset($object->labelstatut_short);
|
||||
unset($object->labelStatus);
|
||||
unset($object->labelStatusShort);
|
||||
|
||||
unset($object->element);
|
||||
unset($object->fk_element);
|
||||
|
||||
@ -815,19 +815,19 @@ class BOM extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mrp");
|
||||
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -479,14 +479,13 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param = "&id=".$object->id;
|
||||
$param = "&id=".$object->id;
|
||||
//if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
|
||||
if ($search_email) $param.= "&search_email=".urlencode($search_email);
|
||||
if ($search_other) $param.= "&search_other=".urlencode($search_other);
|
||||
if ($page) $param.= "&page=".urlencode($page);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -500,6 +499,7 @@ if ($object->fetch($id) >= 0)
|
||||
$morehtmlcenter='<span class="opacitymedium">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
|
||||
}
|
||||
$morehtmlcenter.=' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?exportcsv=1&id='.$object->id.'">'.$langs->trans("Download").'</a>';
|
||||
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
|
||||
|
||||
print '</form>';
|
||||
@ -560,6 +560,8 @@ if ($object->fetch($id) >= 0)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($page) $param.= "&page=".urlencode($page);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder);
|
||||
|
||||
@ -623,48 +623,24 @@ class Mailing extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load('mails');
|
||||
$langs->load("mailing");
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
|
||||
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
|
||||
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3');
|
||||
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
|
||||
elseif ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
|
||||
elseif ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3');
|
||||
elseif ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
|
||||
}
|
||||
$labelStatus = $langs->trans($this->statuts[$status]);
|
||||
$labelStatusShort = $langs->trans($this->statuts[$status]);
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == 2) $statusType = 'status3';
|
||||
if ($status == 3) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
@ -672,58 +648,37 @@ class Mailing extends CommonObject
|
||||
* Renvoi le libelle d'un statut donne
|
||||
* TODO Add class mailin_target.class.php
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param string $desc Desc error
|
||||
* @return string Label
|
||||
*/
|
||||
public static function libStatutDest($statut, $mode = 0, $desc = '')
|
||||
public static function libStatutDest($status, $mode = 0, $desc = '')
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('mails');
|
||||
$langs->load("mails");
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans('MailingStatusError');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $langs->trans('MailingStatusSent');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
|
||||
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
|
||||
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
|
||||
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
|
||||
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
|
||||
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
|
||||
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
|
||||
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
|
||||
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
|
||||
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
|
||||
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
|
||||
$labelStatus = array();
|
||||
$labelStatusShort = array();
|
||||
|
||||
$labelStatus[-1] = $langs->trans('MailingStatusError');
|
||||
$labelStatus[1] = $langs->trans('MailingStatusSent');
|
||||
$labelStatus[2] = $langs->trans('MailingStatusRead');
|
||||
$labelStatus[3] = $langs->trans('MailingStatusNotContact');
|
||||
$labelStatusShort[-1] = $langs->trans('MailingStatusError');
|
||||
$labelStatusShort[1] = $langs->trans('MailingStatusSent');
|
||||
$labelStatusShort[2] = $langs->trans('MailingStatusRead');
|
||||
$labelStatusShort[3] = $langs->trans('MailingStatusNotContact');
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == -1) $statusType = 'status8';
|
||||
if ($status == 1) $statusType = 'status6';
|
||||
if ($status == 2) $statusType = 'status4';
|
||||
|
||||
$param = array();
|
||||
if ($status == - 1) {
|
||||
$param = array('badgeParams'=>array('attr'=>array('title'=>$desc)));
|
||||
}
|
||||
return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode, '', $param);
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,16 @@ if ($object->fetch($id) >= 0)
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlright='';
|
||||
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
|
||||
$nbtry = $nbok = 0;
|
||||
if ($object->statut == 2 || $object->statut == 3)
|
||||
{
|
||||
$nbtry = $object->countNbOfTargets('alreadysent');
|
||||
$nbko = $object->countNbOfTargets('alreadysentko');
|
||||
|
||||
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
|
||||
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
|
||||
$morehtmlright.=') ';
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
@ -192,8 +201,8 @@ class Propal extends CommonObject
|
||||
public $lines = array();
|
||||
public $line;
|
||||
|
||||
public $labelstatut=array();
|
||||
public $labelstatut_short=array();
|
||||
public $labelStatus=array();
|
||||
public $labelStatusShort=array();
|
||||
|
||||
public $specimen;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -3200,40 +3209,40 @@ class Propal extends CommonObject
|
||||
/**
|
||||
* Return label of a status (draft, validated, ...)
|
||||
*
|
||||
* @param int $statut id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 1)
|
||||
public function LibStatut($status, $mode = 1)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
// Init/load array of translation of status
|
||||
if (empty($this->labelstatut) || empty($this->labelstatut_short))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("propal");
|
||||
$this->labelstatut[0]=$langs->trans("PropalStatusDraft");
|
||||
$this->labelstatut[1]=$langs->trans("PropalStatusValidated");
|
||||
$this->labelstatut[2]=$langs->trans("PropalStatusSigned");
|
||||
$this->labelstatut[3]=$langs->trans("PropalStatusNotSigned");
|
||||
$this->labelstatut[4]=$langs->trans("PropalStatusBilled");
|
||||
$this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort");
|
||||
$this->labelstatut_short[1]=$langs->trans("PropalStatusValidatedShort");
|
||||
$this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort");
|
||||
$this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort");
|
||||
$this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort");
|
||||
$this->labelStatus[0]=$langs->trans("PropalStatusDraft");
|
||||
$this->labelStatus[1]=$langs->trans("PropalStatusValidated");
|
||||
$this->labelStatus[2]=$langs->trans("PropalStatusSigned");
|
||||
$this->labelStatus[3]=$langs->trans("PropalStatusNotSigned");
|
||||
$this->labelStatus[4]=$langs->trans("PropalStatusBilled");
|
||||
$this->labelStatusShort[0]=$langs->trans("PropalStatusDraftShort");
|
||||
$this->labelStatusShort[1]=$langs->trans("PropalStatusValidatedShort");
|
||||
$this->labelStatusShort[2]=$langs->trans("PropalStatusSignedShort");
|
||||
$this->labelStatusShort[3]=$langs->trans("PropalStatusNotSignedShort");
|
||||
$this->labelStatusShort[4]=$langs->trans("PropalStatusBilledShort");
|
||||
}
|
||||
|
||||
$statusType='';
|
||||
if ($statut==self::STATUS_DRAFT) $statusType='status0';
|
||||
elseif ($statut==self::STATUS_VALIDATED) $statusType='status1';
|
||||
elseif ($statut==self::STATUS_SIGNED) $statusType='status3';
|
||||
elseif ($statut==self::STATUS_NOTSIGNED) $statusType='status5';
|
||||
elseif ($statut==self::STATUS_BILLED) $statusType='status6';
|
||||
if ($status==self::STATUS_DRAFT) $statusType='status0';
|
||||
elseif ($status==self::STATUS_VALIDATED) $statusType='status1';
|
||||
elseif ($status==self::STATUS_SIGNED) $statusType='status3';
|
||||
elseif ($status==self::STATUS_NOTSIGNED) $statusType='status5';
|
||||
elseif ($status==self::STATUS_BILLED) $statusType='status6';
|
||||
|
||||
return dolGetStatus($this->labelstatut[$statut], $this->labelstatut_short[$statut], '', $statusType, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
@ -3272,17 +3281,17 @@ class Propal extends CommonObject
|
||||
$now=dol_now();
|
||||
|
||||
$delay_warning = 0;
|
||||
$statut = 0;
|
||||
$status = 0;
|
||||
$label = $labelShort = '';
|
||||
if ($mode == 'opened') {
|
||||
$delay_warning=$conf->propal->cloture->warning_delay;
|
||||
$statut = self::STATUS_VALIDATED;
|
||||
$status = self::STATUS_VALIDATED;
|
||||
$label = $langs->trans("PropalsToClose");
|
||||
$labelShort = $langs->trans("ToAcceptRefuse");
|
||||
}
|
||||
if ($mode == 'signed') {
|
||||
$delay_warning=$conf->propal->facturation->warning_delay;
|
||||
$statut = self::STATUS_SIGNED;
|
||||
$status = self::STATUS_SIGNED;
|
||||
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
|
||||
$labelShort = $langs->trans("ToBill");
|
||||
}
|
||||
@ -3291,8 +3300,8 @@ class Propal extends CommonObject
|
||||
$response->warning_delay = $delay_warning/60/60/24;
|
||||
$response->label = $label;
|
||||
$response->labelShort = $labelShort;
|
||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
|
||||
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
|
||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals';
|
||||
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
|
||||
$response->img = img_object('', "propal");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
|
||||
@ -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', ...)
|
||||
@ -3469,13 +3492,13 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Return label of status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $billed If invoiced
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @param int $donotshowbilled Do not show billed status after order status
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($statut, $billed, $mode, $donotshowbilled = 0)
|
||||
public function LibStatut($status, $billed, $mode, $donotshowbilled = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
@ -3483,49 +3506,49 @@ class Commande extends CommonOrder
|
||||
$billedtext = '';
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
|
||||
|
||||
if ($statut==self::STATUS_CANCELED){
|
||||
$labelstatut = $langs->trans('StatusOrderCanceled');
|
||||
$labelstatutShort = $langs->trans('StatusOrderCanceledShort');
|
||||
if ($status==self::STATUS_CANCELED){
|
||||
$labelStatus = $langs->trans('StatusOrderCanceled');
|
||||
$labelStatusShort = $langs->trans('StatusOrderCanceledShort');
|
||||
$statusType='status5';
|
||||
}
|
||||
elseif ($statut==self::STATUS_DRAFT){
|
||||
$labelstatut = $langs->trans('StatusOrderDraft');
|
||||
$labelstatutShort = $langs->trans('StatusOrderDraftShort');
|
||||
elseif ($status==self::STATUS_DRAFT){
|
||||
$labelStatus = $langs->trans('StatusOrderDraft');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDraftShort');
|
||||
$statusType='status0';
|
||||
}
|
||||
elseif ($statut==self::STATUS_VALIDATED){
|
||||
$labelstatut = $langs->trans('StatusOrderValidated').$billedtext;
|
||||
$labelstatutShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
elseif ($status==self::STATUS_VALIDATED){
|
||||
$labelStatus = $langs->trans('StatusOrderValidated').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
$statusType='status1';
|
||||
}
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS){
|
||||
$labelstatut = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelstatutShort = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
elseif ($status==self::STATUS_SHIPMENTONPROCESS){
|
||||
$labelStatus = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$statusType='status3';
|
||||
}
|
||||
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelstatut = $langs->trans('StatusOrderToBill');
|
||||
$labelstatutShort = $langs->trans('StatusOrderToBillShort');
|
||||
elseif ($status==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelStatus = $langs->trans('StatusOrderToBill');
|
||||
$labelStatusShort = $langs->trans('StatusOrderToBillShort');
|
||||
$statusType='status4';
|
||||
}
|
||||
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelstatut = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelstatutShort = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
elseif ($status==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelStatus = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$statusType='status6';
|
||||
}
|
||||
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelstatut = $langs->trans('StatusOrderDelivered');
|
||||
$labelstatutShort = $langs->trans('StatusOrderDelivered');
|
||||
elseif ($status==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelStatus = $langs->trans('StatusOrderDelivered');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDelivered');
|
||||
$statusType='status6';
|
||||
}
|
||||
else{
|
||||
$labelstatut = $langs->trans('Unknown');
|
||||
$labelstatutShort = '';
|
||||
$labelStatus = $langs->trans('Unknown');
|
||||
$labelStatusShort = '';
|
||||
$statusType='';
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -523,46 +523,46 @@ class PaymentVarious extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id status
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statuts_short[$statut]);
|
||||
return $langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]);
|
||||
elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]);
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
|
||||
elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
|
||||
elseif ($status==2 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -317,20 +317,20 @@ class CashControl extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus) || empty($this->labelstatusshort))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelstatus[0] = $langs->trans('Draft');
|
||||
$this->labelstatus[1] = $langs->trans('Closed');
|
||||
$this->labelstatusshort[0] = $langs->trans('Draft');
|
||||
$this->labelstatusshort[1] = $langs->trans('Closed');
|
||||
$this->labelStatus[0] = $langs->trans('Draft');
|
||||
$this->labelStatus[1] = $langs->trans('Closed');
|
||||
$this->labelStatusShort[0] = $langs->trans('Draft');
|
||||
$this->labelStatusShort[1] = $langs->trans('Closed');
|
||||
}
|
||||
|
||||
$statusType = 'status0';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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
|
||||
|
||||
@ -336,46 +336,46 @@ class Deplacement extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id status
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statuts_short[$statut]);
|
||||
return $langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]);
|
||||
elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]);
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
|
||||
elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0');
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
|
||||
elseif ($status==2 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -69,7 +69,7 @@ class BonPrelevement extends CommonObject
|
||||
public $total;
|
||||
public $fetched;
|
||||
public $statut; // 0-Wait, 1-Trans, 2-Done
|
||||
public $labelstatut=array();
|
||||
public $labelStatus=array();
|
||||
|
||||
public $invoice_in_error=array();
|
||||
public $thirdparty_in_error=array();
|
||||
@ -1995,55 +1995,55 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Return status label for a status
|
||||
*
|
||||
* @param int $statut id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatut))
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("withdrawals");
|
||||
$this->labelstatut[0]=$langs->trans("StatusWaiting");
|
||||
$this->labelstatut[1]=$langs->trans("StatusTrans");
|
||||
$this->labelstatut[2]=$langs->trans("StatusCredited");
|
||||
$this->labelStatus[0]=$langs->trans("StatusWaiting");
|
||||
$this->labelStatus[1]=$langs->trans("StatusTrans");
|
||||
$this->labelStatus[2]=$langs->trans("StatusCredited");
|
||||
}
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
{
|
||||
return $this->labelstatut[$statut];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
|
||||
if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status];
|
||||
elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status];
|
||||
elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3');
|
||||
elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6');
|
||||
if ($status==0) return img_picto($this->labelStatus[$status], 'statut1');
|
||||
elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3');
|
||||
elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
|
||||
if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status];
|
||||
elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status];
|
||||
elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
|
||||
elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
|
||||
if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1');
|
||||
elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3');
|
||||
elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
|
||||
elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
|
||||
if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1');
|
||||
elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3');
|
||||
elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,36 +132,36 @@ class LignePrelevement
|
||||
/**
|
||||
* Return status label for a status
|
||||
*
|
||||
* @param int $statut id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited
|
||||
elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited
|
||||
elseif ($status==3) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
|
||||
elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8');
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut1');
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6');
|
||||
elseif ($status==3) return img_picto($langs->trans($this->statuts[$status]), 'statut8');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
|
||||
elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
|
||||
elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8');
|
||||
if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1');
|
||||
elseif ($status==2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6');
|
||||
elseif ($status==3) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1132,11 +1132,11 @@ else
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$amount += $obj->amount;
|
||||
$total_ht += $obj->amount;
|
||||
$total_ttc += $obj->amount;
|
||||
$subtotal_ht += $obj->amount;
|
||||
$subtotal_ttc += $obj->amount;
|
||||
$amount += -$obj->amount;
|
||||
$total_ht += -$obj->amount;
|
||||
$total_ttc += -$obj->amount;
|
||||
$subtotal_ht += -$obj->amount;
|
||||
$subtotal_ttc += -$obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -480,10 +480,10 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss[$obj->dm] += -$obj->amount;
|
||||
|
||||
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
|
||||
$encaiss_ttc[$obj->dm] += $obj->amount;
|
||||
$encaiss_ttc[$obj->dm] += -$obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -142,7 +142,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;
|
||||
@ -471,12 +471,12 @@ class ChargeSociales extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
||||
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0, $alreadypaid = -1)
|
||||
public function LibStatut($status, $mode = 0, $alreadypaid = -1)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -486,38 +486,38 @@ class ChargeSociales extends CommonObject
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
elseif ($statut == 1) return $langs->trans("Paid");
|
||||
if ($status == 0) return $langs->trans("Unpaid");
|
||||
elseif ($status == 1) return $langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
|
||||
else return "Error, mode/status not found";
|
||||
@ -562,8 +562,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)
|
||||
@ -695,6 +695,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';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -179,7 +179,7 @@ if (empty($reshook))
|
||||
$object->socid = GETPOST("socid", 'int');
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->civility_id = GETPOST("civility_id", 'alpha');
|
||||
$object->civility_code = GETPOST("civility_code", 'alpha');
|
||||
$object->poste = GETPOST("poste", 'alpha');
|
||||
$object->address = GETPOST("address", 'alpha');
|
||||
$object->zip = GETPOST("zipcode", 'alpha');
|
||||
@ -367,7 +367,7 @@ if (empty($reshook))
|
||||
$object->socid = GETPOST("socid", 'int');
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->civility_id = GETPOST("civility_id", 'alpha');
|
||||
$object->civility_code = GETPOST("civility_code", 'alpha');
|
||||
$object->poste = GETPOST("poste", 'alpha');
|
||||
|
||||
$object->address = GETPOST("address", 'alpha');
|
||||
@ -621,8 +621,8 @@ else
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOST("civility", 'alpha')?GETPOST("civility", 'alpha'):$object->civility_code);
|
||||
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility_code", 'alpha'):$object->civility_code, 'civility_code');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
|
||||
@ -931,8 +931,8 @@ else
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(isset($_POST["civility"])?GETPOST("civility"):$object->civility_code);
|
||||
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility", "aZ09"):$object->civility_code, 'civility_code');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
|
||||
|
||||
@ -328,13 +328,13 @@ class Contact extends CommonObject
|
||||
$this->town=(empty($this->town)?'':$this->town);
|
||||
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
|
||||
if (empty($this->statut)) $this->statut = 0;
|
||||
|
||||
if (empty($this->civility_code) && ! is_numeric($this->civility_id)) $this->civility_code = $this->civility_id; // For backward compatibility
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||
if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',";
|
||||
elseif ($this->socid == -1) $sql .= " fk_soc=null,";
|
||||
$sql .= " civility='".$this->db->escape($this->civility_id)."'";
|
||||
$sql .= " civility='".$this->db->escape($this->civility_code)."'";
|
||||
$sql .= ", lastname='".$this->db->escape($this->lastname)."'";
|
||||
$sql .= ", firstname='".$this->db->escape($this->firstname)."'";
|
||||
$sql .= ", address='".$this->db->escape($this->address)."'";
|
||||
@ -1264,13 +1264,13 @@ class Contact extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$labelstatus = array(
|
||||
$labelStatus = array(
|
||||
0 => 'ActivityCeased',
|
||||
1 => 'InActivity',
|
||||
4 => 'InActivity',
|
||||
5 => 'ActivityCeased',
|
||||
);
|
||||
$labelstatusshort = array(
|
||||
$labelStatusShort = array(
|
||||
0 => 'ActivityCeased',
|
||||
1 => 'InActivity',
|
||||
4 => 'InActivity',
|
||||
@ -1280,8 +1280,8 @@ class Contact extends CommonObject
|
||||
$statusType = 'status4';
|
||||
if ($status==0 || $status==5) $statusType = 'status5';
|
||||
|
||||
$label = $langs->trans($labelstatus[$status]);
|
||||
$labelshort = $langs->trans($labelstatusshort[$status]);
|
||||
$label = $langs->trans($labelStatus[$status]);
|
||||
$labelshort = $langs->trans($labelStatusShort[$status]);
|
||||
|
||||
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
@ -189,6 +189,12 @@ class Contrat extends CommonObject
|
||||
protected $lines_id_index_mapper=array();
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
const STATUS_CLOSED = 2;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -1881,40 +1887,31 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
* Renvoi label of a given contrat status
|
||||
*
|
||||
* @param int $statut Status id
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode)
|
||||
public function LibStatut($status, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
if ($mode == 0)
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
|
||||
elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
|
||||
elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
|
||||
$this->labelStatus[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
|
||||
$this->labelStatusShort[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
|
||||
elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
|
||||
elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0').' '.$langs->trans("ContractStatusDraft"); }
|
||||
elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4').' '.$langs->trans("ContractStatusValidated"); }
|
||||
elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6').' '.$langs->trans("ContractStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
|
||||
elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
|
||||
elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
|
||||
}
|
||||
elseif ($mode == 4 || $mode == 6 || $mode == 7)
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
|
||||
|
||||
if ($mode == 4 || $mode == 6 || $mode == 7)
|
||||
{
|
||||
$text='';
|
||||
if ($mode == 4) {
|
||||
@ -1924,22 +1921,20 @@ class Contrat extends CommonObject
|
||||
$text.=': ';
|
||||
$text.='</span>';
|
||||
}
|
||||
$text.=($mode == 7?'<div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')) : '';
|
||||
$text.=($mode == 7?'</div>':'');
|
||||
$text.=($mode == 7?'<span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</span><span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</span><span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</span><span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="marginleft2"')) : '';
|
||||
$text.=($mode == 7?'</span>':'');
|
||||
return $text;
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
else
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
|
||||
elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
|
||||
elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2073,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();
|
||||
@ -2084,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);
|
||||
@ -2728,65 +2723,34 @@ class ContratLigne extends CommonObjectLine
|
||||
/**
|
||||
* Return label of a contract line status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param int $expired 0=Not expired, 1=Expired, -1=Both or unknown
|
||||
* @param string $moreatt More attribute
|
||||
* @return string Libelle
|
||||
*/
|
||||
public static function LibStatut($statut, $mode, $expired = -1, $moreatt = '')
|
||||
public static function LibStatut($status, $mode, $expired = -1, $moreatt = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
if ($mode == 0)
|
||||
|
||||
if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); }
|
||||
elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); }
|
||||
elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); }
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3';
|
||||
if ($status == self::STATUS_CLOSED) $statusType = 'status6';
|
||||
|
||||
$params = array(); $reg = array();
|
||||
if (preg_match('/class="(.*)"/', $moreatt, $reg))
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0', $moreatt); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4', $moreatt); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4', $moreatt); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3', $moreatt); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6', $moreatt); }
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLate"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'), 'statut0'); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'), 'statut4'); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'), 'statut4'); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'), 'statut3'); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'), 'statut6'); }
|
||||
$params = array('badgeParams'=>array('css' => $reg[1]));
|
||||
}
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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&file=invoicesnbinyear-'.$endyear.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&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&file=invoicesamountinyear-'.$endyear.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png';
|
||||
|
||||
$px2 = new DolGraph();
|
||||
|
||||
@ -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&file=invoicesnbinyear-'.$year.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&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&file=invoicesamountinyear-'.$year.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$year.'.png';
|
||||
|
||||
$px2 = new DolGraph();
|
||||
|
||||
@ -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&file=ordersnbinyear-'.$endyear.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&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&file=ordersamountinyear-'.$endyear.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$endyear.'.png';
|
||||
|
||||
$px2 = new DolGraph();
|
||||
|
||||
@ -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&file=ordersnbinyear-'.$endyear.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&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&file=ordersamountinyear-'.$endyear.'.png';
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssupplieramountinyear-'.$endyear.'.png';
|
||||
|
||||
$px2 = new DolGraph();
|
||||
|
||||
@ -496,27 +496,27 @@ abstract class CommonInvoice extends CommonObject
|
||||
$prefix='Short';
|
||||
if (! $paye){
|
||||
if ($status == 0) {
|
||||
$labelstatut = $langs->trans('BillStatusDraft');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
$labelStatus = $langs->trans('BillStatusDraft');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
}
|
||||
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
|
||||
$labelstatut = $langs->trans('BillStatusClosedUnpaid');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
|
||||
$labelStatus = $langs->trans('BillStatusClosedUnpaid');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
|
||||
$statusType='status5';
|
||||
}
|
||||
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
|
||||
$labelstatut = $langs->trans('BillStatusClosedPaidPartially');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
|
||||
$labelStatus = $langs->trans('BillStatusClosedPaidPartially');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
|
||||
$statusType='status9';
|
||||
}
|
||||
elseif ($alreadypaid <= 0) {
|
||||
$labelstatut = $langs->trans('BillStatusNotPaid');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusNotPaid');
|
||||
$labelStatus = $langs->trans('BillStatusNotPaid');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusNotPaid');
|
||||
$statusType='status1';
|
||||
}
|
||||
else {
|
||||
$labelstatut = $langs->trans('BillStatusStarted');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
$labelStatus = $langs->trans('BillStatusStarted');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
$statusType='status3';
|
||||
}
|
||||
}
|
||||
@ -525,20 +525,20 @@ abstract class CommonInvoice extends CommonObject
|
||||
$statusType='status6';
|
||||
|
||||
if ($type == self::TYPE_CREDIT_NOTE){
|
||||
$labelstatut = $langs->trans('BillStatusPaidBackOrConverted'); // credit note
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
|
||||
$labelStatus = $langs->trans('BillStatusPaidBackOrConverted'); // credit note
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
|
||||
}
|
||||
elseif ($type == self::TYPE_DEPOSIT){
|
||||
$labelstatut = $langs->trans('BillStatusConverted'); // deposit invoice
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
|
||||
$labelStatus = $langs->trans('BillStatusConverted'); // deposit invoice
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
|
||||
}
|
||||
else{
|
||||
$labelstatut = $langs->trans('BillStatusPaid');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaid');
|
||||
$labelStatus = $langs->trans('BillStatusPaid');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaid');
|
||||
}
|
||||
}
|
||||
|
||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@ -1062,13 +1062,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;
|
||||
@ -1091,7 +1091,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);
|
||||
@ -5629,7 +5629,7 @@ abstract class CommonObject
|
||||
{
|
||||
$morecss = 'minwidth100imp';
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
elseif ($type == 'datetime' || $type == 'link')
|
||||
{
|
||||
$morecss = 'minwidth200imp';
|
||||
}
|
||||
@ -6098,7 +6098,7 @@ abstract class CommonObject
|
||||
$param_list_array = explode(':', $param_list[0]);
|
||||
$showempty=(($required && $default != '')?0:1);
|
||||
|
||||
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', '', '', 0, empty($val['disabled'])?0:1);
|
||||
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, empty($val['disabled'])?0:1);
|
||||
|
||||
if (! empty($param_list_array[2])) // If we set to add a create button
|
||||
{
|
||||
|
||||
@ -1029,7 +1029,7 @@ class ExtraFields
|
||||
{
|
||||
$morecss = 'minwidth100imp';
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
elseif ($type == 'datetime' || $type == 'link')
|
||||
{
|
||||
$morecss = 'minwidth200imp';
|
||||
}
|
||||
|
||||
@ -290,42 +290,42 @@ class Fiscalyear extends CommonObject
|
||||
/**
|
||||
* Give a label from a status
|
||||
*
|
||||
* @param int $statut Id status
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statuts_short[$statut]);
|
||||
return $langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]);
|
||||
elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4');
|
||||
elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -5865,7 +5867,12 @@ class Form
|
||||
if ($classname && class_exists($classname))
|
||||
{
|
||||
$objecttmp = new $classname($this->db);
|
||||
$objecttmp->filter = $filter;
|
||||
// Make some replacement
|
||||
$sharedentities = getEntity(strtolower($classname));
|
||||
$objecttmp->filter = str_replace(
|
||||
array('__ENTITY__', '__SHARED_ENTITIES__', '__USER_ID__'),
|
||||
array($conf->entity, $sharedentities, $user->id),
|
||||
$filter);
|
||||
}
|
||||
}
|
||||
if (! is_object($objecttmp))
|
||||
@ -5874,6 +5881,7 @@ class Form
|
||||
return 'Error bad setup of type for field '.join(',', $InfoFieldList);
|
||||
}
|
||||
|
||||
//var_dump($objecttmp->filter);
|
||||
$prefixforautocompletemode=$objecttmp->element;
|
||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
|
||||
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
@ -1122,13 +1122,20 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$out="\n".'<!-- dol_get_fiche_head --><div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
|
||||
|
||||
if ($morehtmlright) $out.='<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under.
|
||||
|
||||
// Show title
|
||||
$showtitle=1;
|
||||
if (! empty($conf->dol_optimize_smallscreen)) $showtitle=0;
|
||||
|
||||
$out = "\n".'<!-- dol_get_fiche_head -->';
|
||||
|
||||
if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) {
|
||||
$out.= '<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
|
||||
}
|
||||
|
||||
// Show right part
|
||||
if ($morehtmlright) $out.='<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under.
|
||||
|
||||
// Show title
|
||||
if (! empty($title) && $showtitle)
|
||||
{
|
||||
$limittitle=30;
|
||||
@ -1138,6 +1145,8 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
$out.='</a>';
|
||||
}
|
||||
|
||||
// Show tabs
|
||||
|
||||
// Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs).
|
||||
$maxkey=-1;
|
||||
if (is_array($links) && ! empty($links))
|
||||
@ -1149,16 +1158,15 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
if (! empty($conf->dol_optimize_smallscreen)) $conf->global->MAIN_MAXTABS_IN_CARD=2;
|
||||
|
||||
// Show tabs
|
||||
$bactive=false;
|
||||
// if =0 we don't use the feature
|
||||
$limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD);
|
||||
$displaytab=0;
|
||||
$nbintab=0;
|
||||
$popuptab=0; $outmore='';
|
||||
$popuptab=0;
|
||||
$outmore='';
|
||||
for ($i = 0 ; $i <= $maxkey ; $i++)
|
||||
{
|
||||
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2]))
|
||||
{
|
||||
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) {
|
||||
// If active tab is already present
|
||||
if ($i >= $limittoshow) $limittoshow--;
|
||||
}
|
||||
@ -1166,13 +1174,10 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
|
||||
for ($i = 0 ; $i <= $maxkey ; $i++)
|
||||
{
|
||||
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2]))
|
||||
{
|
||||
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) {
|
||||
$isactive=true;
|
||||
$bactive=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$isactive=false;
|
||||
}
|
||||
|
||||
@ -1258,7 +1263,9 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
$out.="</script>";
|
||||
}
|
||||
|
||||
$out.="</div>\n";
|
||||
if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) {
|
||||
$out.="</div>\n";
|
||||
}
|
||||
|
||||
if (! $notab || $notab == -1 || $notab == -2) $out.="\n".'<div class="tabBar'.($notab == -1 ? '' : ($notab == -2 ? ' tabBarNoTop' : ' tabBarWithBottom')).'">'."\n";
|
||||
|
||||
@ -1984,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;
|
||||
}
|
||||
|
||||
|
||||
@ -8087,25 +8086,24 @@ function roundUpToNextMultiple($n, $x = 5)
|
||||
* @param string $type type of badge : Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9
|
||||
* @param string $mode default '' , pill, dot
|
||||
* @param string $url the url for link
|
||||
* @param array $params various params for future : recommended rather than adding more fuction arguments
|
||||
* @param array $params various params for future : recommended rather than adding more fuction arguments. array('attr'=>array('title'=>'abc'))
|
||||
* @return string Html badge
|
||||
*/
|
||||
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
|
||||
{
|
||||
$attr=array(
|
||||
'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
|
||||
'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'').(empty($params['css'])?'':' '.$params['css'])
|
||||
);
|
||||
|
||||
if(empty($html)){
|
||||
if (empty($html)) {
|
||||
$html = $label;
|
||||
}
|
||||
|
||||
if(!empty($url)){
|
||||
if (!empty($url)) {
|
||||
$attr['href'] = $url;
|
||||
}
|
||||
|
||||
if($mode==='dot')
|
||||
{
|
||||
if ($mode==='dot') {
|
||||
$attr['class'].= ' classfortooltip';
|
||||
$attr['title'] = $html;
|
||||
$attr['aria-label'] = $label;
|
||||
@ -8113,8 +8111,8 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
||||
}
|
||||
|
||||
// Override attr
|
||||
if(!empty($params['attr']) && is_array($params['attr'])){
|
||||
foreach($params['attr']as $key => $value){
|
||||
if (!empty($params['attr']) && is_array($params['attr'])) {
|
||||
foreach($params['attr']as $key => $value) {
|
||||
$attr[$key] = $value;
|
||||
}
|
||||
}
|
||||
@ -8125,7 +8123,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
||||
$attr = array_map('dol_escape_htmltag', $attr);
|
||||
|
||||
$TCompiledAttr = array();
|
||||
foreach($attr as $key => $value){
|
||||
foreach($attr as $key => $value) {
|
||||
$TCompiledAttr[] = $key.'="'.$value.'"';
|
||||
}
|
||||
|
||||
@ -8168,13 +8166,13 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
elseif ($displayMode == 1) {
|
||||
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
|
||||
}
|
||||
// use status with images
|
||||
elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) {
|
||||
// Use status with images (for backward compatibility)
|
||||
elseif (! empty($conf->global->MAIN_STATUS_USES_IMAGES)) {
|
||||
$return = '';
|
||||
$htmlLabel = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
||||
$htmlLabelShort = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
||||
|
||||
// For small screen, we use the short label instead of long label.
|
||||
// For small screen, we always use the short label instead of long label.
|
||||
if (! empty($conf->dol_optimize_smallscreen))
|
||||
{
|
||||
if ($displayMode == 0) $displayMode = 1;
|
||||
@ -8182,7 +8180,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
elseif ($displayMode == 6) $displayMode = 5;
|
||||
}
|
||||
|
||||
// image's filename are still in French, so we use this array to convert
|
||||
// For backward compatibility. Image's filename are still in French, so we use this array to convert
|
||||
$statusImg=array(
|
||||
'status0' => 'statut0'
|
||||
,'status1' => 'statut1'
|
||||
@ -8219,7 +8217,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
}
|
||||
}
|
||||
// Use new badge
|
||||
elseif (!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)) {
|
||||
elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
|
||||
$statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel;
|
||||
|
||||
if ($displayMode == 3) {
|
||||
|
||||
@ -128,17 +128,19 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
$i++;
|
||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||
$texttoinsert.= " 'notnull'=>".(empty($val['notnull'])?0:$val['notnull']).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
if ($val['noteditable']) $texttoinsert.= " 'noteditable'=>'".$val['noteditable']."',";
|
||||
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['css']) $texttoinsert.= " 'css'=>'".$val['css']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\",";
|
||||
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
|
||||
if ($val['disabled']) $texttoinsert.= " 'disabled'=>'".$val['disabled']."',";
|
||||
if ($val['arrayofkeyval'])
|
||||
{
|
||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||
@ -149,8 +151,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
$texttoinsert.="'".$key2."'=>'".$val2."'";
|
||||
$i++;
|
||||
}
|
||||
$texttoinsert.= ")";
|
||||
$texttoinsert.= "),";
|
||||
}
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
|
||||
|
||||
$texttoinsert.= "),\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,8 +670,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
if ($total_projectlinesa_planned) {
|
||||
$totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
|
||||
$totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
|
||||
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
|
||||
|
||||
// define progress color according to time spend vs workload
|
||||
$progressBarClass = 'progress-bar-info';
|
||||
@ -1748,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;
|
||||
|
||||
@ -1767,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();
|
||||
|
||||
@ -1796,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))
|
||||
{
|
||||
@ -1995,6 +1996,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
|
||||
* @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null
|
||||
* @param spaced $spaced bool used to add space at bottom (made by css)
|
||||
* @return string
|
||||
* @see getTaskProgressBadge()
|
||||
*/
|
||||
function getTaskProgressView($task, $label = true, $progressNumber = true, $hideOnProgressNull = false, $spaced = false)
|
||||
{
|
||||
@ -2020,26 +2022,27 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
|
||||
if ($task->planned_workload){
|
||||
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
|
||||
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
|
||||
|
||||
$diffTitle = '<br/>'.$langs->trans('ProgressDeclared').' : '.$task->progress.'%';
|
||||
$diffTitle.= '<br/>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.'%';
|
||||
$diffTitle = '<br/>'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : '');
|
||||
$diffTitle.= '<br/>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : '');
|
||||
|
||||
if($progressCalculated > doubleval($task->progress)){
|
||||
//var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.doubleval($task->progress * $warningRatio));
|
||||
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
|
||||
$progressBarClass = 'progress-bar-danger';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-danger classfortooltip"" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
|
||||
$diff = '<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
|
||||
elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
|
||||
$progressBarClass = 'progress-bar-warning';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-warning classfortooltip" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
|
||||
$diff = '<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
else{
|
||||
$progressBarClass = 'progress-bar-success';
|
||||
$title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-success classfortooltip" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-up"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
$title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).' '.$langs->trans("point"));
|
||||
$diff = '<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-up"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -2062,7 +2065,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
|
||||
if($progressNumber !== false)
|
||||
{
|
||||
$out.= ' <span class="progress-number">';
|
||||
if($progressNumber!==true){
|
||||
if ($progressNumber!==true) {
|
||||
$out.= $progressNumber; // replace label by param
|
||||
}
|
||||
else{
|
||||
@ -2087,8 +2090,21 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
|
||||
|
||||
|
||||
$out.= '</span>';
|
||||
$out.= ' <div class="progress sm '.$spaced.'" title="'.doubleval($task->progress).'%" >';
|
||||
$out.= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.doubleval($task->progress).'%"></div>';
|
||||
$out.= ' <div class="progress sm '.$spaced.'">';
|
||||
$diffval = doubleval($task->progress) - doubleval($progressCalculated);
|
||||
if ($diffval >= 0) {
|
||||
// good
|
||||
$out.= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.doubleval($task->progress).'%" title="'.doubleval($task->progress).'%">';
|
||||
$out.= ' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated / $task->progress * 100).'%" title="'.doubleval($progressCalculated).'%"></div>';
|
||||
$out.= ' </div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// bad
|
||||
$out.= ' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated).'%" title="'.doubleval($progressCalculated).'%">';
|
||||
$out.= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.($task->progress ? doubleval($task->progress / $progressCalculated * 100).'%' : '1px').'" title="'.doubleval($task->progress).'%"></div>';
|
||||
$out.= ' </div>';
|
||||
}
|
||||
$out.= ' </div>';
|
||||
$out.= '</div>';
|
||||
|
||||
@ -2101,6 +2117,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
|
||||
* @param label $label string empty = auto (progress), string = replace output
|
||||
* @param tooltip $tooltip string empty = auto , string = replace output
|
||||
* @return string
|
||||
* @see getTaskProgressView()
|
||||
*/
|
||||
function getTaskProgressBadge($task, $label = '', $tooltip = '')
|
||||
{
|
||||
@ -2117,13 +2134,13 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '')
|
||||
if ($task->planned_workload){
|
||||
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
|
||||
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
|
||||
|
||||
if($progressCalculated > doubleval($task->progress)){
|
||||
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
|
||||
$badgeClass.= 'badge-danger';
|
||||
}
|
||||
elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
|
||||
elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
|
||||
$badgeClass.= 'badge-warning';
|
||||
}
|
||||
else{
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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='';
|
||||
|
||||
/**
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -116,12 +116,12 @@ class Don extends CommonObject
|
||||
/**
|
||||
* @var array Array of status label
|
||||
*/
|
||||
public $labelstatut;
|
||||
public $labelStatus;
|
||||
|
||||
/**
|
||||
* @var array Array of status label short
|
||||
*/
|
||||
public $labelstatutshort;
|
||||
public $labelStatusShort;
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
@ -163,25 +163,25 @@ class Don extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatut) || empty($this->labelstatutshort))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("donations");
|
||||
$this->labelstatut[-1]=$langs->trans("Canceled");
|
||||
$this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated");
|
||||
$this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated");
|
||||
$this->labelstatut[2]=$langs->trans("DonationStatusPaid");
|
||||
$this->labelstatutshort[-1]=$langs->trans("Canceled");
|
||||
$this->labelstatutshort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
|
||||
$this->labelstatutshort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
|
||||
$this->labelstatutshort[2]=$langs->trans("DonationStatusPaidShort");
|
||||
$this->labelStatus[-1]=$langs->trans("Canceled");
|
||||
$this->labelStatus[0]=$langs->trans("DonationStatusPromiseNotValidated");
|
||||
$this->labelStatus[1]=$langs->trans("DonationStatusPromiseValidated");
|
||||
$this->labelStatus[2]=$langs->trans("DonationStatusPaid");
|
||||
$this->labelStatusShort[-1]=$langs->trans("Canceled");
|
||||
$this->labelStatusShort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
|
||||
$this->labelStatusShort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
|
||||
$this->labelStatusShort[2]=$langs->trans("DonationStatusPaidShort");
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_CANCELED) $statusType = 'status5';
|
||||
if ($status == self::STATUS_PAID) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelstatut[$status], $this->labelstatutshort[$status], '', $statusType, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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")."";
|
||||
@ -474,11 +478,11 @@ class PaymentDonation extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -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='';
|
||||
@ -633,7 +637,6 @@ class PaymentDonation extends CommonObject
|
||||
|
||||
$result='';
|
||||
|
||||
if (empty($this->ref)) $this->ref=$this->lib;
|
||||
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
||||
|
||||
if (!empty($this->id))
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -39,6 +39,8 @@ if ($user->societe_id > 0) {
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$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>";
|
||||
|
||||
@ -188,6 +188,10 @@ class EmailCollector extends CommonObject
|
||||
public $debuginfo;
|
||||
|
||||
|
||||
const STATUS_DISABLED = 0;
|
||||
const STATUS_ENABLED = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -511,47 +515,20 @@ class EmailCollector extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled');
|
||||
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_DISABLED] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
$statusType = 'status5';
|
||||
if ($status == self::STATUS_ENABLED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -414,46 +414,46 @@ class EmailCollectorAction extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("emailcollector");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
$this->labelStatus[1] = $langs->trans('Enabled');
|
||||
$this->labelStatus[0] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -389,46 +389,46 @@ class EmailCollectorFilter extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("emailcollector");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
$this->labelStatus[1] = $langs->trans('Enabled');
|
||||
$this->labelStatus[0] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +92,7 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$extrafields->fetch_name_optionals_label(OrderLine::$table_element);
|
||||
|
||||
// Load object. Make an object->fetch
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||
@ -301,12 +302,11 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline)) {
|
||||
if (is_array($extrafields->attributes[$object->table_element_line]['label'])) {
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
foreach ($extrafields->attributes[$object->table_element_line]['label'] as $key => $value) {
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
@ -627,11 +627,10 @@ if (empty($reshook))
|
||||
$line = new ExpeditionLigne($db);
|
||||
|
||||
// Extrafields Lines
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
|
||||
// Unset extrafield POST Data
|
||||
if (is_array($extralabelsline)) {
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
if (is_array($extrafields->attributes[$object->table_element_line]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element_line]['label'] as $key => $value) {
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1030,6 @@ if ($action == 'create')
|
||||
|
||||
if (empty($reshook)) {
|
||||
// copy from order
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
if ($object->fetch_optionals() > 0) {
|
||||
$expe->array_options = array_merge($expe->array_options, $object->array_options);
|
||||
}
|
||||
@ -1572,11 +1570,9 @@ if ($action == 'create')
|
||||
{
|
||||
//var_dump($line);
|
||||
$colspan=5;
|
||||
$extrafields->fetch_name_optionals_label($expe->table_element_line);
|
||||
$expLine = new ExpeditionLigne($db);
|
||||
|
||||
$srcLine = new OrderLine($db);
|
||||
$extrafields->fetch_name_optionals_label($srcLine->table_element);
|
||||
$srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
|
||||
//$line->fetch_optionals($line->id);
|
||||
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
|
||||
@ -2464,8 +2460,6 @@ elseif ($id || $ref)
|
||||
|
||||
$lines[$i]->fetch_optionals($lines[$i]->id);
|
||||
|
||||
$extrafields->fetch_name_optionals_label($lines[$i]->table_element);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
||||
{
|
||||
|
||||
@ -1673,44 +1673,44 @@ class Expedition extends CommonObject
|
||||
/**
|
||||
* Return label of a status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id statut
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($statut, $mode)
|
||||
public function LibStatut($status, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode==0)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1) return $langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==2) return $langs->trans($this->statuts[$statut]);
|
||||
if ($status==0) return $langs->trans($this->statuts[$status]);
|
||||
elseif ($status==1) return $langs->trans($this->statuts[$status]);
|
||||
elseif ($status==2) return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode==1)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->statutshorts[$statut]);
|
||||
elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]);
|
||||
elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]);
|
||||
if ($status==0) return $langs->trans($this->statutshorts[$status]);
|
||||
elseif ($status==1) return $langs->trans($this->statutshorts[$status]);
|
||||
elseif ($status==2) return $langs->trans($this->statutshorts[$status]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4');
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0');
|
||||
elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4');
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
|
||||
elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4');
|
||||
elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
|
||||
if ($status==0) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0');
|
||||
elseif ($status==1) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4');
|
||||
elseif ($status==2) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1506,7 +1506,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("ModePaiement").'</td>';
|
||||
print '<td>';
|
||||
$form->select_types_paiements(2, 'fk_c_paiement');
|
||||
$form->select_types_paiements('', 'fk_c_paiement');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1832,7 +1832,7 @@ else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("ModePaiement").'</td>';
|
||||
print '<td>'.$object->libelle_paiement.'</td>';
|
||||
print '<td>'.$object->fk_c_paiement.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
@ -101,9 +105,6 @@ class ExpenseReport extends CommonObject
|
||||
// Paiement
|
||||
public $user_paid_infos;
|
||||
|
||||
/*
|
||||
END ACTIONS
|
||||
*/
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
@ -198,7 +199,7 @@ class ExpenseReport extends CommonObject
|
||||
// List of language codes for status
|
||||
$this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
|
||||
$this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
|
||||
$this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut5');
|
||||
$this->statuts_logo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -514,7 +515,7 @@ class ExpenseReport extends CommonObject
|
||||
$sql.= " d.fk_user_author, d.fk_user_modif, d.fk_user_validator,";
|
||||
$sql.= " d.fk_user_valid, d.fk_user_approve,";
|
||||
$sql.= " d.fk_statut as status, d.fk_c_paiement, d.paid,";
|
||||
$sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
|
||||
$sql.= " dp.libelle as label_payment, dp.code as code_paiement"; // INNER JOIN paiement
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id";
|
||||
if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'";
|
||||
@ -570,15 +571,13 @@ class ExpenseReport extends CommonObject
|
||||
$this->fk_c_paiement = $obj->fk_c_paiement;
|
||||
$this->paid = $obj->paid;
|
||||
|
||||
if ($this->fk_statut==5 || $this->fk_statut==6)
|
||||
if ($this->fk_statut == self::STATUS_APPROVED || $this->fk_statut == self::STATUS_CLOSED)
|
||||
{
|
||||
$user_valid = new User($this->db);
|
||||
if ($this->fk_user_valid > 0) $user_valid->fetch($this->fk_user_valid);
|
||||
$this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
|
||||
}
|
||||
|
||||
$this->libelle_statut = $obj->libelle_statut;
|
||||
$this->libelle_paiement = $obj->libelle_paiement;
|
||||
$this->code_statut = $obj->code_statut;
|
||||
$this->code_paiement = $obj->code_paiement;
|
||||
|
||||
@ -683,29 +682,15 @@ class ExpenseReport extends CommonObject
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
return $langs->transnoentities($this->statuts[$status]);
|
||||
$labelStatus = $langs->trans($this->statuts[$status]);
|
||||
$labelStatusShort = $langs->trans($this->statuts_short[$status]);
|
||||
|
||||
elseif ($mode == 1)
|
||||
return $langs->transnoentities($this->statuts_short[$status]);
|
||||
$statusType = $this->statuts_logo[$status];
|
||||
|
||||
elseif ($mode == 2)
|
||||
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]);
|
||||
|
||||
elseif ($mode == 3)
|
||||
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
|
||||
|
||||
elseif ($mode == 4)
|
||||
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]);
|
||||
|
||||
elseif ($mode == 5)
|
||||
return '<span class="hideonsmartphone">'.$langs->transnoentities($this->statuts_short[$status]).' </span>'.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
|
||||
|
||||
elseif ($mode == 6)
|
||||
return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -476,11 +475,11 @@ class PaymentExpenseReport extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -221,7 +221,6 @@ if ($result)
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
|
||||
print '<td class="right">';
|
||||
//print $obj->libelle;
|
||||
print $expensereportstatic->LibStatut($obj->fk_status, 3);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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>";
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -539,11 +539,11 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
/**
|
||||
* Return label of a status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -551,33 +551,33 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statutshort[$statut]);
|
||||
return $langs->trans($this->statutshort[$status]);
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4');
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8');
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0');
|
||||
elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4');
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut8');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]);
|
||||
elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
|
||||
elseif ($statut==1) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]), 'statut4');
|
||||
elseif ($statut==2) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]), 'statut8');
|
||||
if ($status==0) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut0');
|
||||
elseif ($status==1) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut4');
|
||||
elseif ($status==2) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut8');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -117,14 +117,14 @@ if ($resql)
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'</th></tr>';
|
||||
print "</tr>\n";
|
||||
foreach (array(0,1,2,3,4,5,6) as $statut)
|
||||
foreach (array(0,1,2,3,4,5,6) as $status)
|
||||
{
|
||||
$dataseries[]=array($commandestatic->LibStatut($statut, 1), (isset($vals[$statut])?(int) $vals[$statut]:0));
|
||||
$dataseries[]=array($commandestatic->LibStatut($status, 1), (isset($vals[$status])?(int) $vals[$status]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$commandestatic->LibStatut($statut, 0).'</td>';
|
||||
print '<td class="right"><a href="list.php?statut='.$statut.'">'.(isset($vals[$statut])?$vals[$statut]:0).'</a></td>';
|
||||
print '<td>'.$commandestatic->LibStatut($status, 0).'</td>';
|
||||
print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status])?$vals[$status]:0).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -48,10 +48,6 @@ $id=GETPOST('id', 'int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'holiday', $id, 'holiday');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("holiday","mails"));
|
||||
|
||||
@ -65,14 +61,15 @@ if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
||||
$error = 0;
|
||||
|
||||
$object = new Holiday($db);
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
if ($id > 0)
|
||||
if (($id > 0) || $ref)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
// Check current user can read this leave request
|
||||
$canread = 0;
|
||||
@ -92,6 +89,10 @@ $candelete = 0;
|
||||
if (! empty($user->rights->holiday->delete)) $candelete=1;
|
||||
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1;
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
@ -1217,68 +1220,40 @@ class Holiday extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Returns the label of a statut
|
||||
* Returns the label of a status
|
||||
*
|
||||
* @param int $statut id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @param integer $startdate Date holiday should start
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0, $startdate = '')
|
||||
public function LibStatut($status, $mode = 0, $startdate = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
// phpcs:enable
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('DraftCP');
|
||||
elseif ($statut == 2) return $langs->trans('ToReviewCP');
|
||||
elseif ($statut == 3) return $langs->trans('ApprovedCP');
|
||||
elseif ($statut == 4) return $langs->trans('CancelCP');
|
||||
elseif ($statut == 5) return $langs->trans('RefuseCP');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0').' '.$langs->trans('DraftCP'); // Draft
|
||||
elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval
|
||||
elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved).' '.$langs->trans('ApprovedCP');
|
||||
elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5').' '.$langs->trans('CancelCP');
|
||||
elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5').' '.$langs->trans('RefuseCP');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0');
|
||||
elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1');
|
||||
elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved);
|
||||
elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5');
|
||||
elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5');
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft
|
||||
elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval
|
||||
elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved);
|
||||
elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5');
|
||||
elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft
|
||||
elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval
|
||||
elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved);
|
||||
elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5');
|
||||
elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5');
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('DraftCP');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
|
||||
$this->labelStatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
|
||||
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('CancelCP');
|
||||
$this->labelStatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('DraftCP');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
|
||||
$this->labelStatusShort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
|
||||
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('CancelCP');
|
||||
$this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
|
||||
}
|
||||
|
||||
else return $statut;
|
||||
$statusType = 'status6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $statusType = 'status4';
|
||||
if ($status == self::STATUS_DRAFT) $statusType = 'status0';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
|
||||
if ($status == self::STATUS_CANCELED) $statusType = 'status5';
|
||||
if ($status == self::STATUS_REFUSED) $statusType = 'status5';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
|
||||
@ -121,6 +121,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'cp.ref'=>'Ref',
|
||||
'cp.description'=>'Description',
|
||||
'uu.lastname'=>'EmployeeLastname',
|
||||
'uu.firstname'=>'EmployeeFirstname',
|
||||
@ -289,10 +290,7 @@ $sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pou
|
||||
// Search all
|
||||
if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
// Ref
|
||||
if(!empty($search_ref))
|
||||
{
|
||||
$sql.= " AND cp.rowid = ".(int) $db->escape($search_ref);
|
||||
}
|
||||
if (!empty($search_ref)) $sql.= natural_search("cp.ref", $search_ref);
|
||||
// Start date
|
||||
$sql.= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
|
||||
// End date
|
||||
|
||||
@ -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
|
||||
|
||||
@ -248,84 +248,13 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// Last expense report (old module)
|
||||
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = d.fk_user";
|
||||
$sql.= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')';
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid;
|
||||
$sql.= $db->order("d.tms", "DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).'</th>';
|
||||
print '<th class="right">'.$langs->trans("FeesKilometersOrAmout").'</th>';
|
||||
print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
|
||||
print '<th width="16"> </th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
|
||||
$deplacementstatic=new Deplacement($db);
|
||||
$userstatic=new User($db);
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$deplacementstatic->ref=$obj->rowid;
|
||||
$deplacementstatic->id=$obj->rowid;
|
||||
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->statut=$obj->statut;
|
||||
$userstatic->photo=$obj->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$deplacementstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).'</td>';
|
||||
print '<td class="right">'.$obj->km.'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
|
||||
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut, 3).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
// Last expense report (new module)
|
||||
// Latest expense report
|
||||
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
|
||||
@ -342,7 +271,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -6,7 +6,7 @@ ModuleBuilderDesc2=Path where modules are generated/edited (first directory for
|
||||
ModuleBuilderDesc3=Generated/editable modules found: <strong>%s</strong>
|
||||
ModuleBuilderDesc4=A module is detected as 'editable' when the file <strong>%s</strong> exists in root of module directory
|
||||
NewModule=New module
|
||||
NewObject=New object
|
||||
NewObjectInModulebuilder=New object
|
||||
ModuleKey=Module key
|
||||
ObjectKey=Object key
|
||||
ModuleInitialized=Module initialized
|
||||
@ -66,8 +66,8 @@ ReadmeFile=Readme file
|
||||
ChangeLog=ChangeLog file
|
||||
TestClassFile=File for PHP Unit Test class
|
||||
SqlFile=Sql file
|
||||
PageForLib=File for PHP library
|
||||
PageForObjLib=File for PHP library dedicated to object
|
||||
PageForLib=File for the common PHP library
|
||||
PageForObjLib=File for the PHP library dedicated to object
|
||||
SqlFileExtraFields=Sql file for complementary attributes
|
||||
SqlFileKey=Sql file for keys
|
||||
SqlFileKeyExtraFields=Sql file for keys of complementary attributes
|
||||
@ -124,4 +124,14 @@ UseSpecificEditorURL = Use a specific editor URL
|
||||
UseSpecificFamily = Use a specific family
|
||||
UseSpecificAuthor = Use a specific author
|
||||
UseSpecificVersion = Use a specific initial version
|
||||
ModuleMustBeEnabled=The module/application must be enabled first
|
||||
ModuleMustBeEnabled=The module/application must be enabled first
|
||||
IncludeRefGeneration=The reference of object must be generated automatically
|
||||
IncludeRefGenerationHelp=Check this if you want to include code to manage the generation automatically of the reference
|
||||
IncludeDocGeneration=I want to generate some documents from the object
|
||||
IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record.
|
||||
ShowOnCombobox=Show value into combobox
|
||||
KeyForTooltip=Key for tooltip
|
||||
CSSClass=CSS Class
|
||||
NotEditable=Not editable
|
||||
ForeignKey=Foreign key
|
||||
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
|
||||
@ -66,14 +66,14 @@ class Livraison extends CommonObject
|
||||
public $date_delivery; // Date really received
|
||||
|
||||
/**
|
||||
* @var integer|string date_creation
|
||||
*/
|
||||
* @var integer|string date_creation
|
||||
*/
|
||||
public $date_creation;
|
||||
|
||||
|
||||
public $date_valid;
|
||||
public $model_pdf;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -829,44 +829,44 @@ class Livraison extends CommonObject
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode)
|
||||
public function LibStatut($status, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode==0)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans('StatusDeliveryCanceled');
|
||||
elseif ($statut==0) return $langs->trans('StatusDeliveryDraft');
|
||||
elseif ($statut==1) return $langs->trans('StatusDeliveryValidated');
|
||||
if ($status==-1) return $langs->trans('StatusDeliveryCanceled');
|
||||
elseif ($status==0) return $langs->trans('StatusDeliveryDraft');
|
||||
elseif ($status==1) return $langs->trans('StatusDeliveryValidated');
|
||||
}
|
||||
elseif ($mode==1)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==0) return $langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1) return $langs->trans($this->statuts[$statut]);
|
||||
if ($status==-1) return $langs->trans($this->statuts[$status]);
|
||||
elseif ($status==0) return $langs->trans($this->statuts[$status]);
|
||||
elseif ($status==1) return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
|
||||
if ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
|
||||
if ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
|
||||
if ($status==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
|
||||
if ($status==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
|
||||
if ($status==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled');
|
||||
elseif ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0').' '.$langs->trans('StatusDeliveryDraft');
|
||||
elseif ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4').' '.$langs->trans('StatusDeliveryValidated');
|
||||
if ($status==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled');
|
||||
elseif ($status==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0').' '.$langs->trans('StatusDeliveryDraft');
|
||||
elseif ($status==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4').' '.$langs->trans('StatusDeliveryValidated');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans('StatusDeliveryCanceled').' '.img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
|
||||
elseif ($statut==0) return $langs->trans('StatusDeliveryDraft').' '.img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
|
||||
elseif ($statut==1) return $langs->trans('StatusDeliveryValidated').' '.img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
|
||||
if ($status==-1) return $langs->trans('StatusDeliveryCanceled').' '.img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5');
|
||||
elseif ($status==0) return $langs->trans('StatusDeliveryDraft').' '.img_picto($langs->trans('StatusDeliveryDraft'), 'statut0');
|
||||
elseif ($status==1) return $langs->trans('StatusDeliveryValidated').' '.img_picto($langs->trans('StatusDeliveryValidated'), 'statut4');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
@ -408,12 +411,12 @@ class Loan extends CommonObject
|
||||
/**
|
||||
* Return label for given status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0, $alreadypaid = -1)
|
||||
public function LibStatut($status, $mode = 0, $alreadypaid = -1)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -421,38 +424,38 @@ class Loan extends CommonObject
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
elseif ($statut == 1) return $langs->trans("Paid");
|
||||
if ($status == 0) return $langs->trans("Unpaid");
|
||||
elseif ($status == 1) return $langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
|
||||
else return "Error, mode/status not found";
|
||||
|
||||
@ -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;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user