Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
7ed5d5e543
@ -85,6 +85,7 @@ For developers:
|
||||
- New: Add hook addHomeSetup.
|
||||
- New: Add trigger CATEGORY_LINK and CATEGORY_UNLINK.
|
||||
- New: A trigger can return an array of error strings instead of one error string.
|
||||
- New: Add method to use a dictionnary as a combo box.
|
||||
|
||||
WARNING: Following change may create regression for some external modules, but was necessary to make
|
||||
Dolibarr better:
|
||||
|
||||
@ -139,11 +139,11 @@ Warning: Name and email must match value into debian/control file (Entry added h
|
||||
> git-buildpackage -us -uc
|
||||
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
|
||||
Note: Package is built into directory ../build-area
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
> git-buildpackage --git-tag
|
||||
> git-buildpackage --git-tag-only --git-retag
|
||||
> git push --all ou git push origin --all
|
||||
> git push --tags
|
||||
|
||||
@ -195,10 +195,11 @@ Warning: Name and email must match value into debian/control file (Entry added h
|
||||
> git-buildpackage -us -uc
|
||||
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
Note: Package is built into directory ../build-area
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
> git-buildpackage --git-tag
|
||||
> git-buildpackage --git-tag-only --git-retag
|
||||
> git push --all ou git push origin --all
|
||||
> git push --tags
|
||||
|
||||
|
||||
@ -340,6 +340,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
|
||||
|
||||
@ -1003,7 +1003,7 @@ if ($id > 0)
|
||||
{
|
||||
$project=new Project($db);
|
||||
$project->fetch($act->fk_project);
|
||||
print $project->getNomUrl(1);
|
||||
print $project->getNomUrl(1,'',1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -875,14 +875,18 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
//If deposit invoice
|
||||
if ($_POST['type'] == 3) {
|
||||
// If deposit invoice
|
||||
if ($_POST['type'] == 3)
|
||||
{
|
||||
$typeamount=GETPOST('typedeposit','alpha');
|
||||
$valuedeposit=GETPOST('valuedeposit','int');
|
||||
|
||||
if ($typeamount=='amount') {
|
||||
if ($typeamount=='amount')
|
||||
{
|
||||
$amountdeposit=$valuedeposit;
|
||||
}else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$amountdeposit=0;
|
||||
|
||||
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
||||
@ -890,19 +894,20 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$classname = ucfirst($subelement);
|
||||
$srcobject = new $classname($db);
|
||||
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit line");
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit lines");
|
||||
$result=$srcobject->fetch($object->origin_id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$totalamount=0;
|
||||
$lines = $srcobject->lines;
|
||||
$num=count($lines);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
$numlines=count($lines);
|
||||
for ($i=0; $i<$numlines; $i++)
|
||||
{
|
||||
$totalamount=+$lines[$i]->subprice;
|
||||
$totalamount += $lines[$i]->subprice;
|
||||
}
|
||||
|
||||
if ($totalamount!=0) {
|
||||
if ($totalamount!=0)
|
||||
{
|
||||
$amountdeposit=($totalamount*$valuedeposit)/100;
|
||||
}
|
||||
}
|
||||
@ -1585,7 +1590,7 @@ else if ($action == 'down' && $user->rights->facture->creer)
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
*/
|
||||
if (GETPOST('addfile'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -1600,7 +1605,7 @@ if (GETPOST('addfile'))
|
||||
|
||||
/*
|
||||
* Remove file in email form
|
||||
*/
|
||||
*/
|
||||
if (! empty($_POST['removedfile']))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -1616,7 +1621,7 @@ if (! empty($_POST['removedfile']))
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
*/
|
||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
|
||||
{
|
||||
$langs->load('mails');
|
||||
@ -1790,7 +1795,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
|
||||
/*
|
||||
* Generate document
|
||||
*/
|
||||
*/
|
||||
else if ($action == 'builddoc') // En get ou en post
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -2019,7 +2024,7 @@ if ($action == 'create')
|
||||
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
|
||||
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
|
||||
|
||||
//Replicate extrafields
|
||||
$objectsrc->fetch_optionals($originid);
|
||||
$object->array_options=$objectsrc->array_options;
|
||||
@ -2058,8 +2063,7 @@ if ($action == 'create')
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||
|
||||
// Tiers
|
||||
print '<tr>';
|
||||
// Thirdparty
|
||||
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
if($soc->id > 0)
|
||||
{
|
||||
@ -2076,7 +2080,7 @@ if ($action == 'create')
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Factures predefinies
|
||||
// Predefined invoices
|
||||
if (empty($origin) && empty($originid) && $socid > 0)
|
||||
{
|
||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||
@ -2183,10 +2187,13 @@ if ($action == 'create')
|
||||
print '</td><td valign="middle" class="nowrap">';
|
||||
$desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
|
||||
print '<table class="nobordernopadding"><tr><td>'.$desc.'</td>';
|
||||
if (($origin=='propal') || ($origin=='commande')) {
|
||||
print '<td><select name="typedeposit"><option value="amount">'.$langs->trans('FixAmount').'</option>';
|
||||
print '<option value="variable">'.$langs->trans('VarAmount').'</option></select></td>';
|
||||
print '<td>'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
|
||||
if (($origin=='propal') || ($origin=='commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist=array('amount'=>'FixAmount','variable'=>'VarAmount');
|
||||
print $form->selectarray('typedeposit',$arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td></tr>'."\n";
|
||||
@ -2455,6 +2462,7 @@ if ($action == 'create')
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
@ -3722,24 +3730,24 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
if (empty($somethingshown) && $object->statut > 0)
|
||||
{
|
||||
|
||||
|
||||
print '<a href="#" onClick="lier_commande(commande)">'.$langs->trans('LinkedOrder').'</a>';
|
||||
|
||||
|
||||
print '<div id="commande" style="display:none">';
|
||||
{
|
||||
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= ' WHERE c.fk_soc = '.$soc->id.'';
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
print_titre($langs->trans("LinkedOrder"));
|
||||
print '<table><tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
@ -3762,30 +3770,30 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td>'.price($objp->total_ht).'</td>';
|
||||
print '<td>'.$objp->name.'</td>';
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</br>';
|
||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans('OK').'"></center>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$result=$object->add_object_linked('commande',$_POST['linkedOrder']);
|
||||
if($result>0)
|
||||
{
|
||||
echo '<meta http-equiv="refresh" content="0;URL=facture.php?facid='.$object->id.'">';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0)
|
||||
@ -3944,7 +3952,7 @@ $db->close();
|
||||
|
||||
function lier_commande(commande)
|
||||
{
|
||||
|
||||
|
||||
if(commande.style.display=='none')
|
||||
{
|
||||
commande.style.display='inline';
|
||||
|
||||
@ -83,17 +83,29 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
|
||||
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
|
||||
$shownb=GETPOST($param_shownb,'alpha',4);
|
||||
$showtot=GETPOST($param_showtot,'alpha',4);
|
||||
if (GETPOST('DOL_AUTOSET_COOKIE'))
|
||||
{
|
||||
$endyear=GETPOST($param_year,'int');
|
||||
$shownb=GETPOST($param_shownb,'alpha');
|
||||
$showtot=GETPOST($param_showtot,'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='customer';
|
||||
$userid=0;
|
||||
@ -191,7 +203,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");
|
||||
|
||||
@ -82,17 +82,29 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
|
||||
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
|
||||
$shownb=GETPOST($param_shownb,'alpha',4);
|
||||
$showtot=GETPOST($param_showtot,'alpha',4);
|
||||
if (GETPOST('DOL_AUTOSET_COOKIE'))
|
||||
{
|
||||
$endyear=GETPOST($param_year,'int');
|
||||
$shownb=GETPOST($param_shownb,'alpha');
|
||||
$showtot=GETPOST($param_showtot,'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='supplier';
|
||||
$userid=0;
|
||||
@ -190,7 +202,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");
|
||||
|
||||
@ -83,17 +83,29 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
|
||||
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
|
||||
$shownb=GETPOST($param_shownb,'alpha',4);
|
||||
$showtot=GETPOST($param_showtot,'alpha',4);
|
||||
if (GETPOST('DOL_AUTOSET_COOKIE'))
|
||||
{
|
||||
$endyear=GETPOST($param_year,'int');
|
||||
$shownb=GETPOST($param_shownb,'alpha');
|
||||
$showtot=GETPOST($param_showtot,'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='customer';
|
||||
$userid=0;
|
||||
@ -191,7 +203,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");
|
||||
|
||||
@ -82,17 +82,29 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
|
||||
if ($user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
|
||||
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
|
||||
$shownb=GETPOST($param_shownb,'alpha',4);
|
||||
$showtot=GETPOST($param_showtot,'alpha',4);
|
||||
if (GETPOST('DOL_AUTOSET_COOKIE'))
|
||||
{
|
||||
$endyear=GETPOST($param_year,'int');
|
||||
$shownb=GETPOST($param_shownb,'alpha');
|
||||
$showtot=GETPOST($param_showtot,'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='supplier';
|
||||
$userid=0;
|
||||
@ -190,7 +202,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");
|
||||
|
||||
@ -82,20 +82,33 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
|
||||
$param_showinvoicenb='DOLUSERCOOKIE_param'.$this->boxcode.'showinvoicenb';
|
||||
$param_showpropalnb='DOLUSERCOOKIE_param'.$this->boxcode.'showpropalnb';
|
||||
$param_showordernb='DOLUSERCOOKIE_param'.$this->boxcode.'showordernb';
|
||||
$showinvoicenb=GETPOST($param_showinvoicenb,'alpha',4);
|
||||
$showpropalnb=GETPOST($param_showpropalnb,'alpha',4);
|
||||
$showordernb=GETPOST($param_showordernb,'alpha',4);
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_showinvoicenb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showinvoicenb';
|
||||
$param_showpropalnb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showpropalnb';
|
||||
$param_showordernb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showordernb';
|
||||
if (GETPOST('DOL_AUTOSET_COOKIE'))
|
||||
{
|
||||
$year=GETPOST($param_year,'int');
|
||||
$showinvoicenb=GETPOST($param_showinvoicenb,'alpha');
|
||||
$showpropalnb=GETPOST($param_showpropalnb,'alpha');
|
||||
$showordernb=GETPOST($param_showordernb,'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||
$year=$tmparray['year'];
|
||||
$showinvoicenb=$tmparray['showinvoicenb'];
|
||||
$showpropalnb=$tmparray['showpropalnb'];
|
||||
$showordernb=$tmparray['showordernb'];
|
||||
}
|
||||
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; }
|
||||
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0;
|
||||
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) $showpropalnb=0;
|
||||
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0;
|
||||
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
$year=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
|
||||
if (empty($year)) $year=$nowarray['year'];
|
||||
|
||||
$nbofgraph=0;
|
||||
if ($showinvoicenb) $nbofgraph++;
|
||||
@ -300,7 +313,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_showinvoicenb.','.$param_showpropalnb.','.$param_showordernb.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,showinvoicenb,showpropalnb,showordernb">';
|
||||
if (! empty($conf->facture->enabled) || ! empty($user->rights->facture->lire))
|
||||
{
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showinvoicenb.'"'.($showinvoicenb?' checked="true"':'').'> '.$langs->trans("ForCustomersInvoices");
|
||||
|
||||
@ -83,17 +83,29 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
|
||||
if ($user->rights->propal->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
|
||||
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
|
||||
$shownb=GETPOST($param_shownb,'alpha',4);
|
||||
$showtot=GETPOST($param_showtot,'alpha',4);
|
||||
if (GETPOST('DOL_AUTOSET_COOKIE'))
|
||||
{
|
||||
$endyear=GETPOST($param_year,'int');
|
||||
$shownb=GETPOST($param_shownb,'alpha');
|
||||
$showtot=GETPOST($param_showtot,'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='customer';
|
||||
$userid=0;
|
||||
@ -196,7 +208,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
$stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfProposalsByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfProposalsByMonthHT");
|
||||
|
||||
@ -1084,6 +1084,68 @@ class FormOther
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a HTML select list of bank accounts
|
||||
*
|
||||
* @param string $htmlname Name of select zone
|
||||
* @param string $dictionnarytable Dictionnary table
|
||||
* @param string $keyfield Field for key
|
||||
* @param string $labelfield Label field
|
||||
* @param string $selected Selected value
|
||||
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||
* @return void
|
||||
*/
|
||||
function select_dictionnary($htmlname,$dictionnarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
$sql = "SELECT rowid, ".$keyfield.", ".$labelfield;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dictionnarytable;
|
||||
$sql.= " ORDER BY ".$labelfield;
|
||||
|
||||
dol_syslog(get_class($this)."::select_dictionnary sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<select id="select'.$htmlname.'" class="flat selectdictionnary" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
|
||||
if ($useempty == 1 || ($useempty == 2 && $num > 1))
|
||||
{
|
||||
print '<option value="-1"> </option>';
|
||||
}
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($selected == $obj->rowid || $selected == $obj->$keyfield)
|
||||
{
|
||||
print '<option value="'.$obj->$keyfield.'" selected="selected">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="'.$obj->$keyfield.'">';
|
||||
}
|
||||
print $obj->$labelfield;
|
||||
print '</option>';
|
||||
$i++;
|
||||
}
|
||||
print "</select>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("DictionnaryEmpty");
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -3478,16 +3478,18 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
|
||||
|
||||
/**
|
||||
* Replace htmlentities functions to manage errors
|
||||
* http://php.net/manual/en/function.htmlentities.php
|
||||
*
|
||||
* @param string $a Operand a
|
||||
* @param string $b Operand b
|
||||
* @param string $c Operand c
|
||||
* @return string String encoded
|
||||
* @param string $string The input string.
|
||||
* @param int $flags Flags(see PHP doc above)
|
||||
* @param string $encoding Encoding
|
||||
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
|
||||
* @return string $ret Encoded string
|
||||
*/
|
||||
function dol_htmlentities($a,$b,$c='UTF-8')
|
||||
function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false)
|
||||
{
|
||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
||||
$ret=@htmlentities($a,$b,$c);
|
||||
$ret=@htmlentities($string, $flags, $encoding, $double_encode);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
@ -176,27 +176,34 @@ class modProjet extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("projet","export"));
|
||||
$this->export_dependencies_array[$r]=array('task_time'=>'ppt.rowid');
|
||||
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
|
||||
's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||
'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote",
|
||||
'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc");
|
||||
's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||
'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote",
|
||||
'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc",
|
||||
'ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote");
|
||||
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle',
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle',
|
||||
's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text",
|
||||
'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Duree",'pt.progress'=>"Number",'pt.description'=>"Text");
|
||||
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
|
||||
's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
|
||||
'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project",
|
||||
'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task");
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle',
|
||||
's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text",
|
||||
'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Number",'pt.progress'=>"Number",'pt.description'=>"Text",
|
||||
'ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:Name",'ptt.note'=>"Text");
|
||||
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company',
|
||||
's.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
|
||||
'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project",
|
||||
'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task",
|
||||
'ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time");
|
||||
|
||||
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'projet_task as pt, '.MAIN_DB_PREFIX.'societe as s)';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid AND p.rowid = pt.fk_projet ';
|
||||
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'societe as s)';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON (p.rowid = pt.fk_projet)";
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON (pt.rowid = ptt.fk_task)";
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity;
|
||||
$r++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -377,7 +377,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
|
||||
|
||||
$vatrate=(string) $object->lines[$i]->tva_tx;
|
||||
|
||||
|
||||
// Retrieve type from database for backward compatibility with old records
|
||||
if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
|
||||
&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
|
||||
@ -470,8 +470,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
|
||||
}
|
||||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf, $object, $outputlangs);
|
||||
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
@ -963,7 +963,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R');
|
||||
}
|
||||
|
||||
|
||||
$posy+=2;
|
||||
$pdf->SetFont('','', $default_font_size -1);
|
||||
|
||||
|
||||
@ -165,13 +165,21 @@ require_once 'filefunc.inc.php';
|
||||
// If there is a POST parameter to tell to save automatically some POST params into a cookies, we do it
|
||||
if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
|
||||
{
|
||||
$tmplist=explode(',',$_POST["DOL_AUTOSET_COOKIE"]);
|
||||
foreach ($tmplist as $value)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
$tmpautoset=explode(':',$_POST["DOL_AUTOSET_COOKIE"],2);
|
||||
$tmplist=explode(',',$tmpautoset[1]);
|
||||
$cookiearrayvalue='';
|
||||
foreach ($tmplist as $tmpkey)
|
||||
{
|
||||
//var_dump('setcookie key='.$value.' value='.$_POST[$value]);
|
||||
setcookie($value, empty($_POST[$value])?'':$_POST[$value], empty($_POST[$value])?0:(time()+(86400*354)), '/'); // keep cookie 1 year
|
||||
if (empty($_POST[$value])) unset($_COOKIE[$value]);
|
||||
$postkey=$tmpautoset[0].'_'.$tmpkey;
|
||||
//var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
|
||||
if (! empty($_POST[$postkey])) $cookiearrayvalue[$tmpkey]=$_POST[$postkey];
|
||||
}
|
||||
$cookiename=$tmpautoset[0];
|
||||
$cookievalue=dol_json_encode($cookiearrayvalue);
|
||||
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
|
||||
setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/'); // keep cookie 1 year
|
||||
if (empty($cookievalue)) unset($_COOKIE[$cookiename]);
|
||||
}
|
||||
|
||||
// Init session. Name of session is specific to Dolibarr instance.
|
||||
|
||||
@ -1664,6 +1664,41 @@ class Societe extends CommonObject
|
||||
return $contacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie la liste des contacts de cette societe
|
||||
*
|
||||
* @return array $contacts tableau des contacts
|
||||
*/
|
||||
function contact_array_objects()
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
$contacts = array();
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = '".$this->id."'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$contact = new Contact($this->db);
|
||||
$contact->fetch($obj->rowid);
|
||||
$contacts[] = $contact;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
return $contacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property of contact from its id
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user