Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/societe/list.php
This commit is contained in:
Laurent Destailleur 2017-08-24 14:26:45 +02:00
commit 4337001418
8 changed files with 303 additions and 275 deletions

View File

@ -114,7 +114,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($company->error);
setEventMessages($company->error, $company->errors, 'errors'); setEventMessages($company->error, $company->errors, 'errors');
} }
else else
@ -124,7 +123,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
} }
else else
{ {
$errmsg=$object->error; setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -212,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]); $paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
} }
$subscription=$_POST["subscription"]; // Amount of subscription $subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
$label=$_POST["label"]; $label=$_POST["label"];
// Payment informations // Payment informations
@ -230,6 +229,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription")); $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
if (GETPOST('end') && ! $datesubend) if (GETPOST('end') && ! $datesubend)
@ -237,6 +237,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription")); $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
if (! $datesubend) if (! $datesubend)
@ -247,16 +248,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")); $errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
$amount = price2num(GETPOST("subscription",'alpha'));
// Check if a payment is mandatory or not // Check if a payment is mandatory or not
if (! $error && $adht->subscription) // Member type need subscriptions if (! $error && $adht->subscription) // Member type need subscriptions
{ {
if (! is_numeric($_POST["subscription"])) if (! is_numeric($amount))
{ {
// If field is '' or not a numeric value // If field is '' or not a numeric value
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
$action='addsubscription'; $action='addsubscription';
} }
@ -274,7 +279,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount"); if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
} }
if ($errmsg) $action='addsubscription'; if ($errmsg)
{
setEventMessages($errmsg, null, 'errors');
$action='addsubscription';
}
} }
} }
} }
@ -320,6 +329,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg=$db->lasterror(); $errmsg=$db->lasterror();
setEventMessages($errmsg, null, 'errors');
} }
} }
else else
@ -327,6 +337,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$errmsg=$acct->error; $errmsg=$acct->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
} }
} }
else else
@ -334,6 +345,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$errmsg=$acct->error; $errmsg=$acct->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
} }
} }
@ -352,6 +364,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); $errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
} }
} }
@ -362,6 +375,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$customer->error; $errmsg=$customer->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -379,6 +393,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg='ErrorNoPaymentTermRECEPFound'; $errmsg='ErrorNoPaymentTermRECEPFound';
setEventMessages($errmsg, null, 'errors');
} }
} }
$invoice->socid=$object->fk_soc; $invoice->socid=$object->fk_soc;
@ -396,6 +411,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
$errmsgs=$invoice->errors; $errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -416,6 +432,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result <= 0) if ($result <= 0)
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
} }
} }
@ -428,6 +445,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
$errmsgs=$invoice->errors; $errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -455,6 +473,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;
$errmsgs=$paiement->errors; $errmsgs=$paiement->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
@ -536,6 +555,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0) if ($result < 0)
{ {
$errmsg=$object->error; $errmsg=$object->error;
setEventMessages($errmsg, null, 'errors');
} }
} }

View File

@ -154,6 +154,7 @@ if (empty($reshook))
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
{ {
$search_product_category=0;
$search_name=""; $search_name="";
$search_contract=""; $search_contract="";
$search_service=""; $search_service="";
@ -176,6 +177,8 @@ if (empty($reshook))
$filter_opcloture=""; $filter_opcloture="";
$mode=''; $mode='';
$filter=''; $filter='';
$toselect='';
$search_array_options=array();
} }
} }

View File

