on goung
This commit is contained in:
commit
720539ff46
@ -29,7 +29,7 @@ PHPoAuthLib 0.8.2 MIT License Yes
|
|||||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||||
PSR/Logs 1.0 Library for logs (used by DebugBar)
|
PSR/Logs 1.0 Library for logs (used by DebugBar)
|
||||||
PSR/simple-cache ? Library for cache (used by PHPSpreadSheet)
|
PSR/simple-cache ? Library for cache (used by PHPSpreadSheet)
|
||||||
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||||
Sabre 3.2.2 BSD Yes DAV support
|
Sabre 3.2.2 BSD Yes DAV support
|
||||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||||
Stripe 6.43.1 MIT licence Yes Library for Stripe module
|
Stripe 6.43.1 MIT licence Yes Library for Stripe module
|
||||||
|
|||||||
@ -232,6 +232,16 @@ Change content of file htdocs/includes/restler/framework/Luracast/Restler/explor
|
|||||||
if (!is_string($className)) return;
|
if (!is_string($className)) return;
|
||||||
//var_dump($className);
|
//var_dump($className);
|
||||||
|
|
||||||
|
* Add line into Data/Text.php to complete function
|
||||||
|
|
||||||
|
public static function endsWith($haystack, $needle)
|
||||||
|
{
|
||||||
|
$length = strlen($needle);
|
||||||
|
if ($length == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// @CHANGE LDR
|
||||||
|
if (!is_string($haystack)) return false;
|
||||||
|
|
||||||
|
|
||||||
PARSEDOWN
|
PARSEDOWN
|
||||||
|
|||||||
@ -146,12 +146,7 @@ $arrayfields = array(
|
|||||||
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -707,7 +707,7 @@ class Documents extends DolibarrApi
|
|||||||
|
|
||||||
if (!empty($createdirifnotexists)) {
|
if (!empty($createdirifnotexists)) {
|
||||||
if (dol_mkdir($upload_dir) < 0) { // needed by products
|
if (dol_mkdir($upload_dir) < 0) { // needed by products
|
||||||
throw new RestException(500, 'Error while trying to create directory.');
|
throw new RestException(500, 'Error while trying to create directory '.$upload_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -109,7 +109,7 @@ class Login
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate token for user
|
// Generate token for user
|
||||||
$token = dol_hash($login.uniqid().$conf->global->MAIN_API_KEY, 1);
|
$token = dol_hash($login.uniqid().(empty($conf->global->MAIN_API_KEY)?'':$conf->global->MAIN_API_KEY), 1);
|
||||||
|
|
||||||
// We store API token into database
|
// We store API token into database
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||||
@ -132,7 +132,7 @@ class Login
|
|||||||
'code' => 200,
|
'code' => 200,
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'entity' => $tmpuser->entity,
|
'entity' => $tmpuser->entity,
|
||||||
'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
|
'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (recorded for your user). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,14 +141,8 @@ $arrayfields = array(
|
|||||||
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
|
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -155,14 +155,8 @@ $arrayfields = array(
|
|||||||
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
|
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,18 @@ class PaymentVarious extends CommonObject
|
|||||||
public $fk_project;
|
public $fk_project;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int Bank account ID
|
||||||
|
*/
|
||||||
|
public $fk_account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Bank account ID
|
||||||
|
* @deprecated See fk_account
|
||||||
|
*/
|
||||||
|
public $accountid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int ID record into llx_bank
|
||||||
*/
|
*/
|
||||||
public $fk_bank;
|
public $fk_bank;
|
||||||
|
|
||||||
@ -102,11 +113,6 @@ class PaymentVarious extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $categorie_transaction;
|
public $categorie_transaction;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int Account ID
|
|
||||||
*/
|
|
||||||
public $accountid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
@ -397,6 +403,10 @@ class PaymentVarious extends CommonObject
|
|||||||
$this->fk_bank = (int) $this->fk_bank;
|
$this->fk_bank = (int) $this->fk_bank;
|
||||||
$this->fk_user_author = (int) $this->fk_user_author;
|
$this->fk_user_author = (int) $this->fk_user_author;
|
||||||
$this->fk_user_modif = (int) $this->fk_user_modif;
|
$this->fk_user_modif = (int) $this->fk_user_modif;
|
||||||
|
$this->fk_account = (int) $this->fk_account;
|
||||||
|
if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility
|
||||||
|
$this->fk_account = $this->accountid;
|
||||||
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!$this->label)
|
if (!$this->label)
|
||||||
@ -409,9 +419,9 @@ class PaymentVarious extends CommonObject
|
|||||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
|
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
if (!empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
|
if (!empty($conf->banque->enabled) && (empty($this->fk_account) || $this->fk_account <= 0))
|
||||||
{
|
{
|
||||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account"));
|
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
|
if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
|
||||||
@ -454,7 +464,7 @@ class PaymentVarious extends CommonObject
|
|||||||
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0);
|
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0);
|
||||||
$sql .= ", ".$user->id;
|
$sql .= ", ".$user->id;
|
||||||
$sql .= ", '".$this->db->idate($now)."'";
|
$sql .= ", '".$this->db->idate($now)."'";
|
||||||
$sql .= ", NULL";
|
$sql .= ", NULL"; // Filled later
|
||||||
$sql .= ", ".$conf->entity;
|
$sql .= ", ".$conf->entity;
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
@ -473,7 +483,7 @@ class PaymentVarious extends CommonObject
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
$acc = new Account($this->db);
|
$acc = new Account($this->db);
|
||||||
$result = $acc->fetch($this->accountid);
|
$result = $acc->fetch($this->fk_account);
|
||||||
if ($result <= 0) dol_print_error($this->db);
|
if ($result <= 0) dol_print_error($this->db);
|
||||||
|
|
||||||
// Insert payment into llx_bank
|
// Insert payment into llx_bank
|
||||||
@ -495,7 +505,7 @@ class PaymentVarious extends CommonObject
|
|||||||
$this->datev
|
$this->datev
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update fk_bank into llx_paiement.
|
// Update fk_bank into llx_payment_various
|
||||||
// So we know the payment which has generate the banking ecriture
|
// So we know the payment which has generate the banking ecriture
|
||||||
if ($bank_line_id > 0) {
|
if ($bank_line_id > 0) {
|
||||||
$this->update_fk_bank($bank_line_id);
|
$this->update_fk_bank($bank_line_id);
|
||||||
|
|||||||
@ -106,14 +106,8 @@ $arrayfields = array(
|
|||||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
|
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -491,7 +491,7 @@ if ($id)
|
|||||||
);
|
);
|
||||||
$formquestion[] = array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1);
|
$formquestion[] = array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1);
|
||||||
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1);
|
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1);
|
||||||
$formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1));
|
$formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1, '', 0, 'minwidth200', 1));
|
||||||
|
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 300);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 300);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,14 +120,8 @@ foreach ($object->fields as $key => $val)
|
|||||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -135,14 +135,8 @@ $arrayfields = array(
|
|||||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -213,7 +213,7 @@ if ($object->id > 0)
|
|||||||
$head = facture_prepare_head($object);
|
$head = facture_prepare_head($object);
|
||||||
}
|
}
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'standingorders', $title, -1, 'bill');
|
print dol_get_fiche_head($head, 'standingorders', $title, -1, ($type == 'bank-transfer' ? 'supplier_invoice' : 'bill'));
|
||||||
|
|
||||||
// Invoice content
|
// Invoice content
|
||||||
if ($type == 'bank-transfer') {
|
if ($type == 'bank-transfer') {
|
||||||
|
|||||||
@ -229,6 +229,8 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
|
$total_ht_outcome = $total_ttc_outcome = $total_ht_income = $total_ttc_income = 0;
|
||||||
|
|
||||||
|
|
||||||
if ($modecompta == 'BOOKKEEPING')
|
if ($modecompta == 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
@ -438,16 +440,97 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
if ($total_ttc == 0)
|
if ($total_ttc == 0)
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total_ht_income += $total_ht;
|
||||||
|
$total_ttc_income += $total_ttc;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" class="right">'.price($total_ht).'</td>';
|
print '<td colspan="3" class="right">'.price($total_ht).'</td>';
|
||||||
print '<td colspan="3" class="right">'.price($total_ttc).'</td>';
|
print '<td colspan="3" class="right">'.price($total_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Donations
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!empty($conf->don->enabled))
|
||||||
|
{
|
||||||
|
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("Donations").'</td></tr>';
|
||||||
|
|
||||||
|
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES')
|
||||||
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
|
$sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
|
$sql .= " WHERE p.entity IN (".getEntity('donation').")";
|
||||||
|
$sql .= " AND fk_statut in (1,2)";
|
||||||
|
} else {
|
||||||
|
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||||
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||||
|
$sql .= " WHERE p.entity IN (".getEntity('donation').")";
|
||||||
|
$sql .= " AND fk_statut >= 2";
|
||||||
|
}
|
||||||
|
if (!empty($date_start) && !empty($date_end))
|
||||||
|
$sql .= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
|
||||||
|
}
|
||||||
|
$sql .= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
||||||
|
$newsortfield = $sortfield;
|
||||||
|
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm';
|
||||||
|
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
||||||
|
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
||||||
|
$sql .= $db->order($newsortfield, $sortorder);
|
||||||
|
|
||||||
|
dol_syslog("get dunning");
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$subtotal_ht = 0;
|
||||||
|
$subtotal_ttc = 0;
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$i = 0;
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$total_ht += $obj->amount;
|
||||||
|
$total_ttc += $obj->amount;
|
||||||
|
$subtotal_ht += $obj->amount;
|
||||||
|
$subtotal_ttc += $obj->amount;
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td> </td>';
|
||||||
|
|
||||||
|
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/don/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||||
|
|
||||||
|
if ($modecompta == 'CREANCES-DETTES') print '<td class="right">'.price($obj->amount).'</td>';
|
||||||
|
print '<td class="right">'.price($obj->amount).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print '<tr class="oddeven"><td> </td>';
|
||||||
|
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
$total_ht_income += $subtotal_ht;
|
||||||
|
$total_ttc_income += $subtotal_ttc;
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
|
||||||
|
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Suppliers invoices
|
* Suppliers invoices
|
||||||
@ -515,7 +598,7 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,6 +606,9 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total_ht_outcome += $subtotal_ht;
|
||||||
|
$total_ttc_outcome += $subtotal_ttc;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||||
@ -530,7 +616,6 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Charges sociales non deductibles
|
* Charges sociales non deductibles
|
||||||
*/
|
*/
|
||||||
@ -592,12 +677,15 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total_ht_outcome += $subtotal_ht;
|
||||||
|
$total_ttc_outcome += $subtotal_ttc;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||||
@ -667,36 +755,21 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total_ht_outcome += $subtotal_ht;
|
||||||
|
$total_ttc_outcome += $subtotal_ttc;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($mysoc->tva_assuj == 'franchise') // Non assujetti
|
|
||||||
{
|
|
||||||
// Total
|
|
||||||
print '<tr>';
|
|
||||||
print '<td colspan="4"> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
|
||||||
print '<td class="border right">'.price($total_ht).'</td>';
|
|
||||||
print '<td class="right">'.price($total_ttc).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr>';
|
|
||||||
print '<td colspan="4"> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Salaries
|
* Salaries
|
||||||
@ -759,12 +832,15 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total_ht_outcome += $subtotal_ht;
|
||||||
|
$total_ttc_outcome += $subtotal_ttc;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||||
@ -841,98 +917,26 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total_ht_outcome += $subtotal_ht;
|
||||||
|
$total_ttc_outcome += $subtotal_ttc;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Donations
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!empty($conf->don->enabled))
|
|
||||||
{
|
|
||||||
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("Donations").'</td></tr>';
|
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES')
|
|
||||||
{
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
|
||||||
{
|
|
||||||
$sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as p";
|
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('donation').")";
|
|
||||||
$sql .= " AND fk_statut in (1,2)";
|
|
||||||
} else {
|
|
||||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as p";
|
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('donation').")";
|
|
||||||
$sql .= " AND fk_statut >= 2";
|
|
||||||
}
|
|
||||||
if (!empty($date_start) && !empty($date_end))
|
|
||||||
$sql .= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
|
|
||||||
}
|
|
||||||
$sql .= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
|
||||||
$newsortfield = $sortfield;
|
|
||||||
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm';
|
|
||||||
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
|
||||||
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
|
||||||
$sql .= $db->order($newsortfield, $sortorder);
|
|
||||||
|
|
||||||
dol_syslog("get dunning");
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$subtotal_ht = 0;
|
|
||||||
$subtotal_ttc = 0;
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
|
|
||||||
$total_ht += $obj->amount;
|
|
||||||
$total_ttc += $obj->amount;
|
|
||||||
$subtotal_ht += $obj->amount;
|
|
||||||
$subtotal_ttc += $obj->amount;
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td> </td>';
|
|
||||||
|
|
||||||
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/don/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES') print '<td class="right">'.price($obj->amount).'</td>';
|
|
||||||
print '<td class="right">'.price($obj->amount).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print '<tr class="oddeven"><td> </td>';
|
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
|
||||||
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
|
|
||||||
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Various Payments
|
* Various Payments
|
||||||
*/
|
*/
|
||||||
|
//$conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY = 1;
|
||||||
|
|
||||||
if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->banque->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES"))
|
if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->banque->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
@ -953,12 +957,14 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Debit
|
// Debit (payment of suppliers for example)
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
if (isset($obj->amount))
|
if (isset($obj->amount))
|
||||||
{
|
{
|
||||||
$subtotal_ht += -$obj->amount;
|
$subtotal_ht += -$obj->amount;
|
||||||
$subtotal_ttc += -$obj->amount;
|
$subtotal_ttc += -$obj->amount;
|
||||||
|
$total_ht_outcome += $obj->amount;
|
||||||
|
$total_ttc_outcome += $obj->amount;
|
||||||
}
|
}
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print "<td>".$langs->trans("Debit")."</td>\n";
|
print "<td>".$langs->trans("Debit")."</td>\n";
|
||||||
@ -966,12 +972,14 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
print '<td class="right">'.price(-$obj->amount)."</td>\n";
|
print '<td class="right">'.price(-$obj->amount)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Credit
|
// Credit (payment received from customer for example)
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
if (isset($obj->amount))
|
if (isset($obj->amount))
|
||||||
{
|
{
|
||||||
$subtotal_ht += $obj->amount;
|
$subtotal_ht += $obj->amount;
|
||||||
$subtotal_ttc += $obj->amount;
|
$subtotal_ttc += $obj->amount;
|
||||||
|
$total_ht_income += $obj->amount;
|
||||||
|
$total_ttc_income += $obj->amount;
|
||||||
}
|
}
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print "<td>".$langs->trans("Credit")."</td>\n";
|
print "<td>".$langs->trans("Credit")."</td>\n";
|
||||||
@ -1030,6 +1038,8 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
}
|
}
|
||||||
$total_ht += $subtotal_ht;
|
$total_ht += $subtotal_ht;
|
||||||
$total_ttc += $subtotal_ttc;
|
$total_ttc += $subtotal_ttc;
|
||||||
|
$total_ht_income += $subtotal_ht;
|
||||||
|
$total_ttc_income += $subtotal_ttc;
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
|
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
|
||||||
@ -1050,7 +1060,7 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
{
|
{
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
// TVA a payer
|
// VAT to pay
|
||||||
$amount = 0;
|
$amount = 0;
|
||||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.tva) as amount";
|
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.tva) as amount";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
@ -1091,13 +1101,15 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
$total_ht_outcome -= 0;
|
||||||
|
$total_ttc_outcome -= $amount;
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print "<td>".$langs->trans("VATToPay")."</td>\n";
|
print "<td>".$langs->trans("VATToPay")."</td>\n";
|
||||||
print '<td class="right"> </td>'."\n";
|
print '<td class="right"> </td>'."\n";
|
||||||
print '<td class="right">'.price($amount)."</td>\n";
|
print '<td class="right">'.price($amount)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// TVA a recuperer
|
// VAT to retreive
|
||||||
$amount = 0;
|
$amount = 0;
|
||||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
|
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
@ -1139,6 +1151,9 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
$total_ht_income += 0;
|
||||||
|
$total_ttc_income += $amount;
|
||||||
|
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td>'.$langs->trans("VATToCollect")."</td>\n";
|
print '<td>'.$langs->trans("VATToCollect")."</td>\n";
|
||||||
print '<td class="right"> </td>'."\n";
|
print '<td class="right"> </td>'."\n";
|
||||||
@ -1182,10 +1197,12 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
$total_ht_outcome -= 0;
|
||||||
|
$total_ttc_outcome -= $amount;
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print "<td>".$langs->trans("VATPaid")."</td>\n";
|
print "<td>".$langs->trans("VATPaid")."</td>\n";
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td <class="right">'.price($amount)."</td>\n";
|
print '<td <class="right"></td>'."\n";
|
||||||
print '<td class="right">'.price($amount)."</td>\n";
|
print '<td class="right">'.price($amount)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -1226,16 +1243,18 @@ if ($modecompta == 'BOOKKEEPING')
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
$total_ht_income += 0;
|
||||||
|
$total_ttc_income += $amount;
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print "<td>".$langs->trans("VATCollected")."</td>\n";
|
print "<td>".$langs->trans("VATCollected")."</td>\n";
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td class="right">'.price($amount)."</td>\n";
|
print '<td class="right"></td>'."\n";
|
||||||
print '<td class="right">'.price($amount)."</td>\n";
|
print '<td class="right">'.price($amount)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mysoc->tva_assuj != 'franchise') // Assujetti
|
if ($mysoc->tva_assuj != '0') // Assujetti
|
||||||
{
|
{
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
@ -1250,25 +1269,31 @@ $object = array(&$total_ht, &$total_ttc);
|
|||||||
$parameters["mode"] = $modecompta;
|
$parameters["mode"] = $modecompta;
|
||||||
$parameters["date_start"] = $date_start;
|
$parameters["date_start"] = $date_start;
|
||||||
$parameters["date_end"] = $date_end;
|
$parameters["date_end"] = $date_end;
|
||||||
$parameters["bc"] = $bc;
|
|
||||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('externalbalance'));
|
$hookmanager->initHooks(array('externalbalance'));
|
||||||
$reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
if ($mysoc->tva_assuj != 'franchise') // Assujetti
|
|
||||||
{
|
|
||||||
// Total
|
// Total
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="4"> </td>';
|
print '<td colspan="4"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
|
||||||
|
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
|
||||||
|
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
|
||||||
|
print '</tr>';
|
||||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
|
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
|
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
|
||||||
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
|
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -131,14 +131,8 @@ $arrayfields = array(
|
|||||||
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -130,14 +130,8 @@ $arrayfields = array(
|
|||||||
'cd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
|
'cd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -355,7 +355,7 @@ abstract class CommonObject
|
|||||||
public $last_main_doc;
|
public $last_main_doc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Bank account ID
|
* @var int Bank account ID sometimes, ID of record into llx_bank sometimes
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see $fk_account
|
* @see $fk_account
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -52,9 +52,11 @@ class Conf
|
|||||||
public $disable_compute;
|
public $disable_compute;
|
||||||
//! Used to store current currency (ISO code like 'USD', 'EUR', ...)
|
//! Used to store current currency (ISO code like 'USD', 'EUR', ...)
|
||||||
public $currency;
|
public $currency;
|
||||||
|
|
||||||
//! Used to store current css (from theme)
|
//! Used to store current css (from theme)
|
||||||
public $theme; // Contains current theme ("eldy", "auguria", ...)
|
public $theme; // Contains current theme ("eldy", "auguria", ...)
|
||||||
public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
|
public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
|
||||||
|
|
||||||
//! Used to store current menu handler
|
//! Used to store current menu handler
|
||||||
public $standard_menu;
|
public $standard_menu;
|
||||||
// List of activated modules
|
// List of activated modules
|
||||||
@ -98,6 +100,8 @@ class Conf
|
|||||||
public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
|
public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
|
||||||
public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url
|
public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url
|
||||||
|
|
||||||
|
public $liste_limit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
@ -991,32 +991,23 @@ class ExtraFields
|
|||||||
else return '';
|
else return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($morecss))
|
if (empty($morecss)) {
|
||||||
{
|
if ($type == 'date') {
|
||||||
if ($type == 'date')
|
|
||||||
{
|
|
||||||
$morecss = 'minwidth100imp';
|
$morecss = 'minwidth100imp';
|
||||||
} elseif ($type == 'datetime' || $type == 'link')
|
} elseif ($type == 'datetime' || $type == 'link') {
|
||||||
{
|
|
||||||
$morecss = 'minwidth200imp';
|
$morecss = 'minwidth200imp';
|
||||||
} elseif (in_array($type, array('int', 'integer', 'double', 'price')))
|
} elseif (in_array($type, array('int', 'integer', 'double', 'price'))) {
|
||||||
{
|
|
||||||
$morecss = 'maxwidth75';
|
$morecss = 'maxwidth75';
|
||||||
} elseif ($type == 'password')
|
} elseif ($type == 'password') {
|
||||||
{
|
|
||||||
$morecss = 'maxwidth100';
|
$morecss = 'maxwidth100';
|
||||||
} elseif ($type == 'url')
|
} elseif ($type == 'url') {
|
||||||
{
|
|
||||||
$morecss = 'minwidth400';
|
$morecss = 'minwidth400';
|
||||||
} elseif ($type == 'boolean')
|
} elseif ($type == 'boolean') {
|
||||||
{
|
|
||||||
$morecss = '';
|
$morecss = '';
|
||||||
} else {
|
} else {
|
||||||
if (round($size) < 12)
|
if (empty($size) || round($size) < 12) {
|
||||||
{
|
|
||||||
$morecss = 'minwidth100';
|
$morecss = 'minwidth100';
|
||||||
} elseif (round($size) <= 48)
|
} elseif (round($size) <= 48) {
|
||||||
{
|
|
||||||
$morecss = 'minwidth200';
|
$morecss = 'minwidth200';
|
||||||
} else {
|
} else {
|
||||||
$morecss = 'minwidth400';
|
$morecss = 'minwidth400';
|
||||||
@ -1024,8 +1015,7 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($type, array('date', 'datetime')))
|
if (in_array($type, array('date', 'datetime'))) {
|
||||||
{
|
|
||||||
$tmp = explode(',', $size);
|
$tmp = explode(',', $size);
|
||||||
$newsize = $tmp[0];
|
$newsize = $tmp[0];
|
||||||
|
|
||||||
|
|||||||
@ -3939,13 +3939,16 @@ class Form
|
|||||||
* @param string $moreattrib To add more attribute on select
|
* @param string $moreattrib To add more attribute on select
|
||||||
* @param int $showcurrency Show currency in label
|
* @param int $showcurrency Show currency in label
|
||||||
* @param string $morecss More CSS
|
* @param string $morecss More CSS
|
||||||
|
* @param int $nooutput 1=Return string, do not send to output
|
||||||
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
|
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
|
||||||
*/
|
*/
|
||||||
public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
|
public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '', $nooutput = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$num = 0;
|
$num = 0;
|
||||||
|
|
||||||
@ -3964,10 +3967,10 @@ class Form
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
print '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
||||||
if ($useempty == 1 || ($useempty == 2 && $num > 1))
|
if ($useempty == 1 || ($useempty == 2 && $num > 1))
|
||||||
{
|
{
|
||||||
print '<option value="-1"> </option>';
|
$out .= '<option value="-1"> </option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -3975,26 +3978,30 @@ class Form
|
|||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected)))
|
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected)))
|
||||||
{
|
{
|
||||||
print '<option value="'.$obj->rowid.'" selected>';
|
$out .= '<option value="'.$obj->rowid.'" selected>';
|
||||||
} else {
|
} else {
|
||||||
print '<option value="'.$obj->rowid.'">';
|
$out .= '<option value="'.$obj->rowid.'">';
|
||||||
}
|
}
|
||||||
print trim($obj->label);
|
$out .= trim($obj->label);
|
||||||
if ($showcurrency) print ' ('.$obj->currency_code.')';
|
if ($showcurrency) $out .= ' ('.$obj->currency_code.')';
|
||||||
if ($status == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
|
if ($status == 2 && $obj->status == 1) $out .= ' ('.$langs->trans("Closed").')';
|
||||||
print '</option>';
|
$out .= '</option>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print "</select>";
|
$out .= "</select>";
|
||||||
print ajax_combobox('select'.$htmlname);
|
$out .= ajax_combobox('select'.$htmlname);
|
||||||
} else {
|
} else {
|
||||||
if ($status == 0) print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
|
if ($status == 0) $out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
|
||||||
else print '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
|
else $out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Output or return
|
||||||
|
if (empty($nooutput)) print $out;
|
||||||
|
else return $out;
|
||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2647,7 +2647,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||||||
}
|
}
|
||||||
$original_file = $conf->accounting->dir_output.'/'.$original_file;
|
$original_file = $conf->accounting->dir_output.'/'.$original_file;
|
||||||
} // Wrapping pour les expedition
|
} // Wrapping pour les expedition
|
||||||
elseif ($modulepart == 'expedition' && !empty($conf->expedition->dir_output))
|
elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output))
|
||||||
{
|
{
|
||||||
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
|
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||||
{
|
{
|
||||||
@ -2655,7 +2655,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||||||
}
|
}
|
||||||
$original_file = $conf->expedition->dir_output."/sending/".$original_file;
|
$original_file = $conf->expedition->dir_output."/sending/".$original_file;
|
||||||
} // Delivery Note Wrapping
|
} // Delivery Note Wrapping
|
||||||
elseif ($modulepart == 'delivery' && !empty($conf->expedition->dir_output))
|
elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output))
|
||||||
{
|
{
|
||||||
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file))
|
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4877,7 +4877,7 @@ function price2num($amount, $rounding = '', $option = 0)
|
|||||||
elseif ($rounding == 'CR') $nbofdectoround = 8;
|
elseif ($rounding == 'CR') $nbofdectoround = 8;
|
||||||
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
|
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
|
||||||
//print "RR".$amount.' - '.$nbofdectoround.'<br>';
|
//print "RR".$amount.' - '.$nbofdectoround.'<br>';
|
||||||
if (dol_strlen($nbofdectoround)) $amount = round($amount, $nbofdectoround); // $nbofdectoround can be 0.
|
if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
|
||||||
else return 'ErrorBadParameterProvidedToFunction';
|
else return 'ErrorBadParameterProvidedToFunction';
|
||||||
//print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>';
|
//print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>';
|
||||||
|
|
||||||
|
|||||||
@ -294,12 +294,15 @@ class modStock extends DolibarrModules
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
|
|
||||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] = ' FROM ('.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'product_batch as pb)';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product_batch as pb';
|
||||||
|
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON ps.rowid = pb.fk_product_stock';
|
||||||
|
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = ps.fk_product';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,';
|
||||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'entrepot as e';
|
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'entrepot as e';
|
||||||
$this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid AND ps.rowid = pb.fk_product_stock';
|
$this->export_sql_end[$r] .= ' WHERE ps.fk_entrepot = e.rowid';
|
||||||
$this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; }
|
$this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')';
|
||||||
|
}
|
||||||
|
|
||||||
// Export of stock movements
|
// Export of stock movements
|
||||||
$r++;
|
$r++;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
|
|||||||
'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key],
|
'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key],
|
||||||
'checked' => (($extrafields->attributes[$extrafieldsobjectkey]['list'][$key] < 0) ? 0 : 1),
|
'checked' => (($extrafields->attributes[$extrafieldsobjectkey]['list'][$key] < 0) ? 0 : 1),
|
||||||
'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
|
'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
|
||||||
'enabled' => (abs($extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && $extrafields->attributes[$extrafieldsobjectkey]['perms'][$key]),
|
'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && $extrafields->attributes[$extrafieldsobjectkey]['perms'][$key]),
|
||||||
'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
|
'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
|
||||||
'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
|
'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -140,14 +140,7 @@ $arrayfields = array(
|
|||||||
'd.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'd.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
|
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||||
|
|
||||||
|
|||||||
@ -117,14 +117,8 @@ $arrayfields = array(
|
|||||||
'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
|
'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -168,14 +168,8 @@ $arrayfields = array(
|
|||||||
'cf.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>1)
|
'cf.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>1)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -115,6 +115,8 @@ $permissiondellink = $usercancreate; // Used by the include of actions_dellink.i
|
|||||||
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||||
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -183,8 +185,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) {
|
||||||
{
|
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
if (!$idwarehouse || $idwarehouse == -1)
|
if (!$idwarehouse || $idwarehouse == -1)
|
||||||
{
|
{
|
||||||
@ -194,11 +195,9 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$result = $object->validate($user, '', $idwarehouse);
|
$result = $object->validate($user, '', $idwarehouse);
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Define output language
|
// Define output language
|
||||||
@ -220,8 +219,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($action == 'confirm_delete' && $confirm == 'yes')
|
} elseif ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||||
{
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -280,15 +278,13 @@ if (empty($reshook))
|
|||||||
} elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercancreate) {
|
} elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercancreate) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->set_paid($user);
|
$result = $object->set_paid($user);
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set supplier ref
|
// Set supplier ref
|
||||||
if ($action == 'setref_supplier' && $usercancreate)
|
if ($action == 'setref_supplier' && $usercancreate) {
|
||||||
{
|
|
||||||
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
|
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
|
||||||
|
|
||||||
if ($object->update($user) < 0) {
|
if ($object->update($user) < 0) {
|
||||||
@ -315,8 +311,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// payments conditions
|
// payments conditions
|
||||||
if ($action == 'setconditions' && $usercancreate)
|
if ($action == 'setconditions' && $usercancreate) {
|
||||||
{
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->cond_reglement_code = 0; // To clean property
|
$object->cond_reglement_code = 0; // To clean property
|
||||||
$object->cond_reglement_id = 0; // To clean property
|
$object->cond_reglement_id = 0; // To clean property
|
||||||
@ -1680,20 +1675,17 @@ if ($action == 'create')
|
|||||||
$currency_code = $conf->currency;
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
$societe = '';
|
$societe = '';
|
||||||
if (GETPOST('socid') > 0)
|
if (GETPOST('socid') > 0) {
|
||||||
{
|
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch(GETPOST('socid', 'int'));
|
$societe->fetch(GETPOST('socid', 'int'));
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($origin) && !empty($originid))
|
if (!empty($origin) && !empty($originid)) {
|
||||||
{
|
|
||||||
// Parse element/subelement (ex: project_task)
|
// Parse element/subelement (ex: project_task)
|
||||||
$element = $subelement = $origin;
|
$element = $subelement = $origin;
|
||||||
|
|
||||||
if ($element == 'project')
|
if ($element == 'project') {
|
||||||
{
|
|
||||||
$projectid = $originid;
|
$projectid = $originid;
|
||||||
$element = 'projet';
|
$element = 'projet';
|
||||||
}
|
}
|
||||||
@ -2204,8 +2196,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
|
|
||||||
// Show origin lines
|
// Show origin lines
|
||||||
if (is_object($objectsrc))
|
if (is_object($objectsrc)) {
|
||||||
{
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
@ -2218,8 +2209,7 @@ if ($action == 'create')
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($id > 0 || !empty($ref))
|
if ($id > 0 || !empty($ref)) {
|
||||||
{
|
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Fiche en mode visu ou edition */
|
/* Fiche en mode visu ou edition */
|
||||||
@ -2275,7 +2265,7 @@ if ($action == 'create')
|
|||||||
$head = facturefourn_prepare_head($object);
|
$head = facturefourn_prepare_head($object);
|
||||||
$titre = $langs->trans('SupplierInvoice');
|
$titre = $langs->trans('SupplierInvoice');
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'card', $titre, -1, 'bill');
|
print dol_get_fiche_head($head, 'card', $titre, -1, 'supplier_invoice');
|
||||||
|
|
||||||
$formconfirm = '';
|
$formconfirm = '';
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
|
|
||||||
$head = facturefourn_prepare_head($object);
|
$head = facturefourn_prepare_head($object);
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'bill');
|
print dol_get_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'supplier_invoice');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,7 @@ llxHeader('', $title, $helpurl);
|
|||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$head = facturefourn_prepare_head($object);
|
$head = facturefourn_prepare_head($object);
|
||||||
print dol_get_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'bill');
|
print dol_get_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'supplier_invoice');
|
||||||
|
|
||||||
$totalpaye = $object->getSommePaiement();
|
$totalpaye = $object->getSommePaiement();
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ $maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->globa
|
|||||||
|
|
||||||
llxHeader("", $langs->trans("SupplierInvoicesArea"), 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
|
llxHeader("", $langs->trans("SupplierInvoicesArea"), 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'bill');
|
print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'supplier_invoice');
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ $alreadypaid = $object->getSommePaiement();
|
|||||||
|
|
||||||
$head = facturefourn_prepare_head($object);
|
$head = facturefourn_prepare_head($object);
|
||||||
$titre = $langs->trans('SupplierInvoice');
|
$titre = $langs->trans('SupplierInvoice');
|
||||||
print dol_get_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), -1, 'bill');
|
print dol_get_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), -1, 'supplier_invoice');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
|||||||
@ -189,14 +189,8 @@ $arrayfields = array(
|
|||||||
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
$head = facturefourn_prepare_head($object);
|
$head = facturefourn_prepare_head($object);
|
||||||
$titre = $langs->trans('SupplierInvoice');
|
$titre = $langs->trans('SupplierInvoice');
|
||||||
print dol_get_fiche_head($head, 'note', $titre, -1, 'bill');
|
print dol_get_fiche_head($head, 'note', $titre, -1, 'supplier_invoice');
|
||||||
|
|
||||||
|
|
||||||
// Supplier invoice card
|
// Supplier invoice card
|
||||||
|
|||||||
@ -143,14 +143,7 @@ $arrayfields = array(
|
|||||||
'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($conf->holiday->enabled))
|
if (empty($conf->holiday->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use Luracast\Restler\iCache;
|
|||||||
* @copyright 2013 Luracast
|
* @copyright 2013 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class ApcCache implements iCache
|
class ApcCache implements iCache
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace Luracast\Restler {
|
|||||||
* @subpackage helper
|
* @subpackage helper
|
||||||
* @author Nick Lombard <github@jigsoft.co.za>
|
* @author Nick Lombard <github@jigsoft.co.za>
|
||||||
* @copyright 2012 Luracast
|
* @copyright 2012 Luracast
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class AutoLoader
|
class AutoLoader
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Luracast\Restler;
|
namespace Luracast\Restler;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -14,7 +15,7 @@ use Luracast\Restler\Data\Text;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class CommentParser
|
class CommentParser
|
||||||
{
|
{
|
||||||
@ -320,19 +321,24 @@ class CommentParser
|
|||||||
$data['pattern'] = $matches[2];
|
$data['pattern'] = $matches[2];
|
||||||
}
|
}
|
||||||
while (preg_match('/{@(\w+)\s?([^}]*)}/ms', $subject, $matches)) {
|
while (preg_match('/{@(\w+)\s?([^}]*)}/ms', $subject, $matches)) {
|
||||||
|
$name = $matches[1];
|
||||||
|
$value = $matches[2];
|
||||||
$subject = str_replace($matches[0], '', $subject);
|
$subject = str_replace($matches[0], '', $subject);
|
||||||
if ($matches[1] == 'pattern') {
|
if ($name == 'pattern') {
|
||||||
throw new Exception('Inline pattern tag should follow {@pattern /REGEX_PATTERN_HERE/} format and can optionally include PCRE modifiers following the ending `/`');
|
throw new Exception('Inline pattern tag should follow {@pattern /REGEX_PATTERN_HERE/} format and can optionally include PCRE modifiers following the ending `/`');
|
||||||
} elseif (isset(static::$allowsArrayValue[$matches[1]])) {
|
} elseif (isset(static::$allowsArrayValue[$name])) {
|
||||||
$matches[2] = explode(static::$arrayDelimiter, $matches[2]);
|
$value = explode(static::$arrayDelimiter, $value);
|
||||||
} elseif ($matches[2] == 'true' || $matches[2] == 'false') {
|
} elseif ($value == 'true' || $value == 'false') {
|
||||||
$matches[2] = $matches[2] == 'true';
|
$value = $value == 'true';
|
||||||
} elseif ($matches[2] == '') {
|
} elseif ($value == '') {
|
||||||
$matches[2] = true;
|
$value = true;
|
||||||
} elseif ($matches[1] == 'required') {
|
} elseif ($name == 'required') {
|
||||||
$matches[2] = explode(static::$arrayDelimiter, $matches[2]);
|
$value = explode(static::$arrayDelimiter, $value);
|
||||||
}
|
}
|
||||||
$data[$matches[1]] = $matches[2];
|
if (defined('Luracast\\Restler\\UI\\HtmlForm::'.$name)) {
|
||||||
|
$value = constant($value);
|
||||||
|
}
|
||||||
|
$data[$name] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (preg_match(self::$embeddedDataPattern, $subject, $matches)) {
|
while (preg_match(self::$embeddedDataPattern, $subject, $matches)) {
|
||||||
@ -340,9 +346,9 @@ class CommentParser
|
|||||||
$str = $matches[self::$embeddedDataIndex];
|
$str = $matches[self::$embeddedDataIndex];
|
||||||
if (isset ($this->restler)
|
if (isset ($this->restler)
|
||||||
&& self::$embeddedDataIndex > 1
|
&& self::$embeddedDataIndex > 1
|
||||||
&& !empty ($matches[1])
|
&& !empty ($name)
|
||||||
) {
|
) {
|
||||||
$extension = $matches[1];
|
$extension = $name;
|
||||||
$formatMap = $this->restler->getFormatMap();
|
$formatMap = $this->restler->getFormatMap();
|
||||||
if (isset ($formatMap[$extension])) {
|
if (isset ($formatMap[$extension])) {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Compose implements iCompose
|
class Compose implements iCompose
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Data;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class ApiMethodInfo extends ValueObject
|
class ApiMethodInfo extends ValueObject
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace Luracast\Restler\Data;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Arr
|
class Arr
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use Exception;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Invalid extends Exception
|
class Invalid extends Exception
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Data;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Obj
|
class Obj
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace Luracast\Restler\Data;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Text
|
class Text
|
||||||
{
|
{
|
||||||
@ -60,6 +60,10 @@ class Text
|
|||||||
if ($length == 0) {
|
if ($length == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @CHANGE LDR
|
||||||
|
if (!is_string($haystack)) return false;
|
||||||
|
|
||||||
return (substr($haystack, -$length) === $needle);
|
return (substr($haystack, -$length) === $needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use Luracast\Restler\Util;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class ValidationInfo implements iValueObject
|
class ValidationInfo implements iValueObject
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,7 +18,7 @@ use Luracast\Restler\Util;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Validator implements iValidate
|
class Validator implements iValidate
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Data;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class ValueObject implements iValueObject
|
class ValueObject implements iValueObject
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace Luracast\Restler\Data;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iValidate {
|
interface iValidate {
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Data;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iValueObject
|
interface iValueObject
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use Luracast\Restler\Data\Validator;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Defaults
|
class Defaults
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
use Closure;
|
use Closure;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use Luracast\Restler\RestException;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class RateLimit implements iFilter, iUseAuthentication
|
class RateLimit implements iFilter, iUseAuthentication
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use ArrayAccess;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Flash implements ArrayAccess
|
class Flash implements ArrayAccess
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,7 +17,7 @@ use ZendAmf\Parser\OutputStream;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class AmfFormat extends DependentFormat
|
class AmfFormat extends DependentFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use Luracast\Restler\RestException;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class CsvFormat extends Format implements iDecodeStream
|
class CsvFormat extends Format implements iDecodeStream
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace Luracast\Restler\Format;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
abstract class Format implements iFormat
|
abstract class Format implements iFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Luracast\Restler\Format;
|
namespace Luracast\Restler\Format;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -6,8 +7,8 @@ use Illuminate\Events\Dispatcher;
|
|||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\View\Compilers\BladeCompiler;
|
use Illuminate\View\Compilers\BladeCompiler;
|
||||||
use Illuminate\View\Engines\CompilerEngine;
|
use Illuminate\View\Engines\CompilerEngine;
|
||||||
use Illuminate\View\Engines\PhpEngine;
|
|
||||||
use Illuminate\View\Engines\EngineResolver;
|
use Illuminate\View\Engines\EngineResolver;
|
||||||
|
use Illuminate\View\Engines\PhpEngine;
|
||||||
use Illuminate\View\Factory;
|
use Illuminate\View\Factory;
|
||||||
use Illuminate\View\FileViewFinder;
|
use Illuminate\View\FileViewFinder;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
@ -18,6 +19,10 @@ use Luracast\Restler\Restler;
|
|||||||
use Luracast\Restler\Scope;
|
use Luracast\Restler\Scope;
|
||||||
use Luracast\Restler\UI\Nav;
|
use Luracast\Restler\UI\Nav;
|
||||||
use Luracast\Restler\Util;
|
use Luracast\Restler\Util;
|
||||||
|
use Twig\Environment;
|
||||||
|
use Twig\Extension\DebugExtension;
|
||||||
|
use Twig\Loader\FilesystemLoader;
|
||||||
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Html template format
|
* Html template format
|
||||||
@ -29,10 +34,14 @@ use Luracast\Restler\Util;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class HtmlFormat extends DependentFormat
|
class HtmlFormat extends DependentFormat
|
||||||
{
|
{
|
||||||
|
const BLADE = 'Illuminate\View\View';
|
||||||
|
const TWIG = 'Twig\Environment';
|
||||||
|
const MUSTACHE = 'Mustache_Engine';
|
||||||
|
|
||||||
public static $mime = 'text/html';
|
public static $mime = 'text/html';
|
||||||
public static $extension = 'html';
|
public static $extension = 'html';
|
||||||
public static $view;
|
public static $view;
|
||||||
@ -84,11 +93,12 @@ class HtmlFormat extends DependentFormat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDependencyMap(){
|
public function getDependencyMap()
|
||||||
|
{
|
||||||
return array(
|
return array(
|
||||||
'Illuminate\View\View' => 'illuminate/view:4.2.*',
|
self::BLADE => 'illuminate/view:^8',
|
||||||
'Twig_Environment' => 'twig/twig:v1.13.*',
|
self::TWIG => 'twig/twig:^3',
|
||||||
'Mustache_Engine' => 'mustache/mustache:dev-master',
|
self::MUSTACHE => 'mustache/mustache:dev-master',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +111,7 @@ class HtmlFormat extends DependentFormat
|
|||||||
$resolver->register('blade', function () use ($engine) {
|
$resolver->register('blade', function () use ($engine) {
|
||||||
return $engine;
|
return $engine;
|
||||||
});
|
});
|
||||||
$phpEngine = new PhpEngine();
|
$phpEngine = new PhpEngine($files);
|
||||||
$resolver->register('php', function () use ($phpEngine) {
|
$resolver->register('php', function () use ($phpEngine) {
|
||||||
return $phpEngine;
|
return $phpEngine;
|
||||||
});
|
});
|
||||||
@ -128,32 +138,43 @@ class HtmlFormat extends DependentFormat
|
|||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function twig(array $data, $debug = true)
|
/**
|
||||||
|
* @param array|object $data
|
||||||
|
* @param bool $debug
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws \Twig\Error\LoaderError
|
||||||
|
* @throws \Twig\Error\RuntimeError
|
||||||
|
* @throws \Twig\Error\SyntaxError
|
||||||
|
*/
|
||||||
|
public static function twig($data, $debug = true)
|
||||||
{
|
{
|
||||||
$loader = new \Twig_Loader_Filesystem(static::$viewPath);
|
$loader = new FilesystemLoader(static::$viewPath);
|
||||||
$twig = new \Twig_Environment($loader, array(
|
$twig = new Environment($loader, array(
|
||||||
'cache' => static::$cacheDirectory,
|
'cache' => is_string(static::$cacheDirectory)
|
||||||
|
? static::$cacheDirectory : false,
|
||||||
'debug' => $debug,
|
'debug' => $debug,
|
||||||
'use_strict_variables' => $debug,
|
'use_strict_variables' => $debug,
|
||||||
));
|
));
|
||||||
if ($debug)
|
if ($debug) {
|
||||||
$twig->addExtension(new \Twig_Extension_Debug());
|
$twig->addExtension(new DebugExtension());
|
||||||
|
}
|
||||||
|
|
||||||
$twig->addFunction(
|
$twig->addFunction(
|
||||||
new \Twig_SimpleFunction(
|
new TwigFunction(
|
||||||
'form',
|
'form',
|
||||||
'Luracast\Restler\UI\Forms::get',
|
'Luracast\Restler\UI\Forms::get',
|
||||||
array('is_safe' => array('html'))
|
array('is_safe' => array('html'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$twig->addFunction(
|
$twig->addFunction(
|
||||||
new \Twig_SimpleFunction(
|
new TwigFunction(
|
||||||
'form_key',
|
'form_key',
|
||||||
'Luracast\Restler\UI\Forms::key'
|
'Luracast\Restler\UI\Forms::key'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$twig->addFunction(
|
$twig->addFunction(
|
||||||
new \Twig_SimpleFunction(
|
new TwigFunction(
|
||||||
'nav',
|
'nav',
|
||||||
'Luracast\Restler\UI\Nav::get'
|
'Luracast\Restler\UI\Nav::get'
|
||||||
)
|
)
|
||||||
@ -164,7 +185,7 @@ class HtmlFormat extends DependentFormat
|
|||||||
isset(HtmlFormat::$data[$name]) &&
|
isset(HtmlFormat::$data[$name]) &&
|
||||||
is_callable(HtmlFormat::$data[$name])
|
is_callable(HtmlFormat::$data[$name])
|
||||||
) {
|
) {
|
||||||
return new \Twig_SimpleFunction(
|
return new TwigFunction(
|
||||||
$name,
|
$name,
|
||||||
HtmlFormat::$data[$name]
|
HtmlFormat::$data[$name]
|
||||||
);
|
);
|
||||||
@ -172,19 +193,33 @@ class HtmlFormat extends DependentFormat
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$template = $twig->loadTemplate(static::getViewFile());
|
$template = $twig->load(static::getViewFile());
|
||||||
return $template->render($data);
|
return $template->render((array)$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function handlebar(array $data, $debug = true)
|
/**
|
||||||
|
* @param array|object $data
|
||||||
|
* @param bool $debug
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function handlebar($data, $debug = true)
|
||||||
{
|
{
|
||||||
return static::mustache($data, $debug);
|
return static::mustache($data, $debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function mustache(array $data, $debug = true)
|
/**
|
||||||
|
* @param array|object $data
|
||||||
|
* @param bool $debug
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function mustache($data, $debug = true)
|
||||||
{
|
{
|
||||||
if (!isset($data['nav']))
|
$data = (array)$data;
|
||||||
|
if (!isset($data['nav'])) {
|
||||||
$data['nav'] = array_values(Nav::get());
|
$data['nav'] = array_values(Nav::get());
|
||||||
|
}
|
||||||
$options = array(
|
$options = array(
|
||||||
'loader' => new \Mustache_Loader_FilesystemLoader(
|
'loader' => new \Mustache_Loader_FilesystemLoader(
|
||||||
static::$viewPath,
|
static::$viewPath,
|
||||||
@ -200,16 +235,25 @@ class HtmlFormat extends DependentFormat
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (!$debug)
|
if (!$debug) {
|
||||||
$options['cache'] = static::$cacheDirectory;
|
$options['cache'] = static::$cacheDirectory;
|
||||||
|
}
|
||||||
$m = new \Mustache_Engine($options);
|
$m = new \Mustache_Engine($options);
|
||||||
return $m->render(static::getViewFile(), $data);
|
return $m->render(static::getViewFile(), $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function php(array $data, $debug = true)
|
/**
|
||||||
|
* @param array|object $data
|
||||||
|
* @param bool $debug
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
public static function php($data, $debug = true)
|
||||||
{
|
{
|
||||||
if (static::$view == 'debug')
|
if (static::$view == 'debug') {
|
||||||
static::$viewPath = dirname(__DIR__) . '/views';
|
static::$viewPath = dirname(__DIR__) . '/views';
|
||||||
|
}
|
||||||
$view = static::getViewFile(true);
|
$view = static::getViewFile(true);
|
||||||
|
|
||||||
if (!is_readable($view)) {
|
if (!is_readable($view)) {
|
||||||
@ -222,22 +266,26 @@ class HtmlFormat extends DependentFormat
|
|||||||
|
|
||||||
$path = static::$viewPath . DIRECTORY_SEPARATOR;
|
$path = static::$viewPath . DIRECTORY_SEPARATOR;
|
||||||
$template = function ($view) use ($data, $path) {
|
$template = function ($view) use ($data, $path) {
|
||||||
|
$data = (array)$data;
|
||||||
$form = function () {
|
$form = function () {
|
||||||
return call_user_func_array(
|
return call_user_func_array(
|
||||||
'Luracast\Restler\UI\Forms::get',
|
'Luracast\Restler\UI\Forms::get',
|
||||||
func_get_args()
|
func_get_args()
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
if (!isset($data['form']))
|
if (!isset($data['form'])) {
|
||||||
$data['form'] = $form;
|
$data['form'] = $form;
|
||||||
|
}
|
||||||
$nav = function () {
|
$nav = function () {
|
||||||
return call_user_func_array(
|
return call_user_func_array(
|
||||||
'Luracast\Restler\UI\Nav::get',
|
'Luracast\Restler\UI\Nav::get',
|
||||||
func_get_args()
|
func_get_args()
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
if (!isset($data['nav']))
|
if (!isset($data['nav'])) {
|
||||||
$data['nav'] = $nav;
|
$data['nav'] = $nav;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$_ = function () use ($data, $path) {
|
$_ = function () use ($data, $path) {
|
||||||
extract($data);
|
extract($data);
|
||||||
@ -254,7 +302,7 @@ class HtmlFormat extends DependentFormat
|
|||||||
) {
|
) {
|
||||||
$str = '';
|
$str = '';
|
||||||
foreach ($arrays as $arr) {
|
foreach ($arrays as $arr) {
|
||||||
extract($arr);
|
extract((array)$arr);
|
||||||
$str .= include $file;
|
$str .= include $file;
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
@ -264,25 +312,29 @@ class HtmlFormat extends DependentFormat
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'if':
|
case 'if':
|
||||||
if (count($args) < 2)
|
if (count($args) < 2) {
|
||||||
$args[1] = '';
|
$args[1] = '';
|
||||||
if (count($args) < 3)
|
}
|
||||||
|
if (count($args) < 3) {
|
||||||
$args[2] = '';
|
$args[2] = '';
|
||||||
|
}
|
||||||
return $args[0] ? $args[1] : $args[2];
|
return $args[0] ? $args[1] : $args[2];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (isset($data[$task]) && is_callable($data[$task]))
|
if (isset($data[$task]) && is_callable($data[$task])) {
|
||||||
return call_user_func_array($data[$task], $args);
|
return call_user_func_array($data[$task], $args);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
extract($data);
|
extract($data);
|
||||||
return @include $view;
|
return @include $view;
|
||||||
};
|
};
|
||||||
$value = $template($view);
|
$value = $template($view);
|
||||||
if (is_string($value))
|
if (is_string($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode the given data in the format
|
* Encode the given data in the format
|
||||||
@ -294,8 +346,8 @@ class HtmlFormat extends DependentFormat
|
|||||||
* Formatter has to make the encoded
|
* Formatter has to make the encoded
|
||||||
* output more human readable
|
* output more human readable
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
|
||||||
* @return string encoded string
|
* @return string encoded string
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function encode($data, $humanReadable = false)
|
public function encode($data, $humanReadable = false)
|
||||||
{
|
{
|
||||||
@ -358,7 +410,9 @@ class HtmlFormat extends DependentFormat
|
|||||||
if ($value) {
|
if ($value) {
|
||||||
$data = Util::nestedValue($data, explode('.', $value));
|
$data = Util::nestedValue($data, explode('.', $value));
|
||||||
}
|
}
|
||||||
|
if (is_array($data)) {
|
||||||
$data += static::$data;
|
$data += static::$data;
|
||||||
|
}
|
||||||
if (false === ($i = strrpos(self::$view, '.'))) {
|
if (false === ($i = strrpos(self::$view, '.'))) {
|
||||||
$template = self::$template;
|
$template = self::$template;
|
||||||
} else {
|
} else {
|
||||||
@ -369,17 +423,18 @@ class HtmlFormat extends DependentFormat
|
|||||||
static::$cacheDirectory = Defaults::$cacheDirectory . DIRECTORY_SEPARATOR . $template;
|
static::$cacheDirectory = Defaults::$cacheDirectory . DIRECTORY_SEPARATOR . $template;
|
||||||
if (!file_exists(static::$cacheDirectory)) {
|
if (!file_exists(static::$cacheDirectory)) {
|
||||||
if (!mkdir(static::$cacheDirectory, 0770, true)) {
|
if (!mkdir(static::$cacheDirectory, 0770, true)) {
|
||||||
throw new RestException(500, 'Unable to create cache directory `' . static::$cacheDirectory . '`');
|
throw new RestException(500,
|
||||||
|
'Unable to create cache directory `' . static::$cacheDirectory . '`');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (method_exists($class = get_called_class(), $template)) {
|
if (method_exists($class = get_called_class(), $template)) {
|
||||||
if ($template == 'blade') {
|
if ($template == 'blade') {
|
||||||
$this->checkDependency('Illuminate\View\View');
|
$this->checkDependency(self::BLADE);
|
||||||
} elseif ($template == 'twig') {
|
} elseif ($template == 'twig') {
|
||||||
$this->checkDependency('Twig_Environment');
|
$this->checkDependency(self::TWIG);
|
||||||
} elseif ($template == 'mustache' || $template == 'handlebar') {
|
} elseif ($template == 'mustache' || $template == 'handlebar') {
|
||||||
$this->checkDependency('Mustache_Engine');
|
$this->checkDependency(self::MUSTACHE);
|
||||||
}
|
}
|
||||||
return call_user_func("$class::$template", $data, $humanReadable);
|
return call_user_func("$class::$template", $data, $humanReadable);
|
||||||
}
|
}
|
||||||
@ -416,8 +471,9 @@ class HtmlFormat extends DependentFormat
|
|||||||
{
|
{
|
||||||
$v = $fullPath ? static::$viewPath . '/' : '';
|
$v = $fullPath ? static::$viewPath . '/' : '';
|
||||||
$v .= static::$view;
|
$v .= static::$view;
|
||||||
if ($includeExtension)
|
if ($includeExtension) {
|
||||||
$v .= '.' . static::getViewExtension();
|
$v .= '.' . static::getViewExtension();
|
||||||
|
}
|
||||||
return $v;
|
return $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Format;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class JsFormat extends JsonFormat
|
class JsFormat extends JsonFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use Luracast\Restler\RestException;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class JsonFormat extends Format
|
class JsonFormat extends Format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace Luracast\Restler\Format;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
abstract class MultiFormat implements iFormat
|
abstract class MultiFormat implements iFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,7 +18,7 @@ use CFPropertyList\CFPropertyList;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class PlistFormat extends DependentMultiFormat
|
class PlistFormat extends DependentMultiFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Format;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class TsvFormat extends CsvFormat
|
class TsvFormat extends CsvFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use Luracast\Restler\RestException;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class UploadFormat extends Format
|
class UploadFormat extends Format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Format;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class UrlEncodedFormat extends Format
|
class UrlEncodedFormat extends Format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,7 +16,7 @@ use XMLWriter;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class XmlFormat extends Format
|
class XmlFormat extends Format
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use Luracast\Restler\Data\Obj;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class YamlFormat extends DependentFormat
|
class YamlFormat extends DependentFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Format;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iDecodeStream
|
interface iDecodeStream
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler\Format;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iFormat
|
interface iFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class HumanReadableCache implements iCache
|
class HumanReadableCache implements iCache
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class PassThrough
|
class PassThrough
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use Luracast\Restler\Format\JsonFormat;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Redirect
|
class Redirect
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use stdClass;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Resources implements iUseAuthentication, iProvideMultiVersionApi
|
class Resources implements iUseAuthentication, iProvideMultiVersionApi
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use Exception;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class RestException extends Exception
|
class RestException extends Exception
|
||||||
|
|||||||
@ -15,13 +15,14 @@ use Luracast\Restler\Format\UrlEncodedFormat;
|
|||||||
* inspired by the RestServer code from
|
* inspired by the RestServer code from
|
||||||
* <http://jacwright.com/blog/resources/RestServer.txt>
|
* <http://jacwright.com/blog/resources/RestServer.txt>
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @category Framework
|
* @category Framework
|
||||||
* @package Restler
|
* @package Restler
|
||||||
* @author R.Arul Kumaran <arul@luracast.com>
|
* @author R.Arul Kumaran <arul@luracast.com>
|
||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*
|
*
|
||||||
* @method static void onGet() onGet(Callable $function) fired before reading the request details
|
* @method static void onGet() onGet(Callable $function) fired before reading the request details
|
||||||
* @method static void onRoute() onRoute(Callable $function) fired before finding the api method
|
* @method static void onRoute() onRoute(Callable $function) fired before finding the api method
|
||||||
@ -48,10 +49,13 @@ use Luracast\Restler\Format\UrlEncodedFormat;
|
|||||||
* @method void onRespond() onRespond(Callable $function) fired before sending response
|
* @method void onRespond() onRespond(Callable $function) fired before sending response
|
||||||
* @method void onComplete() onComplete(Callable $function) fired after sending response
|
* @method void onComplete() onComplete(Callable $function) fired after sending response
|
||||||
* @method void onMessage() onMessage(Callable $function) fired before composing error response
|
* @method void onMessage() onMessage(Callable $function) fired before composing error response
|
||||||
|
*
|
||||||
|
* @property bool|null _authenticated
|
||||||
|
* @property bool _authVerified
|
||||||
*/
|
*/
|
||||||
class Restler extends EventDispatcher
|
class Restler extends EventDispatcher
|
||||||
{
|
{
|
||||||
const VERSION = '3.0.0rc6';
|
const VERSION = '3.1.0';
|
||||||
|
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
//
|
//
|
||||||
@ -693,6 +697,8 @@ class Restler extends EventDispatcher
|
|||||||
* - media type
|
* - media type
|
||||||
* - charset
|
* - charset
|
||||||
* - language
|
* - language
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
protected function negotiate()
|
protected function negotiate()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,7 +17,7 @@ use Exception;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Routes
|
class Routes
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace Luracast\Restler;
|
namespace Luracast\Restler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,7 +13,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Scope
|
class Scope
|
||||||
{
|
{
|
||||||
@ -120,6 +122,7 @@ class Scope
|
|||||||
$r = new $fullName();
|
$r = new $fullName();
|
||||||
static::$instances[$name] = (object)array('instance' => $r);
|
static::$instances[$name] = (object)array('instance' => $r);
|
||||||
if ($name != 'Restler') {
|
if ($name != 'Restler') {
|
||||||
|
/** @var Restler restler */
|
||||||
$r->restler = static::get('Restler');
|
$r->restler = static::get('Restler');
|
||||||
$m = Util::nestedValue($r->restler, 'apiMethodInfo', 'metadata');
|
$m = Util::nestedValue($r->restler, 'apiMethodInfo', 'metadata');
|
||||||
if ($m) {
|
if ($m) {
|
||||||
@ -138,15 +141,14 @@ class Scope
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
$r instanceof iUseAuthentication &&
|
$r instanceof iUseAuthentication &&
|
||||||
static::get('Restler')->_authVerified &&
|
$r->restler && $r->restler->_authVerified &&
|
||||||
!isset(static::$instances[$name]->authVerified)
|
!isset(static::$instances[$name]->authVerified)
|
||||||
) {
|
) {
|
||||||
static::$instances[$name]->authVerified = true;
|
static::$instances[$name]->authVerified = true;
|
||||||
$r->__setAuthenticationStatus
|
$r->__setAuthenticationStatus($r->restler->_authenticated);
|
||||||
(static::get('Restler')->_authenticated);
|
|
||||||
}
|
}
|
||||||
if (isset(static::$instances[$name]->initPending)) {
|
if (isset(static::$instances[$name]->initPending)) {
|
||||||
$m = Util::nestedValue(static::get('Restler'), 'apiMethodInfo', 'metadata');
|
$m = Util::nestedValue($r->restler, 'apiMethodInfo', 'metadata');
|
||||||
$fullName = $name;
|
$fullName = $name;
|
||||||
if (class_exists($name)) {
|
if (class_exists($name)) {
|
||||||
$shortName = Util::getShortName($name);
|
$shortName = Util::getShortName($name);
|
||||||
@ -194,15 +196,15 @@ class Scope
|
|||||||
*/
|
*/
|
||||||
public static function resolve($className, array $scope)
|
public static function resolve($className, array $scope)
|
||||||
{
|
{
|
||||||
if (empty($className) || !is_string($className))
|
if (empty($className) || !is_string($className)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (self::isPrimitiveDataType($className)) {
|
if (self::isPrimitiveDataType($className)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$divider = '\\';
|
$divider = '\\';
|
||||||
$qualified = false;
|
|
||||||
if ($className[0] == $divider) {
|
if ($className[0] == $divider) {
|
||||||
$qualified = trim($className, $divider);
|
$qualified = trim($className, $divider);
|
||||||
} elseif (array_key_exists($className, $scope)) {
|
} elseif (array_key_exists($className, $scope)) {
|
||||||
@ -210,18 +212,21 @@ class Scope
|
|||||||
} else {
|
} else {
|
||||||
$qualified = $scope['*'] . $className;
|
$qualified = $scope['*'] . $className;
|
||||||
}
|
}
|
||||||
if (class_exists($qualified))
|
if (class_exists($qualified)) {
|
||||||
return $qualified;
|
return $qualified;
|
||||||
|
}
|
||||||
if (isset(static::$classAliases[$className])) {
|
if (isset(static::$classAliases[$className])) {
|
||||||
$qualified = static::$classAliases[$className];
|
$qualified = static::$classAliases[$className];
|
||||||
if (class_exists($qualified))
|
if (class_exists($qualified)) {
|
||||||
return $qualified;
|
return $qualified;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $stringName
|
* @param string $stringName
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private static function isPrimitiveDataType($stringName)
|
private static function isPrimitiveDataType($stringName)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use Luracast\Restler\Util;
|
|||||||
* Class Emmet
|
* Class Emmet
|
||||||
* @package Luracast\Restler\UI
|
* @package Luracast\Restler\UI
|
||||||
*
|
*
|
||||||
* @version 3.0.0rc6
|
* @version 3.1.0
|
||||||
*/
|
*/
|
||||||
class Emmet
|
class Emmet
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Luracast\Restler\UI;
|
namespace Luracast\Restler\UI;
|
||||||
|
|
||||||
use Luracast\Restler\CommentParser;
|
use Luracast\Restler\CommentParser;
|
||||||
@ -29,7 +30,7 @@ use Luracast\Restler\Util;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Forms implements iFilter
|
class Forms implements iFilter
|
||||||
{
|
{
|
||||||
@ -38,7 +39,7 @@ class Forms implements iFilter
|
|||||||
|
|
||||||
public static $excludedPaths = array();
|
public static $excludedPaths = array();
|
||||||
|
|
||||||
public static $style;
|
private static $style;
|
||||||
/**
|
/**
|
||||||
* @var bool should we fill up the form using given data?
|
* @var bool should we fill up the form using given data?
|
||||||
*/
|
*/
|
||||||
@ -81,6 +82,11 @@ class Forms implements iFilter
|
|||||||
*/
|
*/
|
||||||
private static $info;
|
private static $info;
|
||||||
|
|
||||||
|
public static function setStyles(HtmlForm $style)
|
||||||
|
{
|
||||||
|
static::$style = get_class($style);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the form
|
* Get the form
|
||||||
*
|
*
|
||||||
@ -95,18 +101,20 @@ class Forms implements iFilter
|
|||||||
*
|
*
|
||||||
* @return array|T
|
* @return array|T
|
||||||
*
|
*
|
||||||
* @throws \Luracast\Restler\RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public static function get($method = 'POST', $action = null, $dataOnly = false, $prefix = '', $indent = ' ')
|
public static function get($method = 'POST', $action = null, $dataOnly = false, $prefix = '', $indent = ' ')
|
||||||
{
|
{
|
||||||
if (!static::$style)
|
if (!static::$style) {
|
||||||
static::$style = FormStyles::$html;
|
static::$style = 'Luracast\\Restler\\UI\HtmlForm';
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/** @var Restler $restler */
|
/** @var Restler $restler */
|
||||||
$restler = Scope::get('Restler');
|
$restler = Scope::get('Restler');
|
||||||
if (is_null($action))
|
if (is_null($action)) {
|
||||||
$action = $restler->url;
|
$action = $restler->url;
|
||||||
|
}
|
||||||
|
|
||||||
$info = $restler->url == $action
|
$info = $restler->url == $action
|
||||||
&& Util::getRequestMethod() == $method
|
&& Util::getRequestMethod() == $method
|
||||||
@ -126,18 +134,20 @@ class Forms implements iFilter
|
|||||||
//echo $e->getErrorMessage();
|
//echo $e->getErrorMessage();
|
||||||
$info = false;
|
$info = false;
|
||||||
}
|
}
|
||||||
if (!$info)
|
if (!$info) {
|
||||||
throw new RestException(500, 'invalid action path for form `' . $method . ' ' . $action . '`');
|
throw new RestException(500, 'invalid action path for form `' . $method . ' ' . $action . '`');
|
||||||
|
}
|
||||||
static::$info = $info;
|
static::$info = $info;
|
||||||
$m = $info->metadata;
|
$m = $info->metadata;
|
||||||
$r = static::fields($dataOnly);
|
$r = static::fields($dataOnly);
|
||||||
if ($method != 'GET' && $method != 'POST') {
|
if ($method != 'GET' && $method != 'POST') {
|
||||||
if (empty(Defaults::$httpMethodOverrideProperty))
|
if (empty(Defaults::$httpMethodOverrideProperty)) {
|
||||||
throw new RestException(
|
throw new RestException(
|
||||||
500,
|
500,
|
||||||
'Forms require `Defaults::\$httpMethodOverrideProperty`' .
|
'Forms require `Defaults::\$httpMethodOverrideProperty`' .
|
||||||
"for supporting HTTP $method"
|
"for supporting HTTP $method"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
if ($dataOnly) {
|
if ($dataOnly) {
|
||||||
$r[] = array(
|
$r[] = array(
|
||||||
'tag' => 'input',
|
'tag' => 'input',
|
||||||
@ -180,8 +190,9 @@ class Forms implements iFilter
|
|||||||
?: 'Submit'
|
?: 'Submit'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$dataOnly)
|
if (!$dataOnly) {
|
||||||
$s = Emmet::make(static::style('submit', $m), $s);
|
$s = Emmet::make(static::style('submit', $m), $s);
|
||||||
|
}
|
||||||
$r[] = $s;
|
$r[] = $s;
|
||||||
$t = array(
|
$t = array(
|
||||||
'action' => $restler->getBaseUrl() . '/' . rtrim($action, '/'),
|
'action' => $restler->getBaseUrl() . '/' . rtrim($action, '/'),
|
||||||
@ -207,15 +218,18 @@ class Forms implements iFilter
|
|||||||
|
|
||||||
public static function style($name, array $metadata, $type = '')
|
public static function style($name, array $metadata, $type = '')
|
||||||
{
|
{
|
||||||
return isset($metadata[CommentParser::$embeddedDataName][$name])
|
if (isset($metadata[CommentParser::$embeddedDataName][$name])) {
|
||||||
? $metadata[CommentParser::$embeddedDataName][$name]
|
return $metadata[CommentParser::$embeddedDataName][$name];
|
||||||
: (!empty($type) && isset(static::$style["$name-$type"])
|
}
|
||||||
? static::$style["$name-$type"]
|
$style = static::$style . '::' . $name;
|
||||||
: (isset(static::$style[$name])
|
$typedStyle = $style . '_' . $type;
|
||||||
? static::$style[$name]
|
if (defined($typedStyle)) {
|
||||||
: null
|
return constant($typedStyle);
|
||||||
)
|
}
|
||||||
);
|
if (defined($style)) {
|
||||||
|
return constant($style);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fields($dataOnly = false)
|
public static function fields($dataOnly = false)
|
||||||
@ -230,11 +244,13 @@ class Forms implements iFilter
|
|||||||
is_scalar($value) ||
|
is_scalar($value) ||
|
||||||
($p['type'] == 'array' && is_array($value) && $value == array_values($value)) ||
|
($p['type'] == 'array' && is_array($value) && $value == array_values($value)) ||
|
||||||
is_object($value) && $p['type'] == get_class($value)
|
is_object($value) && $p['type'] == get_class($value)
|
||||||
)
|
) {
|
||||||
$p['value'] = $value;
|
$p['value'] = $value;
|
||||||
|
}
|
||||||
static::$validationInfo = $v = new ValidationInfo($p);
|
static::$validationInfo = $v = new ValidationInfo($p);
|
||||||
if ($v->from == 'path')
|
if ($v->from == 'path') {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (!empty($v->children)) {
|
if (!empty($v->children)) {
|
||||||
$t = Emmet::make(static::style('fieldset', $m), array('label' => $v->label));
|
$t = Emmet::make(static::style('fieldset', $m), array('label' => $v->label));
|
||||||
foreach ($v->children as $n => $c) {
|
foreach ($v->children as $n => $c) {
|
||||||
@ -243,11 +259,13 @@ class Forms implements iFilter
|
|||||||
is_scalar($value) ||
|
is_scalar($value) ||
|
||||||
($c['type'] == 'array' && is_array($value) && $value == array_values($value)) ||
|
($c['type'] == 'array' && is_array($value) && $value == array_values($value)) ||
|
||||||
is_object($value) && $c['type'] == get_class($value)
|
is_object($value) && $c['type'] == get_class($value)
|
||||||
)
|
) {
|
||||||
$c['value'] = $value;
|
$c['value'] = $value;
|
||||||
|
}
|
||||||
static::$validationInfo = $vc = new ValidationInfo($c);
|
static::$validationInfo = $vc = new ValidationInfo($c);
|
||||||
if ($vc->from == 'path')
|
if ($vc->from == 'path') {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
$vc->name = $v->name . '[' . $vc->name . ']';
|
$vc->name = $v->name . '[' . $vc->name . ']';
|
||||||
$t [] = static::field($vc, $dataOnly);
|
$t [] = static::field($vc, $dataOnly);
|
||||||
}
|
}
|
||||||
@ -291,18 +309,26 @@ class Forms implements iFilter
|
|||||||
$option['text'] = isset($p->rules['select'][$i])
|
$option['text'] = isset($p->rules['select'][$i])
|
||||||
? $p->rules['select'][$i]
|
? $p->rules['select'][$i]
|
||||||
: $choice;
|
: $choice;
|
||||||
if ($choice == $p->value)
|
if ($choice == $p->value) {
|
||||||
$option['selected'] = true;
|
$option['selected'] = true;
|
||||||
|
}
|
||||||
$options[] = $option;
|
$options[] = $option;
|
||||||
}
|
}
|
||||||
} elseif ($p->type == 'boolean' || $p->type == 'bool') {
|
} elseif ($p->type == 'boolean' || $p->type == 'bool') {
|
||||||
if (Text::beginsWith($type, 'radio') || Text::beginsWith($type, 'select')) {
|
if (Text::beginsWith($type, 'radio') || Text::beginsWith($type, 'select')) {
|
||||||
$options[] = array('name' => $p->name, 'text' => ' Yes ',
|
$options[] = array(
|
||||||
'value' => 'true');
|
'name' => $p->name,
|
||||||
$options[] = array('name' => $p->name, 'text' => ' No ',
|
'text' => ' Yes ',
|
||||||
'value' => 'false');
|
'value' => 'true'
|
||||||
if ($p->value || $p->default)
|
);
|
||||||
|
$options[] = array(
|
||||||
|
'name' => $p->name,
|
||||||
|
'text' => ' No ',
|
||||||
|
'value' => 'false'
|
||||||
|
);
|
||||||
|
if ($p->value || $p->default) {
|
||||||
$options[0]['selected'] = true;
|
$options[0]['selected'] = true;
|
||||||
|
}
|
||||||
} else { //checkbox
|
} else { //checkbox
|
||||||
$r = array(
|
$r = array(
|
||||||
'tag' => $tag,
|
'tag' => $tag,
|
||||||
@ -347,19 +373,23 @@ class Forms implements iFilter
|
|||||||
$r['message'] = Validator::$exceptions[$p->name]->getMessage();
|
$r['message'] = Validator::$exceptions[$p->name]->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true === $p->required)
|
if (true === $p->required) {
|
||||||
$r['required'] = 'required';
|
$r['required'] = 'required';
|
||||||
if (isset($p->rules['autofocus']))
|
}
|
||||||
|
if (isset($p->rules['autofocus'])) {
|
||||||
$r['autofocus'] = 'autofocus';
|
$r['autofocus'] = 'autofocus';
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
echo "<pre>";
|
echo "<pre>";
|
||||||
print_r($r);
|
print_r($r);
|
||||||
echo "</pre>";
|
echo "</pre>";
|
||||||
*/
|
*/
|
||||||
if ($dataOnly)
|
if ($dataOnly) {
|
||||||
return $r;
|
return $r;
|
||||||
if (isset($p->rules['form']))
|
}
|
||||||
|
if (isset($p->rules['form'])) {
|
||||||
return Emmet::make($p->rules['form'], $r);
|
return Emmet::make($p->rules['form'], $r);
|
||||||
|
}
|
||||||
$m = static::$info->metadata;
|
$m = static::$info->metadata;
|
||||||
$t = Emmet::make(static::style($type, $m, $p->type) ?: static::style($tag, $m, $p->type), $r);
|
$t = Emmet::make(static::style($type, $m, $p->type) ?: static::style($tag, $m, $p->type), $r);
|
||||||
return $t;
|
return $t;
|
||||||
@ -367,10 +397,12 @@ class Forms implements iFilter
|
|||||||
|
|
||||||
protected static function guessFieldType(ValidationInfo $p, $type = 'type')
|
protected static function guessFieldType(ValidationInfo $p, $type = 'type')
|
||||||
{
|
{
|
||||||
if (in_array($p->$type, static::$inputTypes))
|
if (in_array($p->$type, static::$inputTypes)) {
|
||||||
return $p->$type;
|
return $p->$type;
|
||||||
if ($p->choice)
|
}
|
||||||
|
if ($p->choice) {
|
||||||
return $p->type == 'array' ? 'checkbox' : 'select';
|
return $p->type == 'array' ? 'checkbox' : 'select';
|
||||||
|
}
|
||||||
switch ($p->$type) {
|
switch ($p->$type) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
return 'radio';
|
return 'radio';
|
||||||
@ -381,8 +413,9 @@ class Forms implements iFilter
|
|||||||
case 'array':
|
case 'array':
|
||||||
return static::guessFieldType($p, 'contentType');
|
return static::guessFieldType($p, 'contentType');
|
||||||
}
|
}
|
||||||
if ($p->name == 'password')
|
if ($p->name == 'password') {
|
||||||
return 'password';
|
return 'password';
|
||||||
|
}
|
||||||
return 'text';
|
return 'text';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,11 +430,13 @@ class Forms implements iFilter
|
|||||||
*/
|
*/
|
||||||
public static function key($method = 'POST', $action = null)
|
public static function key($method = 'POST', $action = null)
|
||||||
{
|
{
|
||||||
if (is_null($action))
|
if (is_null($action)) {
|
||||||
$action = Scope::get('Restler')->url;
|
$action = Scope::get('Restler')->url;
|
||||||
|
}
|
||||||
$target = "$method $action";
|
$target = "$method $action";
|
||||||
if (empty(static::$key[$target]))
|
if (empty(static::$key[$target])) {
|
||||||
static::$key[$target] = md5($target . User::getIpAddress() . uniqid(mt_rand()));
|
static::$key[$target] = md5($target . User::getIpAddress() . uniqid(mt_rand()));
|
||||||
|
}
|
||||||
$_SESSION[static::FORM_KEY] = static::$key;
|
$_SESSION[static::FORM_KEY] = static::$key;
|
||||||
return static::$key[$target];
|
return static::$key[$target];
|
||||||
}
|
}
|
||||||
@ -425,8 +460,9 @@ class Forms implements iFilter
|
|||||||
$url = $restler->url;
|
$url = $restler->url;
|
||||||
foreach (static::$excludedPaths as $exclude) {
|
foreach (static::$excludedPaths as $exclude) {
|
||||||
if (empty($exclude)) {
|
if (empty($exclude)) {
|
||||||
if ($url == $exclude)
|
if ($url == $exclude) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
} elseif (Text::beginsWith($url, $exclude)) {
|
} elseif (Text::beginsWith($url, $exclude)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ use Luracast\Restler\Util;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Nav
|
class Nav
|
||||||
{
|
{
|
||||||
@ -130,7 +130,8 @@ class Nav
|
|||||||
} else {
|
} else {
|
||||||
return $tree;
|
return $tree;
|
||||||
}
|
}
|
||||||
return null;
|
$value = null;
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addUrls(array $urls)
|
public static function addUrls(array $urls)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use Luracast\Restler\Util;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*
|
*
|
||||||
* ============================ magic properties ==============================
|
* ============================ magic properties ==============================
|
||||||
* @property Tags parent parent tag
|
* @property Tags parent parent tag
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class User implements iIdentifyUser
|
class User implements iIdentifyUser
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Luracast\Restler;
|
namespace Luracast\Restler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describe the purpose of this class/interface/trait
|
* Describe the purpose of this class/interface/trait
|
||||||
*
|
*
|
||||||
@ -9,7 +11,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
class Util
|
class Util
|
||||||
{
|
{
|
||||||
@ -50,7 +52,7 @@ class Util
|
|||||||
* When the deeply nested property is found its value is returned, otherwise
|
* When the deeply nested property is found its value is returned, otherwise
|
||||||
* false is returned.
|
* false is returned.
|
||||||
*
|
*
|
||||||
* @param array $from array to extract the value from
|
* @param array|object $from array to extract the value from
|
||||||
* @param string|array $key ... pass more to go deeply inside the array
|
* @param string|array $key ... pass more to go deeply inside the array
|
||||||
* alternatively you can pass a single array
|
* alternatively you can pass a single array
|
||||||
*
|
*
|
||||||
@ -77,24 +79,29 @@ class Util
|
|||||||
return $from;
|
return $from;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getResourcePath($className,
|
public static function getResourcePath(
|
||||||
|
$className,
|
||||||
$resourcePath = null,
|
$resourcePath = null,
|
||||||
$prefix = '')
|
$prefix = ''
|
||||||
{
|
) {
|
||||||
if (is_null($resourcePath)) {
|
if (is_null($resourcePath)) {
|
||||||
if (Defaults::$autoRoutingEnabled) {
|
if (Defaults::$autoRoutingEnabled) {
|
||||||
$resourcePath = strtolower($className);
|
$resourcePath = strtolower($className);
|
||||||
if (false !== ($index = strrpos($className, '\\')))
|
if (false !== ($index = strrpos($className, '\\'))) {
|
||||||
$resourcePath = substr($resourcePath, $index + 1);
|
$resourcePath = substr($resourcePath, $index + 1);
|
||||||
if (false !== ($index = strrpos($resourcePath, '_')))
|
}
|
||||||
|
if (false !== ($index = strrpos($resourcePath, '_'))) {
|
||||||
$resourcePath = substr($resourcePath, $index + 1);
|
$resourcePath = substr($resourcePath, $index + 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$resourcePath = '';
|
$resourcePath = '';
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
$resourcePath = trim($resourcePath, '/');
|
$resourcePath = trim($resourcePath, '/');
|
||||||
if (strlen($resourcePath) > 0)
|
}
|
||||||
|
if (strlen($resourcePath) > 0) {
|
||||||
$resourcePath .= '/';
|
$resourcePath .= '/';
|
||||||
|
}
|
||||||
return $prefix . $resourcePath;
|
return $prefix . $resourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,8 +121,9 @@ class Util
|
|||||||
*/
|
*/
|
||||||
public static function removeCommonPath($fromPath, $usingPath, $char = '/')
|
public static function removeCommonPath($fromPath, $usingPath, $char = '/')
|
||||||
{
|
{
|
||||||
if (empty($fromPath))
|
if (empty($fromPath)) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
$fromPath = explode($char, $fromPath);
|
$fromPath = explode($char, $fromPath);
|
||||||
$usingPath = explode($char, $usingPath);
|
$usingPath = explode($char, $usingPath);
|
||||||
while (count($usingPath)) {
|
while (count($usingPath)) {
|
||||||
@ -145,8 +153,9 @@ class Util
|
|||||||
*/
|
*/
|
||||||
public static function splitCommonPath($fromPath, $usingPath, $char = '/')
|
public static function splitCommonPath($fromPath, $usingPath, $char = '/')
|
||||||
{
|
{
|
||||||
if (empty($fromPath))
|
if (empty($fromPath)) {
|
||||||
return array('', '');
|
return array('', '');
|
||||||
|
}
|
||||||
$fromPath = explode($char, $fromPath);
|
$fromPath = explode($char, $fromPath);
|
||||||
$usingPath = explode($char, $usingPath);
|
$usingPath = explode($char, $usingPath);
|
||||||
$commonPath = array();
|
$commonPath = array();
|
||||||
@ -213,11 +222,18 @@ class Util
|
|||||||
$accepts = array($accepts);
|
$accepts = array($accepts);
|
||||||
}
|
}
|
||||||
foreach ($accepts as $pos => $accept) {
|
foreach ($accepts as $pos => $accept) {
|
||||||
$parts = explode(';q=', trim($accept));
|
$parts = explode(';', $accept);
|
||||||
$type = array_shift($parts);
|
$type = trim(array_shift($parts));
|
||||||
$quality = count($parts) ?
|
$parameters = [];
|
||||||
floatval(array_shift($parts)) :
|
foreach ($parts as $part) {
|
||||||
(1000 - $pos) / 1000;
|
$part = explode('=', $part);
|
||||||
|
if (2 !== count($part)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$key = strtolower(trim($part[0]));
|
||||||
|
$parameters[$key] = trim($part[1], ' "');
|
||||||
|
}
|
||||||
|
$quality = isset($parameters['q']) ? (float)$parameters['q'] : (1000 - $pos) / 1000;
|
||||||
$acceptList[$type] = $quality;
|
$acceptList[$type] = $quality;
|
||||||
}
|
}
|
||||||
arsort($acceptList);
|
arsort($acceptList);
|
||||||
@ -227,8 +243,7 @@ class Util
|
|||||||
public static function getShortName($className)
|
public static function getShortName($className)
|
||||||
{
|
{
|
||||||
// @CHANGE LDR
|
// @CHANGE LDR
|
||||||
if (! is_string($className)) return '';
|
if (!is_string($className)) return;
|
||||||
//var_dump($className);
|
|
||||||
|
|
||||||
$className = explode('\\', $className);
|
$className = explode('\\', $className);
|
||||||
return end($className);
|
return end($className);
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iAuthenticate extends iFilter
|
interface iAuthenticate extends iFilter
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iCache
|
interface iCache
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use Exception;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iCompose {
|
interface iCompose {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iFilter
|
interface iFilter
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iIdentifyUser
|
interface iIdentifyUser
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@ namespace Luracast\Restler;
|
|||||||
* Interface iProvideMultiVersionApi
|
* Interface iProvideMultiVersionApi
|
||||||
* @package Luracast\Restler
|
* @package Luracast\Restler
|
||||||
*
|
*
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iProvideMultiVersionApi
|
interface iProvideMultiVersionApi
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Luracast\Restler;
|
|||||||
* @copyright 2010 Luracast
|
* @copyright 2010 Luracast
|
||||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @link http://luracast.com/products/restler/
|
* @link http://luracast.com/products/restler/
|
||||||
* @version 3.0.0rc6
|
*
|
||||||
*/
|
*/
|
||||||
interface iUseAuthentication
|
interface iUseAuthentication
|
||||||
{
|
{
|
||||||
|
|||||||
@ -132,7 +132,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
|||||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -140,7 +140,7 @@ ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fisc
|
|||||||
ExportDataset_tax_1=Social and fiscal taxes and payments
|
ExportDataset_tax_1=Social and fiscal taxes and payments
|
||||||
CalcModeVATDebt=Mode <b>%sVAT on commitment accounting%s</b>.
|
CalcModeVATDebt=Mode <b>%sVAT on commitment accounting%s</b>.
|
||||||
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.
|
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.
|
||||||
CalcModeDebt=Analysis of known recorded invoices even if they are not yet accounted in ledger.
|
CalcModeDebt=Analysis of known recorded documents even if they are not yet accounted in ledger.
|
||||||
CalcModeEngagement=Analysis of known recorded payments, even if they are not yet accounted in Ledger.
|
CalcModeEngagement=Analysis of known recorded payments, even if they are not yet accounted in Ledger.
|
||||||
CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table.
|
CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table.
|
||||||
CalcModeLT1= Mode <b>%sRE on customer invoices - suppliers invoices%s</b>
|
CalcModeLT1= Mode <b>%sRE on customer invoices - suppliers invoices%s</b>
|
||||||
@ -154,9 +154,9 @@ AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary
|
|||||||
AnnualByCompanies=Balance of income and expenses, by predefined groups of account
|
AnnualByCompanies=Balance of income and expenses, by predefined groups of account
|
||||||
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
|
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
|
||||||
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
|
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
|
||||||
SeeReportInInputOutputMode=See %sanalysis of payments%s for a calculation on actual payments made even if they are not yet accounted in Ledger.
|
SeeReportInInputOutputMode=See <b>%sanalysis of payments%s</b> for a calculation based on <b>recorded payments</b> made even if they are not yet accounted in Ledger
|
||||||
SeeReportInDueDebtMode=See %sanalysis of invoices%s for a calculation based on known recorded invoices even if they are not yet accounted in Ledger.
|
SeeReportInDueDebtMode=See <b>%sanalysis of recorded documents%s</b> for a calculation based on known <b>recorded documents</b> even if they are not yet accounted in Ledger
|
||||||
SeeReportInBookkeepingMode=See <b>%sBookeeping report%s</b> for a calculation on <b>Bookkeeping Ledger table</b>
|
SeeReportInBookkeepingMode=See <b>%sanalysis of bookeeping ledger table%s</b> for a report based on <b>Bookkeeping Ledger table</b>
|
||||||
RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included
|
RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included
|
||||||
RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.<br>- It is based on the billing date of invoices and on the due date for expenses or tax payments. For salaries defined with Salary module, the value date of payment is used.
|
RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.<br>- It is based on the billing date of invoices and on the due date for expenses or tax payments. For salaries defined with Salary module, the value date of payment is used.
|
||||||
RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries. <br>- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation.
|
RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries. <br>- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation.
|
||||||
|
|||||||
@ -2802,7 +2802,7 @@ if (!function_exists("llxFooter"))
|
|||||||
|
|
||||||
if (!empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
|
if (!empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
|
||||||
if (!empty($page) && $page > 0) $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page;
|
if (!empty($page) && $page > 0) $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page;
|
||||||
if (!empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit;
|
if (!empty($limit) && $limit != $conf->liste_limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit;
|
||||||
|
|
||||||
unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
|
unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
|
||||||
unset($_SESSION['lastsearch_page_'.$relativepathstring]);
|
unset($_SESSION['lastsearch_page_'.$relativepathstring]);
|
||||||
|
|||||||
@ -129,7 +129,7 @@ $arrayfields = array();
|
|||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
// If $val['visible']==0, then we never show the field
|
// If $val['visible']==0, then we never show the field
|
||||||
if (!empty($val['visible'])) {
|
if (!empty($val['visible'])) {
|
||||||
$visible = dol_eval($val['visible'], 1);
|
$visible = (int) dol_eval($val['visible'], 1);
|
||||||
$arrayfields['t.'.$key] = array(
|
$arrayfields['t.'.$key] = array(
|
||||||
'label'=>$val['label'],
|
'label'=>$val['label'],
|
||||||
'checked'=>(($visible < 0) ? 0 : 1),
|
'checked'=>(($visible < 0) ? 0 : 1),
|
||||||
|
|||||||
@ -261,6 +261,9 @@ $parameters = array();
|
|||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
$rightskey = 'produit';
|
||||||
|
if ($type == Product::TYPE_SERVICE) $rightskey = 'service';
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
@ -299,8 +302,8 @@ if (empty($reshook))
|
|||||||
if ((string) $search_type == '1') { $objectlabel = 'Services'; }
|
if ((string) $search_type == '1') { $objectlabel = 'Services'; }
|
||||||
if ((string) $search_type == '0') { $objectlabel = 'Products'; }
|
if ((string) $search_type == '0') { $objectlabel = 'Products'; }
|
||||||
|
|
||||||
$permissiontoread = $user->rights->produit->lire;
|
$permissiontoread = $user->rights->{$rightskey}->lire;
|
||||||
$permissiontodelete = $user->rights->produit->supprimer;
|
$permissiontodelete = $user->rights->{$rightskey}->supprimer;
|
||||||
$permissiontoadd = $user->rights->{$rightskey}->creer;
|
$permissiontoadd = $user->rights->{$rightskey}->creer;
|
||||||
$uploaddir = $conf->product->dir_output;
|
$uploaddir = $conf->product->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
@ -531,8 +534,6 @@ if ($resql)
|
|||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
);
|
);
|
||||||
$rightskey = 'produit';
|
|
||||||
if ($type == Product::TYPE_SERVICE) $rightskey = 'service';
|
|
||||||
if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
|
if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
|
||||||
if ($user->rights->{$rightskey}->creer) $arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
|
if ($user->rights->{$rightskey}->creer) $arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
|
||||||
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||||
|
|||||||
@ -129,7 +129,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
|||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
$arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
$arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|||||||
@ -143,7 +143,7 @@ if (is_array($extrafields->attributes['projet_task']['label']) && count($extrafi
|
|||||||
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val)
|
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (!empty($extrafields->attributes['projet_task']['list'][$key]))
|
if (!empty($extrafields->attributes['projet_task']['list'][$key]))
|
||||||
$arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key]));
|
$arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|||||||
@ -119,14 +119,8 @@ if ($object->usage_bill_time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$taskstatic->table_element]['label']) && count($extrafields->attributes[$taskstatic->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$taskstatic->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$taskstatic->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$taskstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$taskstatic->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$taskstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$taskstatic->table_element]['list'][$key]) != 3 && $extrafields->attributes[$taskstatic->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||||
|
|||||||
@ -136,14 +136,8 @@ $arrayfields = array(
|
|||||||
//'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
//'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|||||||
@ -869,14 +869,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
$arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled) ? 0 : 1));
|
$arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled) ? 0 : 1));
|
||||||
$arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((!empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT)) ? 0 : 1) && $projectstatic->usage_bill_time));
|
$arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((!empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT)) ? 0 : 1) && $projectstatic->usage_bill_time));
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user