Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
c50f3c5851
@ -154,34 +154,36 @@ if ($conf->use_javascript_ajax)
|
||||
$SommeD=0;
|
||||
$dataval=array();
|
||||
$datalabels=array();
|
||||
$i=0;
|
||||
foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
$datalabels[]=$adhtype->getNomUrl(0,dol_size(16));
|
||||
$dataval['draft'][]=isset($MemberToValidate[$key])?$MemberToValidate[$key]:0;
|
||||
$dataval['notuptodate'][]=isset($MembersValidated[$key])?$MembersValidated[$key]-$MemberUpToDate[$key]:0;
|
||||
$dataval['uptodate'][]=isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0;
|
||||
$dataval['resiliated'][]=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
||||
$datalabels[]=array($i,$adhtype->getNomUrl(0,dol_size(16)));
|
||||
$dataval['draft'][]=array($i,isset($MemberToValidate[$key])?$MemberToValidate[$key]:0);
|
||||
$dataval['notuptodate'][]=array($i,isset($MembersValidated[$key])?$MembersValidated[$key]-$MemberUpToDate[$key]:0);
|
||||
$dataval['uptodate'][]=array($i,isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0);
|
||||
$dataval['resiliated'][]=array($i,isset($MembersResiliated[$key])?$MembersResiliated[$key]:0);
|
||||
$SommeA+=isset($MemberToValidate[$key])?$MemberToValidate[$key]:0;
|
||||
$SommeB+=isset($MembersValidated[$key])?$MembersValidated[$key]-$MemberUpToDate[$key]:0;
|
||||
$SommeC+=isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0;
|
||||
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
||||
$i++;
|
||||
}
|
||||
|
||||
/*
|
||||
$dataseries=array();
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'values'=> $dataval['draft']);
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'values'=> $dataval['notuptodate']);
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'values'=> $dataval['uptodate']);
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'values'=> $dataval['resiliated']);
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'data'=> $dataval['draft']);
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'data'=> $dataval['notuptodate']);
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'data'=> $dataval['uptodate']);
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'data'=> $dataval['resiliated']);
|
||||
$data=array('series'=>$dataseries,'seriestype'=>array('bar','bar','bar','bar'),'xlabel'=>$datalabels);
|
||||
dol_print_graph('stats2',300,180,$data,1,'barline');
|
||||
*/
|
||||
|
||||
$dataseries=array();
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'values'=>array(round($SommeB)));
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'values'=>array(round($SommeC)));
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'values'=>array(round($SommeD)));
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'values'=>array(round($SommeA)));
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'data'=>round($SommeB));
|
||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'data'=>round($SommeC));
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'data'=>round($SommeD));
|
||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'data'=>round($SommeA));
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -41,7 +41,7 @@ $formfile = new FormFile($db);
|
||||
llxHeader('','','EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad');
|
||||
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
function hideoptions () {
|
||||
|
||||
@ -37,7 +37,7 @@ if (! $user->admin)
|
||||
llxHeader('','','EN:Restores|FR:Restaurations|ES:Restauraciones');
|
||||
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#mysql_options").<?php echo GETPOST('radio_dump')=='mysql_options'?'show()':'hide()'; ?>;
|
||||
jQuery("#postgresql_options").<?php echo GETPOST('radio_dump')=='postgresql_options'?'show()':'hide()'; ?>;
|
||||
|
||||
@ -144,15 +144,14 @@ class Facturation {
|
||||
$newcartarray[$i]['price']=$product->price;
|
||||
$newcartarray[$i]['price_ttc']=$product->price_ttc;
|
||||
|
||||
/** add Ditto for MultiPrix*/
|
||||
if ($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
if(isset($product->multiprices[$societe->price_level]))
|
||||
if (isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
$newcartarray[$i]['price'] = $product->multiprices_ttc[$societe->price_level];
|
||||
$newcartarray[$i]['price'] = $product->multiprices[$societe->price_level];
|
||||
$newcartarray[$i]['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
|
||||
}
|
||||
}
|
||||
/** end add Ditto */
|
||||
|
||||
$newcartarray[$i]['fk_article']=$this->id;
|
||||
$newcartarray[$i]['qte']=$this->qte();
|
||||
|
||||
@ -77,7 +77,8 @@ switch ( $_GET['action'] )
|
||||
|
||||
if(isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
$ret['price'] = $product->multiprices_ttc[$societe->price_level];
|
||||
$ret['price'] = $product->multiprices[$societe->price_level];
|
||||
$ret['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
|
||||
// $product->multiprices_min[$societe->price_level];
|
||||
// $product->multiprices_min_ttc[$societe->price_level];
|
||||
// $product->multiprices_base_type[$societe->price_level];
|
||||
|
||||
@ -142,6 +142,10 @@ switch ($action)
|
||||
$user->fetch($_SESSION['uid']);
|
||||
$user->getrights();
|
||||
|
||||
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
|
||||
$invoice=new Facture($db);
|
||||
|
||||
// Get content of cart
|
||||
@ -152,13 +156,17 @@ switch ($action)
|
||||
for ($i=0;$i < $tab_liste_size;$i++)
|
||||
{
|
||||
// Recuperation de l'article
|
||||
$res = $db->query('SELECT label, tva_tx, price FROM '.MAIN_DB_PREFIX.'product WHERE rowid = '.$tab_liste[$i]['fk_article']);
|
||||
$ret=array();
|
||||
$tab = $db->fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
}
|
||||
$product = new Product($db);
|
||||
$product->fetch($tab_liste[$i]['fk_article']);
|
||||
$ret=array('label'=>$product->label,'tva_tx'=>$product->tva_tx,'price'=>$product->price);
|
||||
|
||||
if ($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
if (isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
$ret['price'] = $product->multiprices[$societe->price_level];
|
||||
}
|
||||
}
|
||||
$tab_article = $ret;
|
||||
|
||||
$res = $db->query('SELECT taux FROM '.MAIN_DB_PREFIX.'c_tva WHERE rowid = '.$tab_liste[$i]['fk_tva']);
|
||||
|
||||
@ -426,24 +426,38 @@ if ($_REQUEST["action"] == 'setdesc' || $_REQUEST["action"] == 'setfrom' || $_RE
|
||||
$_GET["id"]=$_REQUEST["id"];
|
||||
}
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (! empty($_POST['addfile']))
|
||||
{
|
||||
$mil = new Mailing($db);
|
||||
$mil->fetch($_POST["id"]);
|
||||
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
// Set tmp user directory
|
||||
$mesg=dol_add_file_process($upload_dir,0,0);
|
||||
|
||||
$_POST["action"]=$_GET["action"]="edit";
|
||||
$_GET["id"]=$_POST["id"];
|
||||
}
|
||||
|
||||
// Action update emailing
|
||||
if (! empty($_POST["removedfileid"]))
|
||||
if (! empty($_POST["removedfile"]))
|
||||
{
|
||||
$mil = new Mailing($db);
|
||||
$mil->fetch($_POST["id"]);
|
||||
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
// Remove file
|
||||
$filenb=($_POST["removedfileid"]-1);
|
||||
if (isset($listofpaths[$filenb]))
|
||||
{
|
||||
$result=dol_delete_file($listofpaths[$filenb]['fullname'],1);
|
||||
}
|
||||
$mesg=dol_remove_file_process($_POST['removedfile'],0);
|
||||
|
||||
$_GET["action"]="edit";
|
||||
$_POST["action"]=$_GET["action"]="edit";
|
||||
$_GET["id"]=$_POST["id"];
|
||||
}
|
||||
|
||||
@ -457,15 +471,6 @@ if ($_POST["action"] == 'update' && empty($_POST["removedfile"]) && empty($_POST
|
||||
|
||||
$isupload=0;
|
||||
|
||||
// If upload file
|
||||
if (! empty($_POST["addfile"]) && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
$isupload=1;
|
||||
$upload_dir = $conf->mailing->dir_output."/".get_exdir($mil->id,2,0,1);
|
||||
|
||||
$mesg=dol_add_file_process($upload_dir,0,1);
|
||||
}
|
||||
|
||||
if (! $isupload)
|
||||
{
|
||||
$mil->sujet = trim($_POST["sujet"]);
|
||||
@ -653,7 +658,7 @@ else
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
|
||||
|
||||
if ($message) print $message."<br>";
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
// Confirmation de la validation du mailing
|
||||
if ($_GET["action"] == 'valid')
|
||||
@ -743,7 +748,7 @@ else
|
||||
print '<tr><td width="25%">';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
$nbemail = ($mil->nbemail?$mil->nbemail:'<font class="error">'.$langs->trans("NoTargetYet").'</font>');
|
||||
$nbemail = ($mil->nbemail?$mil->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
|
||||
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
|
||||
@ -809,11 +814,11 @@ else
|
||||
{
|
||||
if ($mil->nbemail <= 0)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoTargetYet")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoTargetYet")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
}
|
||||
else if (empty($user->rights->mailing->valider))
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -825,7 +830,7 @@ else
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -881,12 +886,6 @@ else
|
||||
$formmail->param["mailid"]=$mil->id;
|
||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id;
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
@ -900,29 +899,22 @@ else
|
||||
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$mil->sujet.'</td></tr>';
|
||||
|
||||
// Joined files
|
||||
$i='';
|
||||
//$i=0;
|
||||
//while ($i < 4)
|
||||
//{
|
||||
// $i++;
|
||||
//$property='joined_file'.$i;
|
||||
print '<tr><td>'.$langs->trans("MailFile").' '.$i.'</td><td colspan="3">';
|
||||
// List of files
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
if (count($listofpaths))
|
||||
print '<tr><td>'.$langs->trans("MailFile").'</td><td colspan="3">';
|
||||
// List of files
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
if (count($listofpaths))
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
|
||||
print '<br>';
|
||||
}
|
||||
print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Background color
|
||||
/*print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||
@ -990,40 +982,43 @@ else
|
||||
// Subject
|
||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$mil->sujet.'"></td></tr>';
|
||||
|
||||
dol_init_file_process($upload_dir);
|
||||
|
||||
// Joined files
|
||||
$i='';
|
||||
//$i=0;
|
||||
//while ($i < 4)
|
||||
//{
|
||||
// $i++;
|
||||
//$property='joined_file'.$i;
|
||||
print '<tr><td>'.$langs->trans("MailFile").' '.$i.'</td>';
|
||||
print '<td colspan="3">';
|
||||
// List of files
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
if (count($listofpaths))
|
||||
$addfileaction='addfile';
|
||||
print '<tr><td>'.$langs->trans("MailFile").'</td>';
|
||||
print '<td colspan="3">';
|
||||
// List of files
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
|
||||
$out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
||||
$out.= '<script type="text/javascript" language="javascript">';
|
||||
$out.= 'jQuery(document).ready(function () {';
|
||||
$out.= ' jQuery(".removedfile").click(function() {';
|
||||
$out.= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
|
||||
$out.= ' });';
|
||||
$out.= '})';
|
||||
$out.= '</script>'."\n";
|
||||
if (count($listofpaths))
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
|
||||
print ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="removedfile" name="removedfile" />';
|
||||
print '<input type="hidden" name="removedfileid" value="'.($key+1).'" />';
|
||||
print '<br>';
|
||||
}
|
||||
$out.= '<div id="attachfile_'.$key.'">';
|
||||
$out.= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
|
||||
$out.= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key+1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
|
||||
$out.= '<br></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
// Add link to add file
|
||||
print '<input type="file" class="flat" name="addedfile'.$i.'" value="'.$langs->trans("Upload").'"/>';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="addfile'.$i.'" value="'.$langs->trans("MailingAddFile").'">';
|
||||
//print $mil->$property?'<br>'.$mil->$property:'';
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
// Add link to add file
|
||||
$out.= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||
$out.= ' ';
|
||||
$out.= '<input type="submit" class="button" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
|
||||
print $out;
|
||||
print '</td></tr>';
|
||||
|
||||
// Background color
|
||||
print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||
|
||||
@ -121,7 +121,7 @@ if ($resql)
|
||||
$listofstatus=array(0,1,2,3,4);
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[]=array('label'=>$propalstatic->LibStatut($status,1),'values'=>array(0=>(isset($vals[$status])?$vals[$status]:0)));
|
||||
$dataseries[]=array('label'=>$propalstatic->LibStatut($status,1),'data'=>(isset($vals[$status])?$vals[$status]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
@ -3090,7 +3090,6 @@ class OrderLine
|
||||
$sql.= " , remise_percent=".price2num($this->remise_percent)."";
|
||||
$sql.= " , price=".price2num($this->price).""; // TODO A virer
|
||||
$sql.= " , remise=".price2num($this->remise).""; // TODO A virer
|
||||
$sql.= " , info_bits='".$this->info_bits."'";
|
||||
if (empty($this->skip_update_total))
|
||||
{
|
||||
$sql.= " , total_ht=".price2num($this->total_ht)."";
|
||||
|
||||
@ -121,7 +121,7 @@ if ($resql)
|
||||
$bool=false;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($status,$bool,1),'values'=>array(0=>(isset($vals[$status.$bool])?$vals[$status.$bool]:0)));
|
||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?$vals[$status.$bool]:0));
|
||||
if ($status==3 && $bool==false) $bool=true;
|
||||
else $bool=false;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ print "</tr>\n";
|
||||
$listoftype=$tripandexpense_static->listOfTypes();
|
||||
foreach ($listoftype as $code => $label)
|
||||
{
|
||||
$dataseries[]=array('label'=>$label,'values'=>array(0=>(isset($nb[$code])?$nb[$code]:0)));
|
||||
$dataseries[]=array('label'=>$label,'data'=>(isset($nb[$code])?$nb[$code]:0));
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
|
||||
@ -87,7 +87,7 @@ print "</tr>\n";
|
||||
$listofstatus=array(0,1,-1,2);
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[]=array('label'=>$donstatic->LibStatut($status,1),'values'=>array(0=>(isset($nb[$status])?$nb[$status]:0)));
|
||||
$dataseries[]=array('label'=>$donstatic->LibStatut($status,1),'data'=>(isset($nb[$status])?$nb[$status]:0));
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
|
||||
@ -894,6 +894,12 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
|
||||
{
|
||||
$result=0;
|
||||
|
||||
if ($_POST['np_price'] < 0 && $_POST["qty"] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'</div>';
|
||||
$result = -1 ;
|
||||
}
|
||||
if (empty($_POST['idprod']) && $_POST["type"] < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||
@ -3052,20 +3058,21 @@ else
|
||||
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
$sql = 'SELECT ';
|
||||
if (! $sall) $sql = 'SELECT';
|
||||
else $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||
$sql.= ' s.nom, s.rowid as socid';
|
||||
if (! $sall) $sql.= ' ,SUM(pf.amount) as am'; // To be able to sort on status
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid';
|
||||
if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
||||
else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid';
|
||||
$sql.= ' WHERE f.fk_soc = s.rowid';
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($userid)
|
||||
{
|
||||
@ -3112,10 +3119,6 @@ else
|
||||
{
|
||||
$sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= ' AND (s.nom LIKE \'%'.$db->escape($sall).'%\' OR f.facnumber LIKE \'%'.$db->escape($sall).'%\' OR f.note LIKE \'%'.$db->escape($sall).'%\' OR fd.description LIKE \'%'.$db->escape($sall).'%\')';
|
||||
}
|
||||
if (! $sall)
|
||||
{
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
|
||||
@ -3123,6 +3126,10 @@ else
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
$sql.= ' s.nom, s.rowid';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= ' AND (s.nom LIKE \'%'.$db->escape($sall).'%\' OR f.facnumber LIKE \'%'.$db->escape($sall).'%\' OR f.note LIKE \'%'.$db->escape($sall).'%\' OR fd.description LIKE \'%'.$db->escape($sall).'%\')';
|
||||
}
|
||||
$sql.= ' ORDER BY ';
|
||||
$listfield=explode(',',$sortfield);
|
||||
foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.',';
|
||||
|
||||
@ -195,10 +195,7 @@ $sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND f.type IN (0,1) AND f.fk_statut = 1";
|
||||
$sql.= " AND f.paye = 0";
|
||||
if ($option == 'late')
|
||||
{
|
||||
$sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
}
|
||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if ($_GET["filtre"])
|
||||
@ -210,33 +207,13 @@ if ($_GET["filtre"])
|
||||
$sql .= " AND " . $filt[0] . " = " . $filt[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_ref)
|
||||
{
|
||||
$sql .= " AND f.facnumber LIKE '%".$search_ref."%'";
|
||||
}
|
||||
|
||||
if ($search_societe)
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$search_societe."%'";
|
||||
}
|
||||
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
$sql .= " AND f.total = '".$search_montant_ht."'";
|
||||
}
|
||||
|
||||
if ($search_montant_ttc)
|
||||
{
|
||||
$sql .= " AND f.total_ttc = '".$search_montant_ttc."'";
|
||||
}
|
||||
|
||||
if (dol_strlen($_POST["sf_ref"]) > 0)
|
||||
{
|
||||
$sql .= " AND f.facnumber LIKE '%".$_POST["sf_ref"] . "%'";
|
||||
}
|
||||
$sql.= " GROUP BY f.facnumber";
|
||||
|
||||
if ($search_ref) $sql .= " AND f.facnumber LIKE '%".$search_ref."%'";
|
||||
if ($search_societe) $sql .= " AND s.nom LIKE '%".$search_societe."%'";
|
||||
if ($search_montant_ht) $sql .= " AND f.total = '".$search_montant_ht."'";
|
||||
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$search_montant_ttc."'";
|
||||
if (dol_strlen($_POST["sf_ref"]) > 0) $sql .= " AND f.facnumber LIKE '%".$_POST["sf_ref"] . "%'";
|
||||
$sql.= " GROUP BY f.facnumber,f.increment,f.total,f.total_ttc,f.datef, f.date_lim_reglement,f.paye, f.rowid, f.fk_statut, f.type,s.nom, s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " ORDER BY ";
|
||||
$listfield=explode(',',$sortfield);
|
||||
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
||||
@ -244,11 +221,10 @@ $sql.= " f.facnumber DESC";
|
||||
|
||||
//$sql .= $db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
@ -332,7 +308,7 @@ if ($result)
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
@ -425,10 +401,11 @@ if ($result)
|
||||
$formfile->show_documents('unpaid','',$filedir,$urlsource,$genallowed,$delallowed,'',1,0,0,48,1,$param,'',$langs->trans("PDFMerge"));
|
||||
print '</form>';
|
||||
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
else dol_print_error($db,'');
|
||||
|
||||
llxFooter();
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
?>
|
||||
|
||||
@ -180,7 +180,7 @@ $var=true;
|
||||
$listofstatus=array(0,4,4,5); $bool=false;
|
||||
foreach($listofstatus as $status)
|
||||
{
|
||||
$dataseries[]=array('label'=>$staticcontratligne->LibStatut($status,1,($bool?1:0)),'values'=>array(0=>($nb[$status.$bool]?$nb[$status.$bool]:0)));
|
||||
$dataseries[]=array('label'=>$staticcontratligne->LibStatut($status,1,($bool?1:0)),'data'=>($nb[$status.$bool]?$nb[$status.$bool]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
@ -1209,7 +1209,7 @@ class Form
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$outselect.='<select class="flat" name="'.$htmlname.'">';
|
||||
$outselect.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$outselect.='<option value="0" selected="selected"> </option>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -831,6 +831,36 @@ function dol_meta_create($object)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Init $_SESSION with uploaded files
|
||||
*
|
||||
* @param string $pathtoscan Path to scan
|
||||
* @return void
|
||||
*/
|
||||
function dol_init_file_process($pathtoscan='')
|
||||
{
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
|
||||
if ($pathtoscan)
|
||||
{
|
||||
$listoffiles=dol_dir_list($pathtoscan,'files');
|
||||
foreach($listoffiles as $key => $val)
|
||||
{
|
||||
$listofpaths[]=$val['fullname'];
|
||||
$listofnames[]=$val['name'];
|
||||
$listofmimes[]=dol_mimetype($val['name']);
|
||||
}
|
||||
}
|
||||
$_SESSION["listofpaths"]=join(';',$listofpaths);
|
||||
$_SESSION["listofnames"]=join(';',$listofnames);
|
||||
$_SESSION["listofmimes"]=join(';',$listofmimes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get and save an upload file (for example after submitting a new file a mail form).
|
||||
* All information used are in db, conf, langs, user and _FILES.
|
||||
|
||||
@ -1500,213 +1500,161 @@ function dolibarr_trunc($string,$size=40,$trunc='right',$stringencoding='')
|
||||
|
||||
/**
|
||||
* Show a javascript graph
|
||||
* @param htmlid Html id name
|
||||
* @param width Width in pixel
|
||||
* @param height Height in pixel
|
||||
* @param data Data array
|
||||
* @param showlegend 1 to show legend, 0 otherwise
|
||||
* @param type Type of graph ('pie', 'barline')
|
||||
* @param showpercent Show percent (with type='pie' only)
|
||||
* @param url Param to add an url to click values
|
||||
*
|
||||
* @param string $htmlid Html id name
|
||||
* @param int $width Width in pixel
|
||||
* @param int $height Height in pixel
|
||||
* @param array $data Data array
|
||||
* @param int $showlegend 1 to show legend, 0 otherwise
|
||||
* @param string $type Type of graph ('pie', 'barline')
|
||||
* @param int $showpercent Show percent (with type='pie' only)
|
||||
* @param string $url Param to add an url to click values
|
||||
* @return void
|
||||
*/
|
||||
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $theme_datacolor; // To have var kept when function is called several times
|
||||
if (empty($conf->use_javascript_ajax)) return;
|
||||
$jsgraphlib='flot';
|
||||
$datacolor=array();
|
||||
|
||||
global $conf,$langs;
|
||||
global $theme_datacolor; // To have var kept when function is called several times
|
||||
if (empty($conf->use_javascript_ajax)) return;
|
||||
$jsgraphlib='flot';
|
||||
$datacolor=array();
|
||||
|
||||
// Load colors of theme into $datacolor array
|
||||
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
|
||||
if (is_readable($color_file))
|
||||
{
|
||||
include_once($color_file);
|
||||
if (isset($theme_datacolor))
|
||||
{
|
||||
$datacolor=array();
|
||||
foreach($theme_datacolor as $val)
|
||||
{
|
||||
$datacolor[]="#".sprintf("%02x",$val[0]).sprintf("%02x",$val[1]).sprintf("%02x",$val[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<div id="'.$htmlid.'" style="width:'.$width.'px;height:'.$height.'px;"></div>';
|
||||
|
||||
// We use Flot js lib
|
||||
if ($jsgraphlib == 'flot')
|
||||
{
|
||||
if ($type == 'pie')
|
||||
{
|
||||
// data is array('series'=>array(serie1,serie2,...),
|
||||
// 'seriestype'=>array('bar','line',...),
|
||||
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
|
||||
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
|
||||
// serieX is array('label'=>'label', values=>array(0=>val))
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
var data = ['."\n";
|
||||
$i=0;
|
||||
foreach($data['series'] as $serie)
|
||||
{
|
||||
//print '{ label: "'.($showlegend?$serie['values'][0]:$serie['label'].'<br>'.$serie['values'][0]).'", data: '.$serie['values'][0].' }';
|
||||
print '{ label: "'.dol_escape_js($serie['label']).'", data: '.$serie['values'][0].' }';
|
||||
if ($i < count($data['series'])) print ',';
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
print '];
|
||||
|
||||
function plotWithOptions() {
|
||||
jQuery.plot(jQuery("#'.$htmlid.'"), data,
|
||||
{
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 3/4,
|
||||
label: {
|
||||
show: true,
|
||||
radius: 3/4,
|
||||
formatter: function(label, series) {
|
||||
var percent=Math.round(series.percent);
|
||||
var number=series.data[0][1];
|
||||
return \'';
|
||||
print '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">';
|
||||
if ($url) print '<a style="color: #FFFFFF;" border="0" href="'.$url.'=">';
|
||||
print '\'+'.($showlegend?'number':'label+\'<br/>\'+number');
|
||||
if (! empty($showpercent)) print '+\'<br/>\'+percent+\'%\'';
|
||||
print '+\'';
|
||||
if ($url) print '</a>';
|
||||
print '</div>\';
|
||||
},
|
||||
background: {
|
||||
opacity: 0.5,
|
||||
color: \'#000000\'
|
||||
}
|
||||
}
|
||||
} },
|
||||
zoom: {
|
||||
interactive: true
|
||||
},
|
||||
pan: {
|
||||
interactive: true
|
||||
},
|
||||
';
|
||||
$i=0; $outputserie=0;
|
||||
if (count($datacolor))
|
||||
{
|
||||
print 'colors: [';
|
||||
foreach($datacolor as $val)
|
||||
{
|
||||
if ($outputserie > 0) print ',';
|
||||
print '"'.(empty($data['seriescolor'][$i])?$val:$data['seriescolor'][$i]).'"';
|
||||
$outputserie++;
|
||||
$i++;
|
||||
}
|
||||
print '], ';
|
||||
}
|
||||
print 'legend: {show: '.($showlegend?'true':'false').', position: \'ne\' }
|
||||
});
|
||||
}
|
||||
plotWithOptions();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else if ($type == 'barline')
|
||||
{
|
||||
// data is array('series'=>array(serie1,serie2,...),
|
||||
// 'seriestype'=>array('bar','line',...),
|
||||
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
|
||||
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
|
||||
// serieX is array('label'=>'label', values=>array(0=>y1,1=>y2,...)) with same nb of value than into xlabel
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
var data = [';
|
||||
$i=1; $outputserie=0;
|
||||
foreach($data['series'] as $serie)
|
||||
{
|
||||
if ($data['seriestype'][$i-1]=='line') { $i++; continue; };
|
||||
if ($outputserie > 0) print ',';
|
||||
print '{ bars: { stack: 0, show: true, barWidth: 0.9, align: \'center\' }, label: \''.dol_escape_js($serie['label']).'\', data: [';
|
||||
$j=1;
|
||||
foreach($serie['values'] as $val)
|
||||
{
|
||||
print '['.$j.','.$val.']';
|
||||
if ($j < count($serie['values'])) print ', ';
|
||||
$j++;
|
||||
}
|
||||
print ']}'."\n";
|
||||
$outputserie++;
|
||||
$i++;
|
||||
}
|
||||
if ($outputserie) print ', ';
|
||||
//print '];
|
||||
//var datalines = [';
|
||||
$i=1; $outputserie=0;
|
||||
foreach($data['series'] as $serie)
|
||||
{
|
||||
if (empty($data['seriestype'][$i-1]) || $data['seriestype'][$i-1]=='bar') { $i++; continue; };
|
||||
if ($outputserie > 0) print ',';
|
||||
print '{ lines: { show: true }, label: \''.dol_escape_js($serie['label']).'\', data: [';
|
||||
$j=1;
|
||||
foreach($serie['values'] as $val)
|
||||
{
|
||||
print '['.$j.','.$val.']';
|
||||
if ($j < count($serie['values'])) print ', ';
|
||||
$j++;
|
||||
}
|
||||
print ']}'."\n";
|
||||
$outputserie++;
|
||||
$i++;
|
||||
}
|
||||
print '];
|
||||
var dataticks = [';
|
||||
$i=1;
|
||||
foreach($data['xlabel'] as $label)
|
||||
{
|
||||
print '['.$i.',\''.$label.'\']';
|
||||
if ($i < count($data['xlabel'])) print ',';
|
||||
$i++;
|
||||
}
|
||||
print '];
|
||||
|
||||
function plotWithOptions() {
|
||||
jQuery.plot(jQuery("#'.$htmlid.'"), data,
|
||||
{
|
||||
series: {
|
||||
stack: 0
|
||||
},
|
||||
zoom: {
|
||||
interactive: true
|
||||
},
|
||||
pan: {
|
||||
interactive: true
|
||||
},
|
||||
';
|
||||
if (count($datacolor))
|
||||
{
|
||||
print 'colors: [';
|
||||
$j=0;
|
||||
foreach($datacolor as $val)
|
||||
{
|
||||
print '"'.$val.'"';
|
||||
if ($j < count($datacolor)) print ',';
|
||||
$j++;
|
||||
}
|
||||
print '], ';
|
||||
}
|
||||
print 'legend: {show: '.($showlegend?'true':'false').'},
|
||||
xaxis: {ticks: dataticks},
|
||||
});
|
||||
}
|
||||
plotWithOptions();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else print 'BadValueForPArameterType';
|
||||
}
|
||||
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
|
||||
if (is_readable($color_file))
|
||||
{
|
||||
include_once($color_file);
|
||||
if (isset($theme_datacolor))
|
||||
{
|
||||
$datacolor=array();
|
||||
foreach($theme_datacolor as $val)
|
||||
{
|
||||
$datacolor[]="#".sprintf("%02x",$val[0]).sprintf("%02x",$val[1]).sprintf("%02x",$val[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<div id="'.$htmlid.'" style="width:'.$width.'px;height:'.$height.'px;"></div>';
|
||||
|
||||
// We use Flot js lib
|
||||
if ($jsgraphlib == 'flot')
|
||||
{
|
||||
if ($type == 'pie')
|
||||
{
|
||||
// data is array('series'=>array(serie1,serie2,...),
|
||||
// 'seriestype'=>array('bar','line',...),
|
||||
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
|
||||
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
|
||||
// serieX is array('label'=>'label', data=>val)
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var data = '.json_encode($data['series']).';
|
||||
|
||||
function plotWithOptions() {
|
||||
$.plot($("#'.$htmlid.'"), data,
|
||||
{
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 3/4,
|
||||
label: {
|
||||
show: true,
|
||||
radius: 3/4,
|
||||
formatter: function(label, series) {
|
||||
var percent=Math.round(series.percent);
|
||||
var number=series.data[0][1];
|
||||
return \'';
|
||||
print '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">';
|
||||
if ($url) print '<a style="color: #FFFFFF;" border="0" href="'.$url.'=">';
|
||||
print '\'+'.($showlegend?'number':'label+\'<br/>\'+number');
|
||||
if (! empty($showpercent)) print '+\'<br/>\'+percent+\'%\'';
|
||||
print '+\'';
|
||||
if ($url) print '</a>';
|
||||
print '</div>\';
|
||||
},
|
||||
background: {
|
||||
opacity: 0.5,
|
||||
color: \'#000000\'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
zoom: {
|
||||
interactive: true
|
||||
},
|
||||
pan: {
|
||||
interactive: true
|
||||
},';
|
||||
if (count($datacolor))
|
||||
{
|
||||
print 'colors: '.(! empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)).',';
|
||||
}
|
||||
print 'legend: {show: '.($showlegend?'true':'false').', position: \'ne\' }
|
||||
});
|
||||
}
|
||||
plotWithOptions();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else if ($type == 'barline')
|
||||
{
|
||||
// data is array('series'=>array(serie1,serie2,...),
|
||||
// 'seriestype'=>array('bar','line',...),
|
||||
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
|
||||
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
|
||||
// serieX is array('label'=>'label', data=>array(0=>y1,1=>y2,...)) with same nb of value than into xlabel
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var data = [';
|
||||
$i=0; $outputserie=0;
|
||||
foreach($data['series'] as $serie)
|
||||
{
|
||||
if ($data['seriestype'][$i]=='line') { $i++; continue; };
|
||||
if ($outputserie > 0) print ',';
|
||||
print '{ bars: { stack: 0, show: true, barWidth: 0.9, align: \'center\' }, label: \''.dol_escape_js($serie['label']).'\', data: '.json_encode($serie['data']).'}'."\n";
|
||||
$outputserie++; $i++;
|
||||
}
|
||||
if ($outputserie) print ', ';
|
||||
//print '];
|
||||
//var datalines = [';
|
||||
$i=0; $outputserie=0;
|
||||
foreach($data['series'] as $serie)
|
||||
{
|
||||
if (empty($data['seriestype'][$i]) || $data['seriestype'][$i]=='bar') { $i++; continue; };
|
||||
if ($outputserie > 0) print ',';
|
||||
print '{ lines: { show: true }, label: \''.dol_escape_js($serie['label']).'\', data: '.json_encode($serie['data']).'}'."\n";
|
||||
$outputserie++; $i++;
|
||||
}
|
||||
print '];
|
||||
var dataticks = '.json_encode($data['xlabel']).'
|
||||
|
||||
function plotWithOptions() {
|
||||
$.plot(jQuery("#'.$htmlid.'"), data,
|
||||
{
|
||||
series: {
|
||||
stack: 0
|
||||
},
|
||||
zoom: {
|
||||
interactive: true
|
||||
},
|
||||
pan: {
|
||||
interactive: true
|
||||
},';
|
||||
if (count($datacolor))
|
||||
{
|
||||
print 'colors: '.json_encode($datacolor).',';
|
||||
}
|
||||
print 'legend: {show: '.($showlegend?'true':'false').'},
|
||||
xaxis: {ticks: dataticks}
|
||||
});
|
||||
}
|
||||
plotWithOptions();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else print 'BadValueForPArameterType';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -47,6 +47,14 @@
|
||||
<input type="hidden" name="action" value="addline">
|
||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#idprod').change(function() {
|
||||
jQuery('#np_desc').focus();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<tr <?php echo $bcnd[$var]; ?>>
|
||||
<td colspan="3">
|
||||
<?php
|
||||
|
||||
@ -118,7 +118,7 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
foreach (array(0,1,2,3,4,5,6) as $statut)
|
||||
{
|
||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'values'=>array(0=>(isset($vals[$statut])?$vals[$statut]:0)));
|
||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'data'=>(isset($vals[$statut])?$vals[$statut]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
@ -650,7 +650,7 @@ if (! $error && $db->connected && $action == "set")
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
function jsinfo()
|
||||
{
|
||||
ok=true;
|
||||
|
||||
@ -430,7 +430,7 @@ if (! empty($force_install_message))
|
||||
|
||||
</table>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_needroot()
|
||||
{
|
||||
|
||||
@ -97,6 +97,7 @@ ErrorFailedToChangePassword=Failed to change password
|
||||
ErrorLoginDoesNotExists=User with login <b>%s</b> could not be found.
|
||||
ErrorLoginHasNoEmail=This user has no email address. Process aborted.
|
||||
ErrorBadValueForCode=Bad value for security code. Try again with new value...
|
||||
ErrorBothFieldCantBeNegative=Fields %s and %s can't be both negative
|
||||
|
||||
# Warnings
|
||||
WarningSafeModeOnCheckExecDir=Warning, PHP option <b>safe_mode</b> is on so command must be stored inside a directory declared by php parameter <b>safe_mode_exec_dir</b>.
|
||||
|
||||
@ -98,6 +98,7 @@ ErrorFailedToChangePassword=Échec de modification du mot de passe
|
||||
ErrorLoginDoesNotExists=Le compte utilisateur de login <b>%s</b> n'a pu être trouvé.
|
||||
ErrorLoginHasNoEmail=Cet utilisateur n'a pas d'email. Impossible de continuer.
|
||||
ErrorBadValueForCode=Mauvaise valeur saisie pour le code. Réessayez avec une nouvelle valeur...
|
||||
ErrorBothFieldCantBeNegative=Les champs %s et %s ne peuvent être tous deux négatifs
|
||||
|
||||
# Warnings
|
||||
WarningSafeModeOnCheckExecDir=Attention, l'option PHP <b>safe_mode</b> est active, la commande doit dont être dans un répertoire déclaré dans le paramètre php <b>safe_mode_exec_dir</b>.
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -34,18 +34,17 @@ $langs->load("products");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
|
||||
$mode=isset($_GET["mode"])?$_GET["mode"]:'byunit';
|
||||
$error=0;
|
||||
$mesg='';
|
||||
$id = GETPOST('id');
|
||||
$ref = GETPOST('ref');
|
||||
$mode = (GETPOST('mode') ? GETPOST('mode') : 'byunit');
|
||||
$error = 0;
|
||||
$mesg = '';
|
||||
|
||||
// Security check
|
||||
if (isset($_GET["id"]) || isset($_GET["ref"]))
|
||||
{
|
||||
$id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:'');
|
||||
}
|
||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
$fieldid = (! empty($id) ? $id : $ref);
|
||||
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
|
||||
$result=restrictedArea($user,'produit|service',$fieldid,'product','','',$fieldtype);
|
||||
|
||||
|
||||
/*
|
||||
@ -53,19 +52,18 @@ $result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
|
||||
*/
|
||||
$form = new Form($db);
|
||||
|
||||
if ($_GET["id"] || $_GET["ref"])
|
||||
if (! empty($id) || ! empty($ref))
|
||||
{
|
||||
$product = new Product($db);
|
||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||
$object = new Product($db);
|
||||
$result = $object->fetch($id,$ref);
|
||||
|
||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||
llxHeader("","",$langs->trans("CardProduct".$object->type));
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$head=product_prepare_head($product, $user);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type==1?'service':'product');
|
||||
$head=product_prepare_head($object, $user);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type==1?'service':'product');
|
||||
dol_fiche_head($head, 'stats', $titre, 0, $picto);
|
||||
|
||||
|
||||
@ -74,34 +72,34 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
// Reference
|
||||
print '<tr>';
|
||||
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($product,'ref','',1,'ref');
|
||||
print $form->showrefnav($object,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->libelle.'</td></tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td>';
|
||||
print $product->getLibStatut(2,0);
|
||||
print $object->getLibStatut(2,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>';
|
||||
print $product->getLibStatut(2,1);
|
||||
print $object->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Graphs additionels generes pas le script product-graph.php
|
||||
$year = strftime('%Y',time());
|
||||
$file = get_exdir($product->id, 3) . "ventes-".$year."-".$product->id.".png";
|
||||
$file = get_exdir($object->id, 3) . "ventes-".$year."-".$object->id.".png";
|
||||
if (file_exists (DOL_DATA_ROOT.'/product/temp/'.$file) )
|
||||
{
|
||||
print '<tr><td>Ventes</td><td>';
|
||||
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_product&file='.$file;
|
||||
print '<img src="'.$url.'" alt="Ventes">';
|
||||
$file = get_exdir($product->id, 3) . "ventes-".$product->id.".png";
|
||||
$file = get_exdir($object->id, 3) . "ventes-".$object->id.".png";
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_product&file='.$file;
|
||||
print '<img src="'.$url.'" alt="Ventes">';
|
||||
print '</td></tr>';
|
||||
@ -113,12 +111,12 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
|
||||
|
||||
// Choice of stats
|
||||
if ($mode == 'bynumber') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'&mode=byunit">';
|
||||
if ($mode == 'bynumber') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mode=byunit">';
|
||||
else print img_picto('','tick').' ';
|
||||
print $langs->trans("StatsByNumberOfUnits");
|
||||
if ($mode == 'bynumber') print '</a>';
|
||||
print ' ';
|
||||
if ($mode == 'byunit') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'&mode=bynumber">';
|
||||
if ($mode == 'byunit') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mode=bynumber">';
|
||||
else print img_picto('','tick').' ';
|
||||
print $langs->trans("StatsByNumberOfEntities");
|
||||
if ($mode == 'byunit') print '</a>';
|
||||
@ -131,9 +129,9 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$WIDTH=380;
|
||||
$HEIGHT=160;
|
||||
$dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp);
|
||||
if (! file_exists($dir.'/'.$product->id))
|
||||
if (! file_exists($dir.'/'.$object->id))
|
||||
{
|
||||
if (dol_mkdir($dir.'/'.$product->id) < 0)
|
||||
if (dol_mkdir($dir.'/'.$object->id) < 0)
|
||||
{
|
||||
$mesg = $langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
$error++;
|
||||
@ -142,20 +140,20 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
|
||||
$graphfiles=array(
|
||||
'propal' =>array('modulepart'=>'productstats_proposals',
|
||||
'file' => $product->id.'/propal12m.png',
|
||||
'file' => $object->id.'/propal12m.png',
|
||||
'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsProposals"):$langs->trans("NumberOfProposals"))),
|
||||
'orders' =>array('modulepart'=>'productstats_orders',
|
||||
'file' => $product->id.'/orders12m.png',
|
||||
'file' => $object->id.'/orders12m.png',
|
||||
'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsCustomerOrders"):$langs->trans("NumberOfCustomerOrders"))),
|
||||
'invoices' =>array('modulepart'=>'productstats_invoices',
|
||||
'file' => $product->id.'/invoices12m.png',
|
||||
'file' => $object->id.'/invoices12m.png',
|
||||
'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsCustomerInvoices"):$langs->trans("NumberOfCustomerInvoices"))),
|
||||
'invoicessuppliers'=>array('modulepart'=>'productstats_invoicessuppliers',
|
||||
'file' => $product->id.'/invoicessuppliers12m.png',
|
||||
'file' => $object->id.'/invoicessuppliers12m.png',
|
||||
'label' => ($mode=='byunit'?$langs->trans("NumberOfUnitsSupplierInvoices"):$langs->trans("NumberOfSupplierInvoices"))),
|
||||
|
||||
// 'orderssuppliers' =>array('modulepart'=>'productstats_orderssuppliers', 'file' => $product->id.'/orderssuppliers12m.png', 'label' => $langs->trans("Nombre commande fournisseurs sur les 12 derniers mois")),
|
||||
// 'contracts' =>array('modulepart'=>'productstats_contracts', 'file' => $product->id.'/contracts12m.png', 'label' => $langs->trans("Nombre contrats sur les 12 derniers mois")),
|
||||
// 'orderssuppliers' =>array('modulepart'=>'productstats_orderssuppliers', 'file' => $object->id.'/orderssuppliers12m.png', 'label' => $langs->trans("Nombre commande fournisseurs sur les 12 derniers mois")),
|
||||
// 'contracts' =>array('modulepart'=>'productstats_contracts', 'file' => $object->id.'/contracts12m.png', 'label' => $langs->trans("Nombre contrats sur les 12 derniers mois")),
|
||||
|
||||
);
|
||||
|
||||
@ -173,10 +171,10 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$graph_data = array();
|
||||
|
||||
// TODO Test si deja existant et recent, on ne genere pas
|
||||
if ($key == 'propal') $graph_data = $product->get_nb_propal($socid,$mode);
|
||||
if ($key == 'orders') $graph_data = $product->get_nb_order($socid,$mode);
|
||||
if ($key == 'invoices') $graph_data = $product->get_nb_vente($socid,$mode);
|
||||
if ($key == 'invoicessuppliers') $graph_data = $product->get_nb_achat($socid,$mode);
|
||||
if ($key == 'propal') $graph_data = $object->get_nb_propal($socid,$mode);
|
||||
if ($key == 'orders') $graph_data = $object->get_nb_order($socid,$mode);
|
||||
if ($key == 'invoices') $graph_data = $object->get_nb_vente($socid,$mode);
|
||||
if ($key == 'invoicessuppliers') $graph_data = $object->get_nb_achat($socid,$mode);
|
||||
if (is_array($graph_data))
|
||||
{
|
||||
$px->SetData($graph_data);
|
||||
@ -193,7 +191,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,'Error for calculating graph on key='.$key.' - '.$product->error);
|
||||
dol_print_error($db,'Error for calculating graph on key='.$key.' - '.$object->error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +238,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
print '<td>'.($mesg?'<font class="error">'.$mesg.'</font>':$langs->trans("ChartNotGenerated")).'</td>';
|
||||
}
|
||||
print '<td align="center"><a href="fiche.php?id='.$product->id.'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'</a></td>';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'</a></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -108,9 +108,9 @@ if ($conf->use_javascript_ajax && ((round($third['prospect'])?1:0)+(round($third
|
||||
{
|
||||
print '<tr><td align="center">';
|
||||
$dataseries=array();
|
||||
if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'values'=>array(round($third['prospect'])));
|
||||
if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'values'=>array(round($third['customer'])));
|
||||
if ($conf->fournisseur->enabled && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Suppliers"),'values'=>array(round($third['supplier'])));
|
||||
if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array('label'=>$langs->trans("Prospects"),'data'=>round($third['prospect']));
|
||||
if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Customers"),'data'=>round($third['customer']));
|
||||
if ($conf->fournisseur->enabled && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array('label'=>$langs->trans("Suppliers"),'data'=>round($third['supplier']));
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',0);
|
||||
print '</td></tr>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user