forked from Wavyzz/dolibarr
Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: dev/skeletons/build_class_from_table.php dev/skeletons/skeleton_card.php htdocs/compta/facture/class/facture.class.php htdocs/core/lib/functions.lib.php htdocs/filefunc.inc.php htdocs/projet/card.php
This commit is contained in:
20
ChangeLog
20
ChangeLog
@@ -22,6 +22,26 @@ Following changes may create regression for some external modules, but were nece
|
|||||||
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
|
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
|
||||||
exists, but if an external module need action on it, it must provides itself its trigger file.
|
exists, but if an external module need action on it, it must provides itself its trigger file.
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.3 compared to 5.0.2 *****
|
||||||
|
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
||||||
|
FIX: #6813
|
||||||
|
FIX: 6863
|
||||||
|
FIX: #6877
|
||||||
|
FIX: #6881
|
||||||
|
FIX: Better sanitizing of search all parameter.
|
||||||
|
FIX: Correction with author and validator user on orders
|
||||||
|
FIX: dialog window with md theme must not be hidden by left menu part.
|
||||||
|
FIX: doactions hook missing in invoice model page
|
||||||
|
FIX: Fullname when member is a moral entity with no name.
|
||||||
|
FIX: Link to files on bank account tab broken with multicompany FIX: Link to preview on thirdparty broken with multicompany
|
||||||
|
FIX: New vat code not correctly implemented if "1 price per customer".
|
||||||
|
FIX: Pagination of invoices
|
||||||
|
FIX: pagination on resources
|
||||||
|
FIX: REST API not possible to add agendaevents
|
||||||
|
FIX: situation invoice broken due to the all percent application form inside addline form
|
||||||
|
FIX: SQL injection on user/index.php parameter search_statut.
|
||||||
|
FIX: XSS
|
||||||
|
|
||||||
***** ChangeLog for 5.0.2 compared to 5.0.1 *****
|
***** ChangeLog for 5.0.2 compared to 5.0.1 *****
|
||||||
FIX: #6468 + Fix missing translation
|
FIX: #6468 + Fix missing translation
|
||||||
FIX: #6517 #6525 Autocompletion of thirdparty after n chars not implemented
|
FIX: #6517 #6525 Autocompletion of thirdparty after n chars not implemented
|
||||||
|
|||||||
@@ -4,7 +4,12 @@ dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/*
|
|||||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/*
|
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/*
|
||||||
# Those are false positives, the files are their own sources since
|
# Those are false positives, the files are their own sources since
|
||||||
# they are not minified
|
# they are not minified
|
||||||
source-is-missing htdocs/includes/jsgantt/jsgantt.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/a11yhelp/dialogs/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/colorpicker/jquery.colorpicker.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/specialchar/dialogs/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2_locale_ar.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/dialogs/*.js
|
||||||
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/filter/*.js
|
||||||
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/templates/templates/default.js
|
||||||
|
source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json
|
||||||
|
source-is-missing htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/*.js
|
||||||
|
|
||||||
|
|||||||
@@ -1208,7 +1208,7 @@ if ($id > 0)
|
|||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class Facture extends CommonInvoice
|
|||||||
public $fk_element = 'fk_facture';
|
public $fk_element = 'fk_facture';
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
public $picto='bill';
|
public $picto='bill';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -243,7 +243,7 @@ class Facture extends CommonInvoice
|
|||||||
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
if (empty($this->entity)) $this->entity = $conf->entity;
|
if (empty($this->entity)) $this->entity = $conf->entity;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
@@ -280,7 +280,7 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->fac_rec > 0)
|
if ($this->fac_rec > 0)
|
||||||
{
|
{
|
||||||
$this->fk_fac_rec_source = $this->fac_rec;
|
$this->fk_fac_rec_source = $this->fac_rec;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
||||||
$_facrec = new FactureRec($this->db);
|
$_facrec = new FactureRec($this->db);
|
||||||
$result=$_facrec->fetch($this->fac_rec);
|
$result=$_facrec->fetch($this->fac_rec);
|
||||||
@@ -288,7 +288,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
|
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
|
||||||
$this->entity = $_facrec->entity; // Invoice created in same entity than template
|
$this->entity = $_facrec->entity; // Invoice created in same entity than template
|
||||||
|
|
||||||
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
|
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
|
||||||
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
|
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
|
||||||
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
|
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
|
||||||
@@ -301,7 +301,7 @@ class Facture extends CommonInvoice
|
|||||||
// Set here to have this defined for substitution into notes, should be recalculated after adding lines to get same result
|
// Set here to have this defined for substitution into notes, should be recalculated after adding lines to get same result
|
||||||
$this->total_ht = $_facrec->total_ht;
|
$this->total_ht = $_facrec->total_ht;
|
||||||
$this->total_ttc = $_facrec->total_ttc;
|
$this->total_ttc = $_facrec->total_ttc;
|
||||||
|
|
||||||
// Fields always coming from template
|
// Fields always coming from template
|
||||||
$this->remise_absolue = $_facrec->remise_absolue;
|
$this->remise_absolue = $_facrec->remise_absolue;
|
||||||
$this->remise_percent = $_facrec->remise_percent;
|
$this->remise_percent = $_facrec->remise_percent;
|
||||||
@@ -360,9 +360,10 @@ class Facture extends CommonInvoice
|
|||||||
'__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'),
|
'__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'),
|
||||||
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
|
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$substitutionisok=true;
|
||||||
complete_substitutions_array($substitutionarray, $outputlangs);
|
complete_substitutions_array($substitutionarray, $outputlangs);
|
||||||
|
|
||||||
$this->note_public=make_substitutions($this->note_public,$substitutionarray);
|
$this->note_public=make_substitutions($this->note_public,$substitutionarray);
|
||||||
$this->note_private=make_substitutions($this->note_private,$substitutionarray);
|
$this->note_private=make_substitutions($this->note_private,$substitutionarray);
|
||||||
}
|
}
|
||||||
@@ -472,7 +473,7 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
||||||
{
|
{
|
||||||
$originforcontact = $this->origin;
|
$originforcontact = $this->origin;
|
||||||
@@ -483,7 +484,7 @@ class Facture extends CommonInvoice
|
|||||||
$exp = new Expedition($this->db);
|
$exp = new Expedition($this->db);
|
||||||
$exp->fetch($this->origin_id);
|
$exp->fetch($this->origin_id);
|
||||||
$exp->fetchObjectLinked();
|
$exp->fetchObjectLinked();
|
||||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||||
{
|
{
|
||||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||||
{
|
{
|
||||||
@@ -493,10 +494,10 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||||
|
|
||||||
$resqlcontact = $this->db->query($sqlcontact);
|
$resqlcontact = $this->db->query($sqlcontact);
|
||||||
if ($resqlcontact)
|
if ($resqlcontact)
|
||||||
{
|
{
|
||||||
@@ -555,11 +556,11 @@ class Facture extends CommonInvoice
|
|||||||
foreach ($this->lines as $i => $val)
|
foreach ($this->lines as $i => $val)
|
||||||
{
|
{
|
||||||
$line = $this->lines[$i];
|
$line = $this->lines[$i];
|
||||||
|
|
||||||
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
|
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
|
||||||
//if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object.
|
//if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object.
|
||||||
if (! is_object($line)) $line = (object) $line;
|
if (! is_object($line)) $line = (object) $line;
|
||||||
|
|
||||||
if (($line->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
|
if (($line->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
|
||||||
{
|
{
|
||||||
// Reset fk_parent_line for no child products and special product
|
// Reset fk_parent_line for no child products and special product
|
||||||
@@ -1060,7 +1061,7 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
|
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
|
||||||
if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice
|
if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice
|
||||||
$label='';
|
$label='';
|
||||||
|
|
||||||
if ($user->rights->facture->lire) {
|
if ($user->rights->facture->lire) {
|
||||||
$label = '<u>' . $langs->trans("ShowInvoice") . '</u>';
|
$label = '<u>' . $langs->trans("ShowInvoice") . '</u>';
|
||||||
if (! empty($this->ref))
|
if (! empty($this->ref))
|
||||||
@@ -1079,7 +1080,7 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
|
if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
|
||||||
if ($moretitle) $label.=' - '.$moretitle;
|
if ($moretitle) $label.=' - '.$moretitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip) && $user->rights->facture->lire)
|
if (empty($notooltip) && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
@@ -1113,7 +1114,7 @@ class Facture extends CommonInvoice
|
|||||||
$result.='</span>';
|
$result.='</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1321,7 +1322,7 @@ class Facture extends CommonInvoice
|
|||||||
$line->qty = $objp->qty;
|
$line->qty = $objp->qty;
|
||||||
$line->subprice = $objp->subprice;
|
$line->subprice = $objp->subprice;
|
||||||
|
|
||||||
$line->vat_src_code = $objp->vat_src_code;
|
$line->vat_src_code = $objp->vat_src_code;
|
||||||
$line->tva_tx = $objp->tva_tx;
|
$line->tva_tx = $objp->tva_tx;
|
||||||
$line->localtax1_tx = $objp->localtax1_tx;
|
$line->localtax1_tx = $objp->localtax1_tx;
|
||||||
$line->localtax2_tx = $objp->localtax2_tx;
|
$line->localtax2_tx = $objp->localtax2_tx;
|
||||||
@@ -1574,7 +1575,7 @@ class Facture extends CommonInvoice
|
|||||||
$arraytmp=$formmargin->getMarginInfosArray($srcinvoice, false);
|
$arraytmp=$formmargin->getMarginInfosArray($srcinvoice, false);
|
||||||
$facligne->pa_ht = $arraytmp['pa_total'];
|
$facligne->pa_ht = $arraytmp['pa_total'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$facligne->total_ht = -$remise->amount_ht;
|
$facligne->total_ht = -$remise->amount_ht;
|
||||||
$facligne->total_tva = -$remise->amount_tva;
|
$facligne->total_tva = -$remise->amount_tva;
|
||||||
$facligne->total_ttc = -$remise->amount_ttc;
|
$facligne->total_ttc = -$remise->amount_ttc;
|
||||||
@@ -1628,7 +1629,7 @@ class Facture extends CommonInvoice
|
|||||||
function set_ref_client($ref_client, $notrigger=0)
|
function set_ref_client($ref_client, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@@ -2457,7 +2458,7 @@ class Facture extends CommonInvoice
|
|||||||
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
|
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
|
||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||||
|
|
||||||
// Clean vat code
|
// Clean vat code
|
||||||
$vat_src_code='';
|
$vat_src_code='';
|
||||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||||
@@ -2465,7 +2466,7 @@ class Facture extends CommonInvoice
|
|||||||
$vat_src_code = $reg[1];
|
$vat_src_code = $reg[1];
|
||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||||
}
|
}
|
||||||
|
|
||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent=price2num($remise_percent);
|
||||||
$qty=price2num($qty);
|
$qty=price2num($qty);
|
||||||
$pu_ht=price2num($pu_ht);
|
$pu_ht=price2num($pu_ht);
|
||||||
@@ -2650,7 +2651,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param double $pu_ht_devise Unit price in currency
|
* @param double $pu_ht_devise Unit price in currency
|
||||||
* @return int < 0 if KO, > 0 if OK
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null, $pu_ht_devise = 0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null, $pu_ht_devise = 0)
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
// Deprecation warning
|
// Deprecation warning
|
||||||
@@ -2770,14 +2771,14 @@ class Facture extends CommonInvoice
|
|||||||
$this->line->label = $label;
|
$this->line->label = $label;
|
||||||
$this->line->desc = $desc;
|
$this->line->desc = $desc;
|
||||||
$this->line->qty = ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
$this->line->qty = ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||||
|
|
||||||
$this->line->vat_src_code = $vat_src_code;
|
$this->line->vat_src_code = $vat_src_code;
|
||||||
$this->line->tva_tx = $txtva;
|
$this->line->tva_tx = $txtva;
|
||||||
$this->line->localtax1_tx = $txlocaltax1;
|
$this->line->localtax1_tx = $txlocaltax1;
|
||||||
$this->line->localtax2_tx = $txlocaltax2;
|
$this->line->localtax2_tx = $txlocaltax2;
|
||||||
$this->line->localtax1_type = $localtaxes_type[0];
|
$this->line->localtax1_type = $localtaxes_type[0];
|
||||||
$this->line->localtax2_type = $localtaxes_type[2];
|
$this->line->localtax2_type = $localtaxes_type[2];
|
||||||
|
|
||||||
$this->line->remise_percent = $remise_percent;
|
$this->line->remise_percent = $remise_percent;
|
||||||
$this->line->subprice = ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
$this->line->subprice = ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||||
$this->line->date_start = $date_start;
|
$this->line->date_start = $date_start;
|
||||||
@@ -2896,7 +2897,7 @@ class Facture extends CommonInvoice
|
|||||||
function deleteline($rowid)
|
function deleteline($rowid)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
|
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
|
||||||
|
|
||||||
if (! $this->brouillon)
|
if (! $this->brouillon)
|
||||||
@@ -2922,13 +2923,13 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
$line=new FactureLigne($this->db);
|
$line=new FactureLigne($this->db);
|
||||||
|
|
||||||
$line->context = $this->context;
|
$line->context = $this->context;
|
||||||
|
|
||||||
// For triggers
|
// For triggers
|
||||||
$result = $line->fetch($rowid);
|
$result = $line->fetch($rowid);
|
||||||
if (! ($result > 0)) dol_print_error($db, $line->error, $line->errors);
|
if (! ($result > 0)) dol_print_error($db, $line->error, $line->errors);
|
||||||
|
|
||||||
if ($line->delete($user) > 0)
|
if ($line->delete($user) > 0)
|
||||||
{
|
{
|
||||||
$result=$this->update_price(1);
|
$result=$this->update_price(1);
|
||||||
@@ -4292,7 +4293,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$this->fk_unit = $objp->fk_unit;
|
$this->fk_unit = $objp->fk_unit;
|
||||||
$this->fk_user_modif = $objp->fk_user_modif;
|
$this->fk_user_modif = $objp->fk_user_modif;
|
||||||
$this->fk_user_author = $objp->fk_user_author;
|
$this->fk_user_author = $objp->fk_user_author;
|
||||||
|
|
||||||
$this->situation_percent = $objp->situation_percent;
|
$this->situation_percent = $objp->situation_percent;
|
||||||
$this->fk_prev_id = $objp->fk_prev_id;
|
$this->fk_prev_id = $objp->fk_prev_id;
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ class BonPrelevement extends CommonObject
|
|||||||
function getErrorString($error)
|
function getErrorString($error)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
$errors[1027] = $langs->trans("DateInvalid");
|
$errors[1027] = $langs->trans("DateInvalid");
|
||||||
@@ -813,7 +813,7 @@ class BonPrelevement extends CommonObject
|
|||||||
dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR);
|
dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||||
@@ -834,7 +834,7 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
$bac = new CompanyBankAccount($this->db);
|
$bac = new CompanyBankAccount($this->db);
|
||||||
$bac->fetch(0,$soc->id);
|
$bac->fetch(0,$soc->id);
|
||||||
|
|
||||||
if ($bac->verif() >= 1)
|
if ($bac->verif() >= 1)
|
||||||
//if (true)
|
//if (true)
|
||||||
{
|
{
|
||||||
@@ -867,7 +867,7 @@ class BonPrelevement extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ok=0;
|
$ok=0;
|
||||||
|
|
||||||
// Withdraw invoices in factures_prev array
|
// Withdraw invoices in factures_prev array
|
||||||
$out=count($factures_prev)." invoices will be withdrawn.";
|
$out=count($factures_prev)." invoices will be withdrawn.";
|
||||||
//print $out."\n";
|
//print $out."\n";
|
||||||
@@ -920,7 +920,7 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
$dir=$conf->prelevement->dir_output.'/receipts';
|
$dir=$conf->prelevement->dir_output.'/receipts';
|
||||||
if (! is_dir($dir)) dol_mkdir($dir);
|
if (! is_dir($dir)) dol_mkdir($dir);
|
||||||
|
|
||||||
$this->filename = $dir.'/'.$ref.'.xml';
|
$this->filename = $dir.'/'.$ref.'.xml';
|
||||||
|
|
||||||
// Create withdraw receipt in database
|
// Create withdraw receipt in database
|
||||||
@@ -1028,7 +1028,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->emetteur_bic = $account->bic;
|
$this->emetteur_bic = $account->bic;
|
||||||
|
|
||||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||||
|
|
||||||
$this->raison_sociale = $account->proprio;
|
$this->raison_sociale = $account->proprio;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1272,16 +1272,6 @@ class BonPrelevement extends CommonObject
|
|||||||
* section Debiteur (sepa Debiteurs bloc lines)
|
* section Debiteur (sepa Debiteurs bloc lines)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*$tmp_invoices = array();
|
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
if ($resql) {
|
|
||||||
while ($objfac = $this->db->fetch_object($resql)) {
|
|
||||||
$tmp_invoices[] = $objfac->fac;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||||
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||||
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
||||||
@@ -1365,35 +1355,6 @@ class BonPrelevement extends CommonObject
|
|||||||
fputs($this->file, ' </PmtInf>'.$CrLf);
|
fputs($this->file, ' </PmtInf>'.$CrLf);
|
||||||
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
|
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
|
||||||
fputs($this->file, '</Document>'.$CrLf);
|
fputs($this->file, '</Document>'.$CrLf);
|
||||||
|
|
||||||
/*$sql = "SELECT pl.amount";
|
|
||||||
$sql.= " FROM";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
|
||||||
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
|
||||||
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
|
|
||||||
$sql.= " AND pf.fk_facture = f.rowid";
|
|
||||||
|
|
||||||
//Lines
|
|
||||||
$i = 0;
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$this->total = $this->total + $obj->amount;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result = -2;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build file for Other Countries with unknow format
|
// Build file for Other Countries with unknow format
|
||||||
@@ -1580,11 +1541,11 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
|
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
|
||||||
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
|
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
|
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
|
$XML_DEBITOR .=' <Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))).'</AdrLine>'.$CrLf;
|
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))),70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
|
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_string_unaccent($row_zip.' '.$row_town)).'</AdrLine>'.$CrLf;
|
||||||
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
||||||
@@ -1679,7 +1640,7 @@ class BonPrelevement extends CommonObject
|
|||||||
* @return string String with SEPA Sender
|
* @return string String with SEPA Sender
|
||||||
*/
|
*/
|
||||||
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
|
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
|
||||||
{
|
{
|
||||||
// SEPA INITIALISATION
|
// SEPA INITIALISATION
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@@ -1698,12 +1659,12 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->emetteur_number_key = $account->cle_rib;
|
$this->emetteur_number_key = $account->cle_rib;
|
||||||
$this->emetteur_iban = $account->iban;
|
$this->emetteur_iban = $account->iban;
|
||||||
$this->emetteur_bic = $account->bic;
|
$this->emetteur_bic = $account->bic;
|
||||||
|
|
||||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||||
|
|
||||||
$this->raison_sociale = $account->proprio;
|
$this->raison_sociale = $account->proprio;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Récupération info demandeur
|
// Récupération info demandeur
|
||||||
$sql = "SELECT rowid, ref";
|
$sql = "SELECT rowid, ref";
|
||||||
$sql.= " FROM";
|
$sql.= " FROM";
|
||||||
|
|||||||
@@ -2749,6 +2749,8 @@ class ContratLigne extends CommonObjectLine
|
|||||||
if (empty($this->total_ht)) $this->total_ht = 0;
|
if (empty($this->total_ht)) $this->total_ht = 0;
|
||||||
if (empty($this->total_tva)) $this->total_tva = 0;
|
if (empty($this->total_tva)) $this->total_tva = 0;
|
||||||
if (empty($this->total_ttc)) $this->total_ttc = 0;
|
if (empty($this->total_ttc)) $this->total_ttc = 0;
|
||||||
|
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
|
||||||
|
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|||||||
@@ -1588,7 +1588,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
|||||||
if (preg_match('/__b__/i',$format))
|
if (preg_match('/__b__/i',$format))
|
||||||
{
|
{
|
||||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||||
$month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Remove this
|
$month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||||
|
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||||
if ($encodetooutput)
|
if ($encodetooutput)
|
||||||
{
|
{
|
||||||
$monthtext=$outputlangs->transnoentities('Month'.$month);
|
$monthtext=$outputlangs->transnoentities('Month'.$month);
|
||||||
@@ -2795,7 +2796,7 @@ function img_printer($titlealt = "default", $other='')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show delete logo
|
* Show split logo
|
||||||
*
|
*
|
||||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||||
* @param string $other Add more attributes on img
|
* @param string $other Add more attributes on img
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
|
|||||||
* This function is also called by restrictedArea
|
* This function is also called by restrictedArea
|
||||||
*
|
*
|
||||||
* @param User $user User to check
|
* @param User $user User to check
|
||||||
* @param array $featuresarray Features/modules to check. Example: ('user','service')
|
* @param array $featuresarray Features/modules to check. Example: ('user','service','member','project','task',...)
|
||||||
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
||||||
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional).
|
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional).
|
||||||
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
|
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
|
||||||
@@ -369,11 +369,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
|||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
if ($feature == 'member') $feature='adherent';
|
if ($feature == 'member') $feature='adherent';
|
||||||
|
if ($feature == 'project') $feature='projet';
|
||||||
|
if ($feature == 'task') $feature='projet_task';
|
||||||
|
|
||||||
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
||||||
$checksoc = array('societe'); // Test for societe object
|
$checksoc = array('societe'); // Test for societe object
|
||||||
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
|
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
|
||||||
$checkproject = array('projet'); // Test for project object
|
$checkproject = array('projet','project'); // Test for project object
|
||||||
|
$checktask = array('projet_task');
|
||||||
$nocheck = array('barcode','stock','fournisseur'); // No test
|
$nocheck = array('barcode','stock','fournisseur'); // No test
|
||||||
$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...).
|
$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...).
|
||||||
|
|
||||||
@@ -453,7 +456,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
|||||||
}
|
}
|
||||||
else if (in_array($feature,$checkproject))
|
else if (in_array($feature,$checkproject))
|
||||||
{
|
{
|
||||||
if (! empty($conf->projet->enabled) && ! $user->rights->projet->all->lire)
|
if (! empty($conf->projet->enabled) && empty($user->rights->projet->all->lire))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
$projectstatic=new Project($db);
|
$projectstatic=new Project($db);
|
||||||
@@ -469,6 +472,27 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
|||||||
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (in_array($feature,$checktask))
|
||||||
|
{
|
||||||
|
if (! empty($conf->projet->enabled) && empty($user->rights->projet->all->lire))
|
||||||
|
{
|
||||||
|
$task = new Task($db);
|
||||||
|
$task->fetch($objectid);
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
$projectstatic=new Project($db);
|
||||||
|
$tmps=$projectstatic->getProjectsAuthorizedForUser($user,0,1,0);
|
||||||
|
$tmparray=explode(',',$tmps);
|
||||||
|
if (! in_array($task->fk_project,$tmparray)) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SELECT dbt.".$dbt_select;
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||||
|
$sql.= " WHERE dbt.".$dbt_select." = ".$objectid;
|
||||||
|
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (! in_array($feature,$nocheck)) // By default we check with link to third party
|
else if (! in_array($feature,$nocheck)) // By default we check with link to third party
|
||||||
{
|
{
|
||||||
// If external user: Check permission for external users
|
// If external user: Check permission for external users
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||||
|
|
||||||
if (! defined('EURO')) define('EURO',chr(128));
|
if (! defined('EURO')) define('EURO',chr(128));
|
||||||
|
|
||||||
|
|||||||
@@ -413,10 +413,10 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
|
|||||||
{
|
{
|
||||||
// Migrate to add entity value into llx_societe_remise
|
// Migrate to add entity value into llx_societe_remise
|
||||||
migrate_remise_entity($db,$langs,$conf);
|
migrate_remise_entity($db,$langs,$conf);
|
||||||
|
|
||||||
// Migrate to add entity value into llx_societe_remise_except
|
// Migrate to add entity value into llx_societe_remise_except
|
||||||
migrate_remise_except_entity($db,$langs,$conf);
|
migrate_remise_except_entity($db,$langs,$conf);
|
||||||
|
|
||||||
// Reload modules (this must be always and only into last targeted version)
|
// Reload modules (this must be always and only into last targeted version)
|
||||||
$listofmodule=array(
|
$listofmodule=array(
|
||||||
'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly',
|
'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly',
|
||||||
@@ -441,11 +441,11 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
|
|||||||
'MAIN_MODULE_USER'=>'newboxdefonly',
|
'MAIN_MODULE_USER'=>'newboxdefonly',
|
||||||
);
|
);
|
||||||
migrate_reload_modules($db,$langs,$conf,$listofmodule);
|
migrate_reload_modules($db,$langs,$conf,$listofmodule);
|
||||||
|
|
||||||
// Reload menus (this must be always and only into last targeted version)
|
// Reload menus (this must be always and only into last targeted version)
|
||||||
migrate_reload_menu($db,$langs,$conf,$versionto);
|
migrate_reload_menu($db,$langs,$conf,$versionto);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can force activation of some module during migration with third paramater = MAIN_MODULE_XXX,MAIN_MODULE_YYY,...
|
// Can force activation of some module during migration with third paramater = MAIN_MODULE_XXX,MAIN_MODULE_YYY,...
|
||||||
if ($enablemodules)
|
if ($enablemodules)
|
||||||
{
|
{
|
||||||
@@ -471,8 +471,8 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
|
|||||||
// Actions for all versions (not in database)
|
// Actions for all versions (not in database)
|
||||||
migrate_delete_old_files($db, $langs, $conf);
|
migrate_delete_old_files($db, $langs, $conf);
|
||||||
migrate_delete_old_dir($db, $langs, $conf);
|
migrate_delete_old_dir($db, $langs, $conf);
|
||||||
|
|
||||||
|
|
||||||
dol_mkdir(DOL_DATA_ROOT.'/bank');
|
dol_mkdir(DOL_DATA_ROOT.'/bank');
|
||||||
migrate_directories($db, $langs, $conf, '/banque/bordereau', '/bank/checkdeposits');
|
migrate_directories($db, $langs, $conf, '/banque/bordereau', '/bank/checkdeposits');
|
||||||
}
|
}
|
||||||
@@ -3942,10 +3942,13 @@ function migrate_delete_old_files($db,$langs,$conf)
|
|||||||
DOL_DOCUMENT_ROOT.'/core/modules/mailings/kiwi.modules.php',
|
DOL_DOCUMENT_ROOT.'/core/modules/mailings/kiwi.modules.php',
|
||||||
DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_crabe.modules.php',
|
DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_crabe.modules.php',
|
||||||
DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_oursin.modules.php',
|
DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_oursin.modules.php',
|
||||||
|
|
||||||
DOL_DOCUMENT_ROOT.'/compta/facture/class/api_invoice.class.php',
|
DOL_DOCUMENT_ROOT.'/compta/facture/class/api_invoice.class.php',
|
||||||
DOL_DOCUMENT_ROOT.'/commande/class/api_commande.class.php',
|
DOL_DOCUMENT_ROOT.'/commande/class/api_commande.class.php',
|
||||||
DOL_DOCUMENT_ROOT.'/user/class/api_user.class.php'
|
DOL_DOCUMENT_ROOT.'/user/class/api_user.class.php',
|
||||||
|
DOL_DOCUMENT_ROOT.'/product/class/api_product.class.php',
|
||||||
|
DOL_DOCUMENT_ROOT.'/societe/class/api_contact.class.php',
|
||||||
|
DOL_DOCUMENT_ROOT.'/societe/class/api_thirdparty.class.php'
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($filetodeletearray as $filetodelete)
|
foreach ($filetodeletearray as $filetodelete)
|
||||||
|
|||||||
@@ -958,6 +958,7 @@ elseif ($object->id > 0)
|
|||||||
// Change probability from status
|
// Change probability from status
|
||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
|
// Default value to close or not when we set opp to 'WON'.
|
||||||
$defaultcheckedwhenoppclose=1;
|
$defaultcheckedwhenoppclose=1;
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0;
|
if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0;
|
||||||
|
|
||||||
@@ -973,12 +974,16 @@ elseif ($object->id > 0)
|
|||||||
var oldpercent = \''.dol_escape_js($object->opp_percent).'\';
|
var oldpercent = \''.dol_escape_js($object->opp_percent).'\';
|
||||||
|
|
||||||
console.log("We select "+elemcode);
|
console.log("We select "+elemcode);
|
||||||
if (elemcode == \'LOST\') defaultcloseproject = 1;
|
|
||||||
jQuery("#divtocloseproject").show();
|
/* Define if checkbox to close is checked or not */
|
||||||
if (defaultcloseproject) jQuery("#inputcloseproject").prop("checked", true);
|
var closeproject = 0;
|
||||||
|
if (elemcode == \'LOST\') closeproject = 1;
|
||||||
|
if (elemcode == \'WON\') closeproject = defaultcloseproject;
|
||||||
|
if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
|
||||||
else jQuery("#inputcloseproject").prop("checked", false);
|
else jQuery("#inputcloseproject").prop("checked", false);
|
||||||
|
|
||||||
/* Make close project visible or not */
|
/* Make the close project checkbox visible or not */
|
||||||
|
console.log("closeproject="+closeproject);
|
||||||
if (elemcode == \'WON\' || elemcode == \'LOST\')
|
if (elemcode == \'WON\' || elemcode == \'LOST\')
|
||||||
{
|
{
|
||||||
jQuery("#divtocloseproject").show();
|
jQuery("#divtocloseproject").show();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for projects
|
* API class for projects
|
||||||
*
|
*
|
||||||
@@ -83,8 +83,8 @@ class Projects extends DolibarrApi
|
|||||||
return $this->_cleanObjectDatas($this->project);
|
return $this->_cleanObjectDatas($this->project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List projects
|
* List projects
|
||||||
*
|
*
|
||||||
@@ -102,7 +102,7 @@ class Projects extends DolibarrApi
|
|||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|
||||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ class Projects extends DolibarrApi
|
|||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
@@ -135,7 +135,7 @@ class Projects extends DolibarrApi
|
|||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
if ($limit) {
|
if ($limit) {
|
||||||
if ($page < 0)
|
if ($page < 0)
|
||||||
@@ -228,7 +228,7 @@ class Projects extends DolibarrApi
|
|||||||
}
|
}
|
||||||
$this->project->getLinesArray(DolibarrApiAccess::$user);
|
$this->project->getLinesArray(DolibarrApiAccess::$user);
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($this->project->lines as $line) // $line is a task
|
foreach ($this->project->lines as $line) // $line is a task
|
||||||
{
|
{
|
||||||
if ($includetimespent == 1)
|
if ($includetimespent == 1)
|
||||||
{
|
{
|
||||||
@@ -244,7 +244,7 @@ class Projects extends DolibarrApi
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get roles a user is assigned to a project with
|
* Get roles a user is assigned to a project with
|
||||||
*
|
*
|
||||||
@@ -257,20 +257,20 @@ class Projects extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
function getRoles($id, $userid=0) {
|
function getRoles($id, $userid=0) {
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->projet->lire) {
|
if(! DolibarrApiAccess::$user->rights->projet->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->project->fetch($id);
|
$result = $this->project->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Project not found');
|
throw new RestException(404, 'Project not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
$taskstatic=new Task($this->db);
|
$taskstatic=new Task($this->db);
|
||||||
$userp = DolibarrApiAccess::$user;
|
$userp = DolibarrApiAccess::$user;
|
||||||
@@ -286,8 +286,8 @@ class Projects extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a task to given project
|
* Add a task to given project
|
||||||
*
|
*
|
||||||
@@ -348,7 +348,7 @@ class Projects extends DolibarrApi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a task to given project
|
* Update a task to given project
|
||||||
*
|
*
|
||||||
@@ -406,9 +406,9 @@ class Projects extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update project general fields (won't touch lines of project)
|
* Update project general fields (won't touch lines of project)
|
||||||
*
|
*
|
||||||
@@ -483,7 +483,7 @@ class Projects extends DolibarrApi
|
|||||||
* Validate a project.
|
* Validate a project.
|
||||||
* You can test this API with the following input message
|
* You can test this API with the following input message
|
||||||
* { "notrigger": 0 }
|
* { "notrigger": 0 }
|
||||||
*
|
*
|
||||||
* @param int $id Project ID
|
* @param int $id Project ID
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
*
|
*
|
||||||
@@ -527,7 +527,7 @@ class Projects extends DolibarrApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
*
|
*
|
||||||
@@ -535,9 +535,12 @@ class Projects extends DolibarrApi
|
|||||||
* @return array Array of cleaned object properties
|
* @return array Array of cleaned object properties
|
||||||
*/
|
*/
|
||||||
function _cleanObjectDatas($object) {
|
function _cleanObjectDatas($object) {
|
||||||
|
|
||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
|
unset($object->titre);
|
||||||
|
unset($object->datec);
|
||||||
|
unset($object->datem);
|
||||||
unset($object->barcode_type);
|
unset($object->barcode_type);
|
||||||
unset($object->barcode_type_code);
|
unset($object->barcode_type_code);
|
||||||
unset($object->barcode_type_label);
|
unset($object->barcode_type_label);
|
||||||
@@ -559,21 +562,21 @@ class Projects extends DolibarrApi
|
|||||||
unset($object->country);
|
unset($object->country);
|
||||||
unset($object->country_id);
|
unset($object->country_id);
|
||||||
unset($object->country_code);
|
unset($object->country_code);
|
||||||
|
|
||||||
unset($object->weekWorkLoad);
|
unset($object->weekWorkLoad);
|
||||||
unset($object->weekWorkLoad);
|
unset($object->weekWorkLoad);
|
||||||
|
|
||||||
//unset($object->lines); // for task we use timespent_lines, but for project we use lines
|
//unset($object->lines); // for task we use timespent_lines, but for project we use lines
|
||||||
|
|
||||||
unset($object->total_ht);
|
unset($object->total_ht);
|
||||||
unset($object->total_tva);
|
unset($object->total_tva);
|
||||||
unset($object->total_localtax1);
|
unset($object->total_localtax1);
|
||||||
unset($object->total_localtax2);
|
unset($object->total_localtax2);
|
||||||
unset($object->total_ttc);
|
unset($object->total_ttc);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate fields before create or update object
|
* Validate fields before create or update object
|
||||||
*
|
*
|
||||||
@@ -592,8 +595,8 @@ class Projects extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// getSummaryOfTimeSpent
|
// getSummaryOfTimeSpent
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,11 +356,13 @@ class SupplierProposal extends CommonObject
|
|||||||
* @param array $array_option extrafields array
|
* @param array $array_option extrafields array
|
||||||
* @param string $ref_fourn Supplier price reference
|
* @param string $ref_fourn Supplier price reference
|
||||||
* @param int $fk_unit Id of the unit to use.
|
* @param int $fk_unit Id of the unit to use.
|
||||||
|
* @param string $origin 'order', 'supplier_proposal', ...
|
||||||
|
* @param int $origin_id Id of origin line
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*
|
*
|
||||||
* @see add_product
|
* @see add_product
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='', $fk_unit='')
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='', $fk_unit='', $origin='', $origin_id=0)
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
|
|
||||||
@@ -462,7 +464,8 @@ class SupplierProposal extends CommonObject
|
|||||||
$this->line->special_code=$special_code;
|
$this->line->special_code=$special_code;
|
||||||
$this->line->fk_parent_line=$fk_parent_line;
|
$this->line->fk_parent_line=$fk_parent_line;
|
||||||
$this->line->fk_unit=$fk_unit;
|
$this->line->fk_unit=$fk_unit;
|
||||||
|
$this->line->origin=$origin;
|
||||||
|
$this->line->origin_id=$origin_id;
|
||||||
$this->line->ref_fourn = $this->db->escape($ref_fourn);
|
$this->line->ref_fourn = $this->db->escape($ref_fourn);
|
||||||
|
|
||||||
// infos marge
|
// infos marge
|
||||||
@@ -880,7 +883,10 @@ class SupplierProposal extends CommonObject
|
|||||||
$this->lines[$i]->pa_ht,
|
$this->lines[$i]->pa_ht,
|
||||||
$this->lines[$i]->label,
|
$this->lines[$i]->label,
|
||||||
$this->lines[$i]->array_options,
|
$this->lines[$i]->array_options,
|
||||||
$this->lines[$i]->ref_fourn
|
$this->lines[$i]->ref_fourn,
|
||||||
|
$this->lines[$i]->fk_unit,
|
||||||
|
'supplier_proposal',
|
||||||
|
$this->lines[$i]->rowid
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@@ -179,32 +179,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$user=$this->savuser;
|
$user=$this->savuser;
|
||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
// With same hours - Tuesday/Wednesday jan 2013
|
// With same hours - Tuesday/Wednesday jan 2013
|
||||||
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
|
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
|
||||||
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
|
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
|
||||||
|
|
||||||
$result=num_public_holiday($date1,$date2,'FR',1);
|
$result=num_public_holiday($date1,$date2,'FR',1);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(1,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR'); // 1 closed days
|
$this->assertEquals(1,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR'); // 1 closed days
|
||||||
|
|
||||||
$result=num_public_holiday($date1,$date2,'XX',1);
|
$result=num_public_holiday($date1,$date2,'XX',1);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(0,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX'); // no closed days (country unknown)
|
$this->assertEquals(0,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX'); // no closed days (country unknown)
|
||||||
|
|
||||||
// With same hours - Friday/Sunday jan 2013
|
// With same hours - Friday/Sunday jan 2013
|
||||||
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
|
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
|
||||||
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
|
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
|
||||||
|
|
||||||
$result=num_public_holiday($date1,$date2,'FR',1);
|
$result=num_public_holiday($date1,$date2,'FR',1);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days
|
$this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days
|
||||||
|
|
||||||
$result=num_public_holiday($date1,$date2,'XX',1);
|
$result=num_public_holiday($date1,$date2,'XX',1);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(2,$result,'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown)
|
$this->assertEquals(2,$result,'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testNumOpenDay
|
* testNumOpenDay
|
||||||
*
|
*
|
||||||
@@ -217,32 +217,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$user=$this->savuser;
|
$user=$this->savuser;
|
||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
// With same hours - Tuesday/Wednesday jan 2013
|
// With same hours - Tuesday/Wednesday jan 2013
|
||||||
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
|
$date1=dol_mktime(0, 0, 0, 1, 1, 2013);
|
||||||
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
|
$date2=dol_mktime(0, 0, 0, 1, 2, 2013);
|
||||||
|
|
||||||
$result=num_open_day($date1,$date2,0,1,0,'FR');
|
$result=num_open_day($date1,$date2,0,1,0,'FR');
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(1,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days
|
$this->assertEquals(1,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days
|
||||||
|
|
||||||
$result=num_open_day($date1,$date2,0,1,0,'XX');
|
$result=num_open_day($date1,$date2,0,1,0,'XX');
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(2,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown)
|
$this->assertEquals(2,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown)
|
||||||
|
|
||||||
// With same hours - Friday/Sunday jan 2013
|
// With same hours - Friday/Sunday jan 2013
|
||||||
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
|
$date1=dol_mktime(0, 0, 0, 1, 4, 2013);
|
||||||
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
|
$date2=dol_mktime(0, 0, 0, 1, 6, 2013);
|
||||||
|
|
||||||
$result=num_open_day($date1,$date2,0,1,0,'FR');
|
$result=num_open_day($date1,$date2,0,1,0,'FR');
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(1,$result,'NumOpenDay for FR'); // 1 opened day, 2 closed
|
$this->assertEquals(1,$result,'NumOpenDay for FR'); // 1 opened day, 2 closed
|
||||||
|
|
||||||
$result=num_open_day($date1,$date2,'XX',1);
|
$result=num_open_day($date1,$date2,'XX',1);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals(1,$result,'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown)
|
$this->assertEquals(1,$result,'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testConvertTime2Seconds
|
* testConvertTime2Seconds
|
||||||
*
|
*
|
||||||
@@ -335,6 +335,11 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
|||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('02/01/1970 00:00',$result);
|
$this->assertEquals('02/01/1970 00:00',$result);
|
||||||
|
|
||||||
|
// Check %a and %b format for fr_FR
|
||||||
|
$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('Jeu Jan. Janvier',$result);
|
||||||
|
|
||||||
// Check day format for en_US
|
// Check day format for en_US
|
||||||
$outputlangs=new Translate('',$conf);
|
$outputlangs=new Translate('',$conf);
|
||||||
$outputlangs->setDefaultLang('en_US');
|
$outputlangs->setDefaultLang('en_US');
|
||||||
@@ -345,9 +350,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('01/02/1970',$result);
|
$this->assertEquals('01/02/1970',$result);
|
||||||
|
|
||||||
// Check %a and %b format for en_US
|
// Check %a and %b format for en_US
|
||||||
$result=dol_print_date(0,'%a %b',true,$outputlangs);
|
$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('Thu Jan',$result);
|
$this->assertEquals('Thu Jan January',$result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user