@ -97,267 +97,6 @@ class box_activity extends ModeleBoxes
$cumuldata = array(); $cumuldata = array();
// list the summary of the bills
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic=new Facture($db);
// part 1
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array();
if ($refresh)
{
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$j++;
}
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
dol_filecache($cachedir, $filename, $data);
}
$db->free($result);
} else {
dol_print_error($db);
}
} else {
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
$billurl="viewstatut=2&amp;paye=1&amp;year=".$data[$j]->annee;
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
'logo' => 'bill',
);
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
);
$this->info_box_contents[$line][2] = array(
'td' => 'class="right"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'text' => $data[$j]->nb,
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
);
$this->info_box_contents[$line][3] = array(
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
);
// We add only for the current year
if ($data[$j]->annee == date("Y")) {
$totalnb += $data[$j]->nb;
$totalMnt += $data[$j]->Mnttot;
}
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
);
$line++;
$j++;
}
if (count($data)==0)
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
}
// part 2
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice2'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
if ($refresh) {
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND paye=0";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$j++;
}
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
dol_filecache($cachedir, $filename, $data);
}
$db->free($result);
} else {
dol_print_error($db);
}
} else {
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
$billurl="viewstatut=".$data[$j]->fk_statut."&amp;paye=0";
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
'logo' => 'bill',
);
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
);
$this->info_box_contents[$line][2] = array(
'td' => 'class="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
);
$totalnb += $data[$j]->nb;
$this->info_box_contents[$line][3] = array(
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $objp->Mnttot;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
);
$line++;
$j++;
}
if ($num==0)
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
);
}
}
// list the summary of the orders
if (! empty($conf->commande->enabled) && $user->rights->commande->lire) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic=new Commande($db);
$cachedir = DOL_DATA_ROOT.'/commande/temp';
$filename = '/boxactivity-order'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array();
if ($refresh) {
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE c.entity = ".$conf->entity;
$sql.= " AND c.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'";
$sql.= " AND c.facture=0";
$sql.= " GROUP BY c.fk_statut";
$sql.= " ORDER BY c.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$j++;
}
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
dol_filecache($cachedir, $filename, $data);
}
$db->free($result);
} else {
dol_print_error($db);
}
} else {
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
'logo' => 'object_order',
);
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' =>$langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
);
$this->info_box_contents[$line][2] = array(
'td' => 'class="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=".$data[$j]->fk_statut,
);
$totalnb += $data[$j]->nb;
$this->info_box_contents[$line][3] = array(
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
);
$line++;
$j++;
}
}
}
// list the summary of the propals // list the summary of the propals
if (! empty($conf->propal->enabled) && $user->rights->propale->lire) if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
@ -449,6 +188,267 @@ class box_activity extends ModeleBoxes
} }
} }
// list the summary of the orders
if (! empty($conf->commande->enabled) && $user->rights->commande->lire) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic=new Commande($db);
$cachedir = DOL_DATA_ROOT.'/commande/temp';
$filename = '/boxactivity-order'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array();
if ($refresh) {
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE c.entity = ".$conf->entity;
$sql.= " AND c.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'";
$sql.= " GROUP BY c.fk_statut";
$sql.= " ORDER BY c.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$j++;
}
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
dol_filecache($cachedir, $filename, $data);
}
$db->free($result);
} else {
dol_print_error($db);
}
} else {
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=".$data[$j]->fk_statut,
'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
'logo' => 'object_order',
);
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' =>$langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
);
$this->info_box_contents[$line][2] = array(
'td' => 'class="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=".$data[$j]->fk_statut,
);
$totalnb += $data[$j]->nb;
$this->info_box_contents[$line][3] = array(
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
);
$line++;
$j++;
}
}
}
// list the summary of the bills
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic=new Facture($db);
// part 1
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array();
if ($refresh)
{
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$j++;
}
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
dol_filecache($cachedir, $filename, $data);
}
$db->free($result);
} else {
dol_print_error($db);
}
} else {
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
$billurl="search_status=2&amp;paye=1&amp;year=".$data[$j]->annee;
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
'logo' => 'bill',
);
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
);
$this->info_box_contents[$line][2] = array(
'td' => 'class="right"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
'text' => $data[$j]->nb,
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
);
$this->info_box_contents[$line][3] = array(
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
);
// We add only for the current year
if ($data[$j]->annee == date("Y")) {
$totalnb += $data[$j]->nb;
$totalMnt += $data[$j]->Mnttot;
}
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
);
$line++;
$j++;
}
if (count($data)==0)
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
}
// part 2
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice2'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
if ($refresh) {
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND paye=0";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$j=0;
while ($j < $num) {
$data[$j]=$db->fetch_object($result);
$j++;
}
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
dol_filecache($cachedir, $filename, $data);
}
$db->free($result);
} else {
dol_print_error($db);
}
} else {
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
$billurl="search_status=".$data[$j]->fk_statut."&amp;paye=0";
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
'logo' => 'bill',
);
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
);
$this->info_box_contents[$line][2] = array(
'td' => 'class="right"',
'text' => $data[$j]->nb,
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&amp;mainmenu=accountancy&amp;leftmenu=customers_bills",
);
$totalnb += $data[$j]->nb;
$this->info_box_contents[$line][3] = array(
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $objp->Mnttot;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
);
$line++;
$j++;
}
if ($num==0)
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
);
}
}
// Add the sum in the bottom of the boxes // Add the sum in the bottom of the boxes
$this->info_box_contents[$line][0] = array('tr' => 'class="liste_total"'); $this->info_box_contents[$line][0] = array('tr' => 'class="liste_total"');
$this->info_box_contents[$line][1] = array('td' => 'align="left" class="liste_total" ', 'text' => $langs->trans("Total")."&nbsp;".$textHead); $this->info_box_contents[$line][1] = array('td' => 'align="left" class="liste_total" ', 'text' => $langs->trans("Total")."&nbsp;".$textHead);

View File

@ -473,7 +473,7 @@ class FormMail extends Form
$out.= ' &lt;'.$this->tomail.'&gt;'; $out.= ' &lt;'.$this->tomail.'&gt;';
if ($this->withtofree) if ($this->withtofree)
{ {
$out.= '<br>'.$langs->trans("or").' <input size="'.(is_array($this->withto)?"30":"60").'" id="sendto" name="sendto" value="'.(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"").'" />'; $out.= '<br>'.$langs->trans("and").' <input size="'.(is_array($this->withto)?"30":"60").'" id="sendto" name="sendto" value="'.(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"").'" />';
} }
} }
else else
@ -489,7 +489,7 @@ class FormMail extends Form
} }
if (! empty($this->withto) && is_array($this->withto)) if (! empty($this->withto) && is_array($this->withto))
{ {
if (! empty($this->withtofree)) $out.= " ".$langs->trans("or")." "; if (! empty($this->withtofree)) $out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time // multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withto; $tmparray = $this->withto;
foreach($tmparray as $key => $val) foreach($tmparray as $key => $val)
@ -522,7 +522,7 @@ class FormMail extends Form
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />'; $out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
if (! empty($this->withtocc) && is_array($this->withtocc)) if (! empty($this->withtocc) && is_array($this->withtocc))
{ {
$out.= " ".$langs->trans("or")." "; $out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time // multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withtocc; $tmparray = $this->withtocc;
foreach($tmparray as $key => $val) foreach($tmparray as $key => $val)
@ -551,7 +551,7 @@ class FormMail extends Form
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />'; $out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
if (! empty($this->withtoccc) && is_array($this->withtoccc)) if (! empty($this->withtoccc) && is_array($this->withtoccc))
{ {
$out.= " ".$langs->trans("or")." "; $out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time // multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withtoccc; $tmparray = $this->withtoccc;
foreach($tmparray as $key => $val) foreach($tmparray as $key => $val)

View File

@ -154,7 +154,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF'
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', NULL, 1, 'Franc pacifique (XPF)'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', '[70]', 1, 'Franc CFP');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar');

View File

@ -169,12 +169,12 @@ class Productcustomerprice extends CommonObject
$sql .= " " . (empty($this->price_min_ttc) ? '0' : "'" . $this->price_min_ttc . "'") . ","; $sql .= " " . (empty($this->price_min_ttc) ? '0' : "'" . $this->price_min_ttc . "'") . ",";
$sql .= " " . (! isset($this->price_base_type) ? 'NULL' : "'" . $this->db->escape($this->price_base_type) . "'") . ","; $sql .= " " . (! isset($this->price_base_type) ? 'NULL' : "'" . $this->db->escape($this->price_base_type) . "'") . ",";
$sql .= " ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").","; $sql .= " ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").",";
$sql .= " " . (! isset($this->tva_tx) ? 'NULL' : "'" . $this->tva_tx . "'") . ","; $sql .= " " . (! isset($this->tva_tx) ? 'NULL' : (empty($this->tva_tx)?0:$this->tva_tx)) . ",";
$sql .= " " . (! isset($this->recuperableonly) ? 'NULL' : "'" . $this->recuperableonly . "'") . ","; $sql .= " " . (! isset($this->recuperableonly) ? 'NULL' : "'" . $this->recuperableonly . "'") . ",";
$sql .= " " . (empty($this->localtax1_type) ? "'0'" : "'" . $this->localtax1_type . "'") . ","; $sql .= " " . (empty($this->localtax1_type) ? "'0'" : "'" . $this->localtax1_type . "'") . ",";
$sql .= " " . (! isset($this->localtax1_tx) ? 'NULL' : "'" . $this->localtax1_tx . "'") . ","; $sql .= " " . (! isset($this->localtax1_tx) ? 'NULL' : (empty($this->localtax1_tx)?0:$this->localtax1_tx)) . ",";
$sql .= " " . (empty($this->localtax2_type) ? "'0'" : "'" . $this->localtax2_type . "'") . ","; $sql .= " " . (empty($this->localtax2_type) ? "'0'" : "'" . $this->localtax2_type . "'") . ",";
$sql .= " " . (! isset($this->localtax2_tx) ? 'NULL' : "'" . $this->localtax2_tx . "'") . ","; $sql .= " " . (! isset($this->localtax2_tx) ? 'NULL' : (empty($this->localtax2_tx)?0:$this->localtax2_tx)) . ",";
$sql .= " " . $user->id . ","; $sql .= " " . $user->id . ",";
$sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ""; $sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . "";
$sql .= ")"; $sql .= ")";
@ -656,10 +656,10 @@ class Productcustomerprice extends CommonObject
$sql .= " price_min_ttc=" . (isset($this->price_min_ttc) ? $this->price_min_ttc : "null") . ","; $sql .= " price_min_ttc=" . (isset($this->price_min_ttc) ? $this->price_min_ttc : "null") . ",";
$sql .= " price_base_type=" . (isset($this->price_base_type) ? "'" . $this->db->escape($this->price_base_type) . "'" : "null") . ","; $sql .= " price_base_type=" . (isset($this->price_base_type) ? "'" . $this->db->escape($this->price_base_type) . "'" : "null") . ",";
$sql .= " default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").","; $sql .= " default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").",";
$sql .= " tva_tx=" . (isset($this->tva_tx) ? $this->tva_tx : "null") . ","; $sql .= " tva_tx=" . (isset($this->tva_tx) ? (empty($this->tva_tx)?0:$this->tva_tx) : "null") . ",";
$sql .= " recuperableonly=" . (isset($this->recuperableonly) ? $this->recuperableonly : "null") . ","; $sql .= " recuperableonly=" . (isset($this->recuperableonly) ? $this->recuperableonly : "null") . ",";
$sql .= " localtax1_tx=" . (isset($this->localtax1_tx) ? $this->localtax1_tx : "null") . ","; $sql .= " localtax1_tx=" . (isset($this->localtax1_tx) ? (empty($this->localtax1_tx)?0:$this->localtax1_tx) : "null") . ",";
$sql .= " localtax2_tx=" . (isset($this->localtax2_tx) ? $this->localtax2_tx : "null") . ","; $sql .= " localtax2_tx=" . (isset($this->localtax2_tx) ? (empty($this->localtax2_tx)?0:$this->localtax2_tx) : "null") . ",";
$sql .= " localtax1_type=" . (! empty($this->localtax1_type) ? "'".$this->localtax1_type."'": "'0'") . ","; $sql .= " localtax1_type=" . (! empty($this->localtax1_type) ? "'".$this->localtax1_type."'": "'0'") . ",";
$sql .= " localtax2_type=" . (! empty($this->localtax2_type) ? "'".$this->localtax2_type."'": "'0'") . ","; $sql .= " localtax2_type=" . (! empty($this->localtax2_type) ? "'".$this->localtax2_type."'": "'0'") . ",";
$sql .= " fk_user=" . $user->id . ","; $sql .= " fk_user=" . $user->id . ",";

View File

@ -168,12 +168,17 @@ if (empty($reshook))
} }
// Merge extrafields // Merge extrafields
if (is_array($soc_origin->array_options))
{
foreach ($soc_origin->array_options as $key => $val) foreach ($soc_origin->array_options as $key => $val)
{ {
if (empty($object->array_options[$key])) $object->array_options[$key] = $val; if (empty($object->array_options[$key])) $object->array_options[$key] = $val;
} }
}
// TODO Merge categories // TODO Merge categories
$object->update($object->id, $user); $object->update($object->id, $user);
// Move links // Move links

View File

@ -601,28 +601,28 @@ if ($search_all)
// Filter on categories // Filter on categories
$moreforfilter=''; $moreforfilter='';
//if ($type == 'c' || $type == 'p') if (empty($type) || $type == 'c' || $type == 'p')
//{ {
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
{ {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ' ('.$langs->trans("Customer").'): '; $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter.=$formother->select_categories('customer',$search_categ_cus,'search_categ_cus',1); $moreforfilter.=$formother->select_categories('customer',$search_categ_cus,'search_categ_cus',1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
//} }
//if ($type == 'f') if (empty($type) || $type == 'f')
//{ {
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
{ {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ' ('.$langs->trans("Supplier").'): '; $moreforfilter.=$langs->trans('SuppliersCategoriesShort').': ';
$moreforfilter.=$formother->select_categories('supplier',$search_categ_sup,'search_categ_sup',1); $moreforfilter.=$formother->select_categories('supplier',$search_categ_sup,'search_categ_sup',1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
//} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)