';
print '';
@@ -431,7 +431,7 @@ if ($object->id > 0)
if ($object->client)
{
- if (! empty($conf->commande->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
+ if (!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
{
print ''."\n";
print '
';
}
// Preferred shipping Method
- if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
+ if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
print '
';
print '| ';
print $langs->trans('SendingMethod');
@@ -489,32 +489,32 @@ if ($object->id > 0)
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
$langs->load("categories");
- print ' | | ' . $langs->trans("CustomersCategoriesShort") . ' | ';
+ print ' | '.$langs->trans("CustomersCategoriesShort").' | ';
print '';
print $form->showCategories($object->id, 'customer', 1);
print " | ";
}
// Other attributes
- $parameters=array('socid'=>$object->id);
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+ $parameters = array('socid'=>$object->id);
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Sales representative
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
// Module Adherent
- if (! empty($conf->adherent->enabled))
+ if (!empty($conf->adherent->enabled))
{
$langs->load("members");
$langs->load("users");
print '| '.$langs->trans("LinkedToDolibarrMember").' | ';
print '';
- $adh=new Adherent($db);
- $result=$adh->fetch('', '', $object->id);
+ $adh = new Adherent($db);
+ $result = $adh->fetch('', '', $object->id);
if ($result > 0)
{
- $adh->ref=$adh->getFullName($langs);
+ $adh->ref = $adh->getFullName($langs);
print $adh->getNomUrl(1);
}
else
@@ -558,10 +558,10 @@ if ($object->id > 0)
print ' | | '.$langs->trans("StatusProsp").' | '.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
print ' ';
print '';
- foreach($object->cacheprospectstatus as $key => $val)
+ foreach ($object->cacheprospectstatus as $key => $val)
{
- $titlealt='default';
- if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
+ $titlealt = 'default';
+ if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
if ($object->stcomm_id != $val['id']) print ' id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'';
}
print ' | ';
@@ -574,65 +574,65 @@ if ($object->id > 0)
$boxstat = '';
// Nbre max d'elements des petites listes
- $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
+ $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
// Lien recap
- $boxstat.='';
- $boxstat.=' ';
- $boxstat.='';
+ $boxstat .= '';
+ $boxstat .= ' ';
+ $boxstat .= '| ';
- if (! empty($conf->propal->enabled))
+ if (!empty($conf->propal->enabled))
{
// Box proposals
$tmp = $object->getOutstandingProposals();
- $outstandingOpened=$tmp['opened'];
- $outstandingTotal=$tmp['total_ht'];
- $outstandingTotalIncTax=$tmp['total_ttc'];
- $text=$langs->trans("OverAllProposals");
- $link=DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id;
- $icon='bill';
- if ($link) $boxstat.='';
- $boxstat.=' ';
- $boxstat.=''.img_object("", $icon).' '.$text.' ';
- $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'';
- $boxstat.=' ';
- if ($link) $boxstat.='';
+ $outstandingOpened = $tmp['opened'];
+ $outstandingTotal = $tmp['total_ht'];
+ $outstandingTotalIncTax = $tmp['total_ttc'];
+ $text = $langs->trans("OverAllProposals");
+ $link = DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id;
+ $icon = 'bill';
+ if ($link) $boxstat .= '';
+ $boxstat .= '';
+ $boxstat .= ''.img_object("", $icon).' '.$text.' ';
+ $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'';
+ $boxstat .= ' ';
+ if ($link) $boxstat .= '';
}
- if (! empty($conf->commande->enabled))
+ if (!empty($conf->commande->enabled))
{
// Box commandes
$tmp = $object->getOutstandingOrders();
- $outstandingOpened=$tmp['opened'];
- $outstandingTotal=$tmp['total_ht'];
- $outstandingTotalIncTax=$tmp['total_ttc'];
- $text=$langs->trans("OverAllOrders");
- $link=DOL_URL_ROOT.'/commande/list.php?socid='.$object->id;
- $icon='bill';
- if ($link) $boxstat.='';
- $boxstat.='';
- $boxstat.=''.img_object("", $icon).' '.$text.' ';
- $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'';
- $boxstat.=' ';
- if ($link) $boxstat.='';
+ $outstandingOpened = $tmp['opened'];
+ $outstandingTotal = $tmp['total_ht'];
+ $outstandingTotalIncTax = $tmp['total_ttc'];
+ $text = $langs->trans("OverAllOrders");
+ $link = DOL_URL_ROOT.'/commande/list.php?socid='.$object->id;
+ $icon = 'bill';
+ if ($link) $boxstat .= '';
+ $boxstat .= '';
+ $boxstat .= ''.img_object("", $icon).' '.$text.' ';
+ $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'';
+ $boxstat .= ' ';
+ if ($link) $boxstat .= '';
}
- if (! empty($conf->facture->enabled))
+ if (!empty($conf->facture->enabled))
{
// Box factures
$tmp = $object->getOutstandingBills();
- $outstandingOpened=$tmp['opened'];
- $outstandingTotal=$tmp['total_ht'];
- $outstandingTotalIncTax=$tmp['total_ttc'];
- $text=$langs->trans("OverAllInvoices");
- $link=DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
- $icon='bill';
- if ($link) $boxstat.='';
- $boxstat.='';
- $boxstat.=''.img_object("", $icon).' '.$text.' ';
- $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'';
- $boxstat.=' ';
- if ($link) $boxstat.='';
+ $outstandingOpened = $tmp['opened'];
+ $outstandingTotal = $tmp['total_ht'];
+ $outstandingTotalIncTax = $tmp['total_ttc'];
+ $text = $langs->trans("OverAllInvoices");
+ $link = DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
+ $icon = 'bill';
+ if ($link) $boxstat .= '';
+ $boxstat .= '';
+ $boxstat .= ''.img_object("", $icon).' '.$text.' ';
+ $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'';
+ $boxstat .= ' ';
+ if ($link) $boxstat .= '';
// Box outstanding bill
$warn = '';
@@ -640,50 +640,50 @@ if ($object->id > 0)
{
$warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
}
- $text=$langs->trans("CurrentOutstandingBill");
- $link=DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
- $icon='bill';
- if ($link) $boxstat.='';
- $boxstat.='';
- $boxstat.=''.img_object("", $icon).' '.$text.' ';
- $boxstat.=''.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'';
- $boxstat.=' ';
- if ($link) $boxstat.='';
+ $text = $langs->trans("CurrentOutstandingBill");
+ $link = DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
+ $icon = 'bill';
+ if ($link) $boxstat .= '';
+ $boxstat .= '';
+ $boxstat .= ''.img_object("", $icon).' '.$text.' ';
+ $boxstat .= ''.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'';
+ $boxstat .= ' ';
+ if ($link) $boxstat .= '';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreBoxStatsCustomer', $parameters, $object, $action);
- if(empty($reshook)){
- $boxstat.= $hookmanager->resPrint;
+ if (empty($reshook)) {
+ $boxstat .= $hookmanager->resPrint;
}
- $boxstat.=' | ';
- $boxstat.=' ';
- $boxstat.=' ';
+ $boxstat .= ' | ';
+ $boxstat .= ' ';
+ $boxstat .= ' ';
print $boxstat;
- $now=dol_now();
+ $now = dol_now();
/*
* Last proposals
*/
- if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
+ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
- $sql.= ", p.tva as total_tva";
- $sql.= ", p.total as total_ttc";
- $sql.= ", p.ref, p.ref_client, p.remise";
- $sql.= ", p.datep as dp, p.fin_validite as datelimite";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
- $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
- $sql.= " AND s.rowid = ".$object->id;
- $sql.= " AND p.entity IN (".getEntity('propal').")";
- $sql.= " ORDER BY p.datep DESC";
+ $sql .= ", p.tva as total_tva";
+ $sql .= ", p.total as total_ttc";
+ $sql .= ", p.ref, p.ref_client, p.remise";
+ $sql .= ", p.datep as dp, p.fin_validite as datelimite";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
+ $sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
+ $sql .= " AND s.rowid = ".$object->id;
+ $sql .= " AND p.entity IN (".getEntity('propal').")";
+ $sql .= " ORDER BY p.datep DESC";
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
$propal_static = new Propal($db);
@@ -695,7 +695,7 @@ if ($object->id > 0)
print '';
print '';
- print '| '.$langs->trans("LastPropals", ($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllPropals").' '.$num.' | ';
+ print ' | ';
print ' ';
@@ -715,7 +715,7 @@ if ($object->id > 0)
$propal_static->total_tva = $objp->total_tva;
$propal_static->total_ttc = $objp->total_ttc;
print $propal_static->getNomUrl(1);
- if ( ($db->jdate($objp->datelimite) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) {
+ if (($db->jdate($objp->datelimite) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1) {
print " ".img_warning();
}
print ''.dol_print_date($db->jdate($objp->dp), 'day')." | \n";
@@ -740,39 +740,39 @@ if ($object->id > 0)
/*
* Last orders
*/
- if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
+ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$sql = "SELECT s.nom, s.rowid";
- $sql.= ", c.rowid as cid, c.total_ht";
- $sql.= ", c.tva as total_tva";
- $sql.= ", c.total_ttc";
- $sql.= ", c.ref, c.ref_client, c.fk_statut, c.facture";
- $sql.= ", c.date_commande as dc";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
- $sql.= " WHERE c.fk_soc = s.rowid ";
- $sql.= " AND s.rowid = ".$object->id;
- $sql.= " AND c.entity = ".$conf->entity;
- $sql.= " ORDER BY c.date_commande DESC";
+ $sql .= ", c.rowid as cid, c.total_ht";
+ $sql .= ", c.tva as total_tva";
+ $sql .= ", c.total_ttc";
+ $sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
+ $sql .= ", c.date_commande as dc";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
+ $sql .= " WHERE c.fk_soc = s.rowid ";
+ $sql .= " AND s.rowid = ".$object->id;
+ $sql .= " AND c.entity = ".$conf->entity;
+ $sql .= " ORDER BY c.date_commande DESC";
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
- $commande_static=new Commande($db);
+ $commande_static = new Commande($db);
$num = $db->num_rows($resql);
if ($num > 0)
{
// Check if there are orders billable
$sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
- $sql2.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
- $sql2.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
- $sql2.= ', '.MAIN_DB_PREFIX.'commande as c';
- $sql2.= ' WHERE c.fk_soc = s.rowid';
- $sql2.= ' AND s.rowid = '.$object->id;
+ $sql2 .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
+ $sql2 .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
+ $sql2 .= ', '.MAIN_DB_PREFIX.'commande as c';
+ $sql2 .= ' WHERE c.fk_soc = s.rowid';
+ $sql2 .= ' AND s.rowid = '.$object->id;
// Show orders with status validated, shipping started and delivered (well any order we can bill)
- $sql2.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
+ $sql2 .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
- $resql2=$db->query($sql2);
+ $resql2 = $db->query($sql2);
$orders2invoice = $db->num_rows($resql2);
$db->free($resql2);
@@ -780,7 +780,7 @@ if ($object->id > 0)
print '';
print '';
- print '| '.$langs->trans("LastCustomerOrders", ($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllOrders").' '.$num.' | ';
+ print '";
print '';
@@ -826,24 +826,24 @@ if ($object->id > 0)
/*
* Last shipments
*/
- if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire)
+ if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire)
{
$sql = 'SELECT e.rowid as id';
- $sql.= ', e.ref';
- $sql.= ', e.date_creation';
- $sql.= ', e.fk_statut as statut';
- $sql.= ', s.nom';
- $sql.= ', s.rowid as socid';
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
- $sql.= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
- $sql.= " AND e.entity IN (".getEntity('expedition').")";
- $sql.= ' GROUP BY e.rowid';
- $sql.= ', e.ref';
- $sql.= ', e.date_creation';
- $sql.= ', e.fk_statut';
- $sql.= ', s.nom';
- $sql.= ', s.rowid';
- $sql.= " ORDER BY e.date_creation DESC";
+ $sql .= ', e.ref';
+ $sql .= ', e.date_creation';
+ $sql .= ', e.fk_statut as statut';
+ $sql .= ', s.nom';
+ $sql .= ', s.rowid as socid';
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
+ $sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
+ $sql .= " AND e.entity IN (".getEntity('expedition').")";
+ $sql .= ' GROUP BY e.rowid';
+ $sql .= ', e.ref';
+ $sql .= ', e.date_creation';
+ $sql .= ', e.fk_statut';
+ $sql .= ', s.nom';
+ $sql .= ', s.rowid';
+ $sql .= " ORDER BY e.date_creation DESC";
$resql = $db->query($sql);
if ($resql)
@@ -856,7 +856,7 @@ if ($object->id > 0)
print '';
print '';
- print '| '.$langs->trans("LastSendings", ($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllSendings").' '.$num.' | ';
+ print ' | ';
print ' ';
@@ -880,7 +880,7 @@ if ($object->id > 0)
print '!!! | ';
}
- print '' . $sendingstatic->LibStatut($objp->statut, 5) . ' | ';
+ print ''.$sendingstatic->LibStatut($objp->statut, 5).' | ';
print "\n";
$i++;
}
@@ -899,28 +899,28 @@ if ($object->id > 0)
/*
* Last linked contracts
*/
- if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
+ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
- $sql.= " WHERE c.fk_soc = s.rowid ";
- $sql.= " AND s.rowid = ".$object->id;
- $sql.= " AND c.entity = ".$conf->entity;
- $sql.= " ORDER BY c.datec DESC";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
+ $sql .= " WHERE c.fk_soc = s.rowid ";
+ $sql .= " AND s.rowid = ".$object->id;
+ $sql .= " AND c.entity = ".$conf->entity;
+ $sql .= " ORDER BY c.datec DESC";
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
- $contrat=new Contrat($db);
+ $contrat = new Contrat($db);
$num = $db->num_rows($resql);
- if ($num >0)
+ if ($num > 0)
{
print '';
print ' ';
print '';
- print '| '.$langs->trans("LastContracts", ($num<=$MAXLIST?"":$MAXLIST)).' | ';
+ print ' | ';
@@ -932,10 +932,10 @@ if ($object->id > 0)
{
$objp = $db->fetch_object($resql);
- $contrat->id=$objp->id;
- $contrat->ref=$objp->ref?$objp->ref:$objp->id;
- $contrat->ref_customer=$objp->refcus;
- $contrat->ref_supplier=$objp->refsup;
+ $contrat->id = $objp->id;
+ $contrat->ref = $objp->ref ? $objp->ref : $objp->id;
+ $contrat->ref_customer = $objp->refcus;
+ $contrat->ref_supplier = $objp->refsup;
$contrat->fetch_lines();
print ' ';
@@ -969,19 +969,19 @@ if ($object->id > 0)
/*
* Last interventions
*/
- if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
+ if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
{
$sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
- $sql.= " WHERE f.fk_soc = s.rowid";
- $sql.= " AND s.rowid = ".$object->id;
- $sql.= " AND f.entity = ".$conf->entity;
- $sql.= " ORDER BY f.tms DESC";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
+ $sql .= " WHERE f.fk_soc = s.rowid";
+ $sql .= " AND s.rowid = ".$object->id;
+ $sql .= " AND f.entity = ".$conf->entity;
+ $sql .= " ORDER BY f.tms DESC";
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
- $fichinter_static=new Fichinter($db);
+ $fichinter_static = new Fichinter($db);
$num = $db->num_rows($resql);
if ($num > 0)
@@ -990,7 +990,7 @@ if ($object->id > 0)
print '';
print '';
- print '| '.$langs->trans("LastInterventions", ($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllInterventions").' '.$num.' | ';
+ print ' | ';
print ' ';
@@ -1001,8 +1001,8 @@ if ($object->id > 0)
{
$objp = $db->fetch_object($resql);
- $fichinter_static->id=$objp->id;
- $fichinter_static->statut=$objp->fk_statut;
+ $fichinter_static->id = $objp->id;
+ $fichinter_static->statut = $objp->fk_statut;
print '';
print '| '.img_object($langs->trans("ShowPropal"), "propal").' '.$objp->ref.' | '."\n";
@@ -1030,28 +1030,28 @@ if ($object->id > 0)
/*
* Last invoices templates
*/
- if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
+ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
- $sql.= ', f.total as total_ht';
- $sql.= ', f.tva as total_tva';
- $sql.= ', f.total_ttc';
- $sql.= ', f.datec as dc';
- $sql.= ', f.date_last_gen, f.date_when';
- $sql.= ', f.frequency';
- $sql.= ', f.unit_frequency';
- $sql.= ', f.suspended as suspended';
- $sql.= ', s.nom, s.rowid as socid';
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
- $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
- $sql.= " AND f.entity = ".$conf->entity;
- $sql.= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
- $sql.= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
- $sql.= ' f.suspended,';
- $sql.= ' s.nom, s.rowid';
- $sql.= " ORDER BY f.date_last_gen, f.datec DESC";
+ $sql .= ', f.total as total_ht';
+ $sql .= ', f.tva as total_tva';
+ $sql .= ', f.total_ttc';
+ $sql .= ', f.datec as dc';
+ $sql .= ', f.date_last_gen, f.date_when';
+ $sql .= ', f.frequency';
+ $sql .= ', f.unit_frequency';
+ $sql .= ', f.suspended as suspended';
+ $sql .= ', s.nom, s.rowid as socid';
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
+ $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
+ $sql .= " AND f.entity = ".$conf->entity;
+ $sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
+ $sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
+ $sql .= ' f.suspended,';
+ $sql .= ' s.nom, s.rowid';
+ $sql .= " ORDER BY f.date_last_gen, f.datec DESC";
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
$invoicetemplate = new FactureRec($db);
@@ -1063,7 +1063,7 @@ if ($object->id > 0)
print '';
print '';
- print '| '.$langs->trans("LatestCustomerTemplateInvoices", ($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllCustomerTemplateInvoices").' '.$num.' | ';
+ print ' | ';
print ' ';
}
@@ -1107,7 +1107,7 @@ if ($object->id > 0)
print price($objp->total_ht);
print '';
- if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
+ if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
{
print '';
print price($objp->total_ttc);
@@ -1138,25 +1138,25 @@ if ($object->id > 0)
/*
* Last invoices
*/
- if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
+ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.amount';
- $sql.= ', f.total as total_ht';
- $sql.= ', f.tva as total_tva';
- $sql.= ', f.total_ttc';
- $sql.= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
- $sql.= ', s.nom, s.rowid as socid';
- $sql.= ', SUM(pf.amount) as am';
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
- $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
- $sql.= " AND f.entity IN (".getEntity('invoice').")";
- $sql.= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
- $sql.= ' f.datef, f.datec, f.paye, f.fk_statut,';
- $sql.= ' s.nom, s.rowid';
- $sql.= " ORDER BY f.datef DESC, f.datec DESC";
+ $sql .= ', f.total as total_ht';
+ $sql .= ', f.tva as total_tva';
+ $sql .= ', f.total_ttc';
+ $sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
+ $sql .= ', s.nom, s.rowid as socid';
+ $sql .= ', SUM(pf.amount) as am';
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
+ $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
+ $sql .= " AND f.entity IN (".getEntity('invoice').")";
+ $sql .= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
+ $sql .= ' f.datef, f.datec, f.paye, f.fk_statut,';
+ $sql .= ' s.nom, s.rowid';
+ $sql .= " ORDER BY f.datef DESC, f.datec DESC";
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
$facturestatic = new Facture($db);
@@ -1168,7 +1168,7 @@ if ($object->id > 0)
print '';
print '';
- print '| '.$langs->trans("LastCustomersBills", ($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllBills").' '.$num.' | ';
+ print ' | ';
print ' ';
@@ -1202,7 +1202,7 @@ if ($object->id > 0)
print price($objp->total_ht);
print '';
- if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
+ if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
{
print '';
print price($objp->total_ttc);
@@ -1249,25 +1249,25 @@ if ($object->id > 0)
print '';
}
- if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1)
+ if (!empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status == 1)
{
$langs->load("propal");
print '';
}
- if (! empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status==1)
+ if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1)
{
$langs->load("orders");
print '';
}
- if ($user->rights->contrat->creer && $object->status==1)
+ if ($user->rights->contrat->creer && $object->status == 1)
{
$langs->load("contracts");
print '';
}
- if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status==1)
+ if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1)
{
$langs->load("fichinter");
print '';
@@ -1276,13 +1276,13 @@ if ($object->id > 0)
// Add invoice
if ($user->socid == 0)
{
- if (! empty($conf->deplacement->enabled) && $object->status==1)
+ if (!empty($conf->deplacement->enabled) && $object->status == 1)
{
$langs->load("trips");
print '';
}
- if (! empty($conf->facture->enabled) && $object->status==1)
+ if (!empty($conf->facture->enabled) && $object->status == 1)
{
if (empty($user->rights->facture->creer))
{
@@ -1310,7 +1310,7 @@ if ($object->id > 0)
}
// Add action
- if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status==1)
+ if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
{
if ($user->rights->agenda->myactions->create)
{
@@ -1325,13 +1325,13 @@ if ($object->id > 0)
print '';
- if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD))
+ if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD))
{
// List of contacts
show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
}
- if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
+ if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
{
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index f4a0e61095f..a2d8c0a373b 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -23,7 +23,7 @@
* \brief Fiche mailing, onglet general
*/
-if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1');
+if (!defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
@@ -54,26 +54,26 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('mailingcard','globalcard'));
+$hookmanager->initHooks(array('mailingcard', 'globalcard'));
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
-$object->substitutionarray=FormMail::getAvailableSubstitKey('emailing');
+$object->substitutionarray = FormMail::getAvailableSubstitKey('emailing');
// Set $object->substitutionarrayfortest
-$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'');
+$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : '');
-$targetobject = null; // Not defined with mass emailing
+$targetobject = null; // Not defined with mass emailing
-$parameters=array('mode'=>'emailing');
-$substitutionarray=FormMail::getAvailableSubstitKey('emailing', $targetobject);
+$parameters = array('mode'=>'emailing');
+$substitutionarray = FormMail::getAvailableSubstitKey('emailing', $targetobject);
$object->substitutionarrayfortest = $substitutionarray;
// List of sending methods
-$listofmethods=array();
-$listofmethods['mail']='PHP mail function';
-$listofmethods['smtps']='SMTP/SMTPS socket library';
+$listofmethods = array();
+$listofmethods['mail'] = 'PHP mail function';
+$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
@@ -81,8 +81,8 @@ $listofmethods['smtps']='SMTP/SMTPS socket library';
* Actions
*/
-$parameters=array();
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
@@ -96,7 +96,7 @@ if (empty($reshook))
}
else
{
- $result=$object->createFromClone($user, $object->id, $_REQUEST["clone_content"], $_REQUEST["clone_receivers"]);
+ $result = $object->createFromClone($user, $object->id, $_REQUEST["clone_content"], $_REQUEST["clone_receivers"]);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
@@ -107,7 +107,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
}
- $action='';
+ $action = '';
}
// Action send emailing for everybody
@@ -119,16 +119,16 @@ if (empty($reshook))
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessages('', null, 'warnings');
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
- $action='';
+ $action = '';
}
elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings');
- $action='';
+ $action = '';
}
else
{
- $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1, $object, 'mailing');
+ $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($object->statut == 0)
{
@@ -143,37 +143,37 @@ if (empty($reshook))
$replyto = $object->email_replyto;
$errorsto = $object->email_errorsto;
// Le message est-il en html
- $msgishtml=-1; // Unknown by default
- if (preg_match('/[\s\t]*/i', $message)) $msgishtml=1;
+ $msgishtml = -1; // Unknown by default
+ if (preg_match('/[\s\t]*/i', $message)) $msgishtml = 1;
// Warning, we must not use begin-commit transaction here
// because we want to save update for each mail sent.
- $nbok=0; $nbko=0;
+ $nbok = 0; $nbko = 0;
// On choisit les mails non deja envoyes pour ce mailing (statut=0)
// ou envoyes en erreur (statut=-1)
$sql = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
- $sql .= " ORDER BY mc.statut DESC"; // first status 0, then status -1
+ $sql .= " ORDER BY mc.statut DESC"; // first status 0, then status -1
dol_syslog("card.php: select targets", LOG_DEBUG);
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
- $num = $db->num_rows($resql); // nb of possible recipients
+ $num = $db->num_rows($resql); // nb of possible recipients
if ($num)
{
dol_syslog("comm/mailing/card.php: nb of targets = ".$num, LOG_DEBUG);
- $now=dol_now();
+ $now = dol_now();
// Positionne date debut envoi
- $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".$object->id;
- $resql2=$db->query($sql);
- if (! $resql2)
+ $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".$object->id;
+ $resql2 = $db->query($sql);
+ if (!$resql2)
{
dol_print_error($db);
}
@@ -184,8 +184,8 @@ if (empty($reshook))
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
{
// Here code is common with same loop ino mailing-send.php
- $res=1;
- $now=dol_now();
+ $res = 1;
+ $now = dol_now();
$obj = $db->fetch_object($resql);
@@ -193,18 +193,18 @@ if (empty($reshook))
$sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname))." <".$obj->email.">";
// Make substitutions on topic and body. From (AA=YY;BB=CC;...) we keep YY, CC, ...
- $other=explode(';', $obj->other);
- $tmpfield=explode('=', $other[0], 2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
- $tmpfield=explode('=', $other[1], 2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
- $tmpfield=explode('=', $other[2], 2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
- $tmpfield=explode('=', $other[3], 2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
- $tmpfield=explode('=', $other[4], 2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
+ $other = explode(';', $obj->other);
+ $tmpfield = explode('=', $other[0], 2); $other1 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
+ $tmpfield = explode('=', $other[1], 2); $other2 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
+ $tmpfield = explode('=', $other[2], 2); $other3 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
+ $tmpfield = explode('=', $other[3], 2); $other4 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
+ $tmpfield = explode('=', $other[4], 2); $other5 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
- $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'');
+ $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : '');
- $targetobject = null; // Not defined with mass emailing
- $parameters=array('mode'=>'emailing');
- $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
+ $targetobject = null; // Not defined with mass emailing
+ $parameters = array('mode'=>'emailing');
+ $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$substitutionarray['__ID__'] = $obj->source_id;
@@ -217,79 +217,79 @@ if (empty($reshook))
$substitutionarray['__OTHER3__'] = $other3;
$substitutionarray['__OTHER4__'] = $other4;
$substitutionarray['__OTHER5__'] = $other5;
- $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
- $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
+ $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
+ $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
$substitutionarray['__CHECK_READ__'] = ' ';
$substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").'';
$onlinepaymentenabled = 0;
- if (! empty($conf->paypal->enabled)) $onlinepaymentenabled++;
- if (! empty($conf->paybox->enabled)) $onlinepaymentenabled++;
- if (! empty($conf->stripe->enabled)) $onlinepaymentenabled++;
- if ($onlinepaymentenabled && ! empty($conf->global->PAYMENT_SECURITY_TOKEN))
+ if (!empty($conf->paypal->enabled)) $onlinepaymentenabled++;
+ if (!empty($conf->paybox->enabled)) $onlinepaymentenabled++;
+ if (!empty($conf->stripe->enabled)) $onlinepaymentenabled++;
+ if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN))
{
- $substitutionarray['__SECUREKEYPAYMENT__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ $substitutionarray['__SECUREKEYPAYMENT__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
{
- $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
- $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
- $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
- $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
}
else
{
- $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
- $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'order' . $obj->source_id, 2);
- $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2);
- $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$obj->source_id, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'order'.$obj->source_id, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'invoice'.$obj->source_id, 2);
+ $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'contractline'.$obj->source_id, 2);
}
}
/* For backward compatibility, deprecated */
- if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
+ if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
- $substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ $substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
- else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'membersubscription'.$obj->source_id, 2);
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
- else $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'order' . $obj->source_id, 2);
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'order'.$obj->source_id, 2);
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
- else $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2);
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'invoice'.$obj->source_id, 2);
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
- else $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ else $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'contractline'.$obj->source_id, 2);
}
//$substitutionisok=true;
complete_substitutions_array($substitutionarray, $langs);
- $newsubject=make_substitutions($subject, $substitutionarray);
- $newmessage=make_substitutions($message, $substitutionarray);
+ $newsubject = make_substitutions($subject, $substitutionarray);
+ $newmessage = make_substitutions($message, $substitutionarray);
$arr_file = array();
$arr_mime = array();
$arr_name = array();
$arr_css = array();
- $listofpaths=dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
+ $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)
{
- $arr_file[]=$listofpaths[$key]['fullname'];
- $arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
- $arr_name[]=$listofpaths[$key]['name'];
+ $arr_file[] = $listofpaths[$key]['fullname'];
+ $arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
+ $arr_name[] = $listofpaths[$key]['name'];
}
}
// Fabrication du mail
- $trackid='emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
+ $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, '', 'emailing');
if ($mail->error)
{
- $res=0;
+ $res = 0;
}
/*if (! $substitutionisok)
{
@@ -300,7 +300,7 @@ if (empty($reshook))
// Send mail
if ($res)
{
- $res=$mail->sendfile();
+ $res = $mail->sendfile();
}
if ($res)
@@ -308,12 +308,12 @@ if (empty($reshook))
// Mail successful
$nbok++;
- dol_syslog("comm/mailing/card.php: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
+ dol_syslog("comm/mailing/card.php: ok for #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
- $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
- $sql.=" SET statut=1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
- $resql2=$db->query($sql);
- if (! $resql2)
+ $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
+ $sql .= " SET statut=1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
+ $resql2 = $db->query($sql);
+ if (!$resql2)
{
dol_print_error($db);
}
@@ -325,8 +325,8 @@ if (empty($reshook))
//Update status communication of thirdparty prospect
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
dol_syslog("card.php: set prospect thirdparty status", LOG_DEBUG);
- $resql2=$db->query($sql);
- if (! $resql2)
+ $resql2 = $db->query($sql);
+ if (!$resql2)
{
dol_print_error($db);
}
@@ -335,8 +335,8 @@ if (empty($reshook))
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
dol_syslog("card.php: set prospect contact status", LOG_DEBUG);
- $resql2=$db->query($sql);
- if (! $resql2)
+ $resql2 = $db->query($sql);
+ if (!$resql2)
{
dol_print_error($db);
}
@@ -355,12 +355,12 @@ if (empty($reshook))
// Mail failed
$nbko++;
- dol_syslog("comm/mailing/card.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING);
+ dol_syslog("comm/mailing/card.php: error for #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_WARNING);
- $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
- $sql.=" SET statut=-1, error_text='".$db->escape($mail->error)."', date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
- $resql2=$db->query($sql);
- if (! $resql2)
+ $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
+ $sql .= " SET statut=-1, error_text='".$db->escape($mail->error)."', date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
+ $resql2 = $db->query($sql);
+ if (!$resql2)
{
dol_print_error($db);
}
@@ -377,7 +377,7 @@ if (empty($reshook))
// Loop finished, set global statut of mail
if ($nbko > 0)
{
- $statut=2; // Status 'sent partially' (because at least one error)
+ $statut = 2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
else setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
}
@@ -385,20 +385,20 @@ if (empty($reshook))
{
if ($nbok >= $num)
{
- $statut=3; // Send to everybody
+ $statut = 3; // Send to everybody
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
}
else
{
- $statut=2; // Status 'sent partially' (because not send to everybody)
+ $statut = 2; // Status 'sent partially' (because not send to everybody)
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs');
}
}
- $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
+ $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
dol_syslog("comm/mailing/card.php: update global status", LOG_DEBUG);
- $resql2=$db->query($sql);
- if (! $resql2)
+ $resql2 = $db->query($sql);
+ if (!$resql2)
{
dol_print_error($db);
}
@@ -416,22 +416,22 @@ if (empty($reshook))
// Action send test emailing
if ($action == 'send' && empty($_POST["cancel"]))
{
- $error=0;
+ $error = 0;
- $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1, $object, 'mailing');
+ $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
$object->sendto = $_POST["sendto"];
- if (! $object->sendto)
+ if (!$object->sendto)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTo")), null, 'errors');
$error++;
}
- if (! $error)
+ if (!$error)
{
// Le message est-il en html
- $msgishtml=-1; // Inconnu par defaut
- if (preg_match('/[\s\t]*/i', $object->body)) $msgishtml=1;
+ $msgishtml = -1; // Inconnu par defaut
+ if (preg_match('/[\s\t]*/i', $object->body)) $msgishtml = 1;
// other are set at begin of page
$object->substitutionarrayfortest['__EMAIL__'] = $object->sendto;
@@ -439,8 +439,8 @@ if (empty($reshook))
// Pratique les substitutions sur le sujet et message
complete_substitutions_array($object->substitutionarrayfortest, $langs);
- $tmpsujet=make_substitutions($object->sujet, $object->substitutionarrayfortest);
- $tmpbody=make_substitutions($object->body, $object->substitutionarrayfortest);
+ $tmpsujet = make_substitutions($object->sujet, $object->substitutionarrayfortest);
+ $tmpbody = make_substitutions($object->body, $object->substitutionarrayfortest);
$arr_file = array();
$arr_mime = array();
@@ -448,25 +448,25 @@ if (empty($reshook))
$arr_css = array();
// Ajout CSS
- if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/', $object->bgcolor)?'':'#').$object->bgcolor;
+ if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/', $object->bgcolor) ? '' : '#').$object->bgcolor;
if (!empty($object->bgimage)) $arr_css['bgimage'] = $object->bgimage;
// Attached files
- $listofpaths=dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
+ $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)
{
- $arr_file[]=$listofpaths[$key]['fullname'];
- $arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
- $arr_name[]=$listofpaths[$key]['name'];
+ $arr_file[] = $listofpaths[$key]['fullname'];
+ $arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
+ $arr_name[] = $listofpaths[$key]['name'];
}
}
- $trackid='emailingtest';
+ $trackid = 'emailingtest';
$mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing');
- $result=$mailfile->sendfile();
+ $result = $mailfile->sendfile();
if ($result)
{
setEventMessages($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)), null, 'mesgs');
@@ -494,13 +494,13 @@ if (empty($reshook))
$object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]);
- if (! $object->titre) {
+ if (!$object->titre) {
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
}
- if (! $object->sujet) {
+ if (!$object->sujet) {
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTopic"));
}
- if (! $object->body) {
+ if (!$object->body) {
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailMessage"));
}
@@ -515,17 +515,17 @@ if (empty($reshook))
}
setEventMessages($mesg, $mesgs, 'errors');
- $action="create";
+ $action = "create";
}
// Action update description of emailing
if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
{
- $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1, $object, 'mailing');
+ $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitre') $object->titre = trim(GETPOST('titre', 'alpha'));
elseif ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from', 'alpha'));
- elseif ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto', 'alpha'));
+ elseif ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto', 'alpha'));
elseif ($action == 'setemail_errorsto') {
$object->email_errorsto = trim(GETPOST('email_errorsto', 'alpha'));
} elseif ($action == 'settitre' && empty($object->titre)) {
@@ -534,7 +534,7 @@ if (empty($reshook))
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
}
- if (! $mesg)
+ if (!$mesg)
{
if ($object->update($user) >= 0)
{
@@ -545,34 +545,34 @@ if (empty($reshook))
}
setEventMessages($mesg, $mesgs, 'errors');
- $action="";
+ $action = "";
}
/*
* Add file in email form
*/
- if (! empty($_POST['addfile']))
+ if (!empty($_POST['addfile']))
{
- $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1, $object, 'mailing');
+ $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
dol_add_file_process($upload_dir, 0, 0);
- $action="edit";
+ $action = "edit";
}
// Action remove file
- if (! empty($_POST["removedfile"]))
+ if (!empty($_POST["removedfile"]))
{
- $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1, $object, 'mailing');
+ $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- dol_remove_file_process($_POST['removedfile'], 0, 0); // We really delete file linked to mailing
+ dol_remove_file_process($_POST['removedfile'], 0, 0); // We really delete file linked to mailing
- $action="edit";
+ $action = "edit";
}
// Action update emailing
@@ -580,9 +580,9 @@ if (empty($reshook))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- $isupload=0;
+ $isupload = 0;
- if (! $isupload)
+ if (!$isupload)
{
$mesgs = array();
@@ -591,10 +591,10 @@ if (empty($reshook))
$object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]);
- if (! $object->sujet) {
+ if (!$object->sujet) {
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTopic"));
}
- if (! $object->body) {
+ if (!$object->body) {
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailMessage"));
}
@@ -605,15 +605,15 @@ if (empty($reshook))
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
- $mesgs[] =$object->error;
+ $mesgs[] = $object->error;
}
setEventMessages($mesg, $mesgs, 'errors');
- $action="edit";
+ $action = "edit";
}
else
{
- $action="edit";
+ $action = "edit";
}
}
@@ -663,10 +663,10 @@ if (empty($reshook))
{
$db->begin();
- $result=$object->valid($user);
+ $result = $object->valid($user);
if ($result > 0)
{
- $result=$object->reset_targets_status($user);
+ $result = $object->reset_targets_status($user);
}
if ($result > 0)
@@ -692,13 +692,13 @@ if (empty($reshook))
{
if ($object->delete($object->id))
{
- $url= (! empty($urlfrom) ? $urlfrom : 'list.php');
+ $url = (!empty($urlfrom) ? $urlfrom : 'list.php');
header("Location: ".$url);
exit;
}
}
- if (! empty($_POST["cancel"]))
+ if (!empty($_POST["cancel"]))
{
$action = '';
}
@@ -712,7 +712,7 @@ if (empty($reshook))
$form = new Form($db);
$htmlother = new FormOther($db);
-$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
+$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
llxHeader('', $langs->trans("Mailing"), $help_url, '', 0, 0,
array(
'/includes/ace/src/ace.js',
@@ -729,14 +729,14 @@ if ($action == 'create')
print '';
$htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").': ';
- foreach($object->substitutionarray as $key => $val)
+ foreach ($object->substitutionarray as $key => $val)
{
- $htmltext.=$key.' = '.$langs->trans($val).' ';
+ $htmltext .= $key.' = '.$langs->trans($val).' ';
}
- $htmltext.='';
+ $htmltext .= '';
- $availablelink=$form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'availvar');
+ $availablelink = $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'availvar');
//print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'';
@@ -748,11 +748,11 @@ if ($action == 'create')
print '';
print '| '.$langs->trans("MailTitle").' | | ';
print '| '.$langs->trans("MailFrom").' | | ';
- print '| '.$langs->trans("MailErrorsTo").' | | ';
+ print '| '.$langs->trans("MailErrorsTo").' | | ';
// Other attributes
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -773,7 +773,7 @@ if ($action == 'create')
print '';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('bodyemail', GETPOST('bodyemail', 'none'), '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
+ $doleditor = new DolEditor('bodyemail', GETPOST('bodyemail', 'none'), '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
$doleditor->Create();
print ' ';
@@ -787,7 +787,7 @@ else
{
if ($object->id > 0)
{
- $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1, $object, 'mailing');
+ $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
$head = emailing_prepare_head($object);
@@ -809,7 +809,7 @@ else
// Confirm delete
elseif ($action == 'delete')
{
- print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(! empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''), $langs->trans("DeleteAMailing"), $langs->trans("ConfirmDeleteMailing"), "confirm_delete", '', '', 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(!empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''), $langs->trans("DeleteAMailing"), $langs->trans("ConfirmDeleteMailing"), "confirm_delete", '', '', 1);
}
@@ -919,22 +919,22 @@ else
print '| ';
print $langs->trans("TotalNbOfDistinctRecipients");
print ' | ';
- $nbemail = ($object->nbemail?$object->nbemail:0);
+ $nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail))
{
- $text='';
- if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
+ $text = '';
+ if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
{
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{
- $text.=$langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
+ $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
}
else
{
- $text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
+ $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
}
}
- if (empty($nbemail)) $nbemail.=' '.img_warning('').' '.$langs->trans("NoTargetYet").'';
+ if (empty($nbemail)) $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").'';
if ($text)
{
print $form->textwithpicto($nbemail, $text, 1, 'warning');
@@ -947,7 +947,7 @@ else
print ' | ';
// Other attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print ' ';
@@ -960,9 +960,9 @@ else
if ($action == 'clone')
{
// Create an array for form
- $formquestion=array(
+ $formquestion = array(
'text' => $langs->trans("ConfirmClone"),
- array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
+ array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0)
);
// Paiement incomplet. On demande si motif = escompte ou autre
@@ -973,7 +973,7 @@ else
* Boutons d'action
*/
- if (GETPOST('cancel', 'alpha') || $confirm=='no' || $action == '' || in_array($action, array('settodraft','valid','delete','sendall','clone','test')))
+ if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test')))
{
print "\n\n\n";
@@ -984,7 +984,7 @@ else
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
{
- if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_MAILING))
+ if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING))
{
print ' '.$langs->trans("EditWithEditor").'';
}
@@ -993,12 +993,12 @@ else
print ' '.$langs->trans("EditWithTextEditor").'';
}
- if (! empty($conf->use_javascript_ajax)) print ' '.$langs->trans("EditHTMLSource").'';
+ if (!empty($conf->use_javascript_ajax)) print ' '.$langs->trans("EditHTMLSource").'';
}
//print ' '.$langs->trans("PreviewMailing").'';
- if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
+ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send)
{
print ' '.$langs->trans("TestMailing").'';
}
@@ -1029,7 +1029,7 @@ else
{
print ' '.$langs->trans("SendMailing").'';
}
- elseif (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
+ elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send)
{
print ' '.$langs->trans("SendMailing").'';
}
@@ -1046,7 +1046,7 @@ else
if (($object->statut == 2 || $object->statut == 3) && $user->rights->mailing->valider)
{
- if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
+ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send)
{
print ' '.$langs->trans("ResetMailing").'';
}
@@ -1058,13 +1058,13 @@ else
if (($object->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer)
{
- if ($object->statut > 0 && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->delete))
+ if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->delete))
{
print ' '.$langs->trans("DeleteMailing").'';
}
else
{
- print ' '.$langs->trans("DeleteMailing").'';
+ print ' '.$langs->trans("DeleteMailing").'';
}
}
@@ -1084,25 +1084,25 @@ else
$formmail = new FormMail($db);
$formmail->fromname = $object->email_from;
$formmail->frommail = $object->email_from;
- $formmail->withsubstit=1;
- $formmail->withfrom=0;
- $formmail->withto=$user->email?$user->email:1;
- $formmail->withtocc=0;
- $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
- $formmail->withtopic=0;
- $formmail->withtopicreadonly=1;
- $formmail->withfile=0;
- $formmail->withbody=0;
- $formmail->withbodyreadonly=1;
- $formmail->withcancel=1;
- $formmail->withdeliveryreceipt=0;
+ $formmail->withsubstit = 1;
+ $formmail->withfrom = 0;
+ $formmail->withto = $user->email ? $user->email : 1;
+ $formmail->withtocc = 0;
+ $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
+ $formmail->withtopic = 0;
+ $formmail->withtopicreadonly = 1;
+ $formmail->withfile = 0;
+ $formmail->withbody = 0;
+ $formmail->withbodyreadonly = 1;
+ $formmail->withcancel = 1;
+ $formmail->withdeliveryreceipt = 0;
// Tableau des substitutions
- $formmail->substit=$object->substitutionarrayfortest;
+ $formmail->substit = $object->substitutionarrayfortest;
// Tableau des parametres complementaires du post
- $formmail->param["action"]="send";
- $formmail->param["models"]='none';
- $formmail->param["mailid"]=$object->id;
- $formmail->param["returnurl"]=$_SERVER['PHP_SELF']."?id=".$object->id;
+ $formmail->param["action"] = "send";
+ $formmail->param["models"] = 'none';
+ $formmail->param["mailid"] = $object->id;
+ $formmail->param["returnurl"] = $_SERVER['PHP_SELF']."?id=".$object->id;
print $formmail->get_form();
@@ -1115,11 +1115,11 @@ else
$htmltext = ' '.$langs->trans("FollowingConstantsWillBeSubstituted").': ';
- foreach($object->substitutionarray as $key => $val)
+ foreach ($object->substitutionarray as $key => $val)
{
- $htmltext.=$key.' = '.$langs->trans($val).' ';
+ $htmltext .= $key.' = '.$langs->trans($val).' ';
}
- $htmltext.='';
+ $htmltext .= '';
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto(' '.$langs->trans("AvailableVariables").'', $htmltext, 1, 'helpclickable', '', 0, 2, 'emailsubstitionhelp'), 'generic');
@@ -1134,10 +1134,10 @@ else
// Joined files
print ' | '.$langs->trans("MailFile").' | ';
// List of files
- $listofpaths=dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
+ $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 ' ';
@@ -1157,13 +1157,13 @@ else
print ' | | ';
// Message
- print '';
+ print ' ';
if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') // CKEditor does not apply the color of the div into its content area
{
- $readonly=1;
+ $readonly = 1;
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1, 20, '90%', $readonly);
+ $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING) ? 0 : 1, 20, '90%', $readonly);
$doleditor->Create();
}
else print dol_htmlentitiesbr($object->body);
@@ -1181,8 +1181,8 @@ else
$linkback = ' '.$langs->trans("BackToList").'';
- $morehtmlright='';
- if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
+ $morehtmlright = '';
+ if ($object->statut == 2) $morehtmlright .= ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
@@ -1209,22 +1209,22 @@ else
print ' | ';
print $langs->trans("TotalNbOfDistinctRecipients");
print ' | ';
- $nbemail = ($object->nbemail?$object->nbemail:0);
+ $nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail))
{
- $text='';
- if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
+ $text = '';
+ if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
{
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{
- $text.=$langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
+ $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
}
else
{
- $text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
+ $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
}
}
- if (empty($nbemail)) $nbemail.=' '.img_warning('').' '.$langs->trans("NoTargetYet").'';
+ if (empty($nbemail)) $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").'';
if ($text)
{
print $form->textwithpicto($nbemail, $text, 1, 'warning');
@@ -1237,8 +1237,8 @@ else
print ' | ';
// Other attributes
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -1260,11 +1260,11 @@ else
print ' ';
$htmltext = ' '.$langs->trans("FollowingConstantsWillBeSubstituted").': ';
- foreach($object->substitutionarray as $key => $val)
+ foreach ($object->substitutionarray as $key => $val)
{
- $htmltext.=$key.' = '.$langs->trans($val).' ';
+ $htmltext .= $key.' = '.$langs->trans($val).' ';
}
- $htmltext.='';
+ $htmltext .= '';
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'generic');
@@ -1276,43 +1276,43 @@ else
// Subject
print ' | '.$langs->trans("MailTopic").' | | ';
- $trackid=''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header.
+ $trackid = ''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header.
dol_init_file_process($upload_dir, $trackid);
// Joined files
- $addfileaction='addfile';
+ $addfileaction = 'addfile';
print ' | '.$langs->trans("MailFile").' | ';
print '';
// List of files
- $listofpaths=dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
+ $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.= ''."\n";
- $out.= ''."\n";
+ $out .= ''."\n";
+ $out .= ''."\n";
if (count($listofpaths))
{
- foreach($listofpaths as $key => $val)
+ foreach ($listofpaths as $key => $val)
{
- $out.= ' ';
- $out.= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
- $out.= ' ';
- $out.= '
';
+ $out .= '';
+ $out .= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
+ $out .= ' ';
+ $out .= '
';
}
}
else
{
- $out.= $langs->trans("NoAttachedFiles").' ';
+ $out .= $langs->trans("NoAttachedFiles").' ';
}
// Add link to add file
- $out.= '';
- $out.= ' ';
- $out.= '';
+ $out .= '';
+ $out .= ' ';
+ $out .= '';
print $out;
print ' | ';
@@ -1330,14 +1330,14 @@ else
{
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
+ $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
$doleditor->Create();
}
if ($action == 'edithtml')
{
// Editor HTML source
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, 'ace', 20, '90%');
+ $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, 'ace', 20, '90%');
$doleditor->Create(0, '', false, 'HTML Source', 'php');
}
diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php
index 465bf7dcc50..0b47d8c4aa5 100644
--- a/htdocs/comm/mailing/class/advtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/advtargetemailing.class.php
@@ -36,7 +36,7 @@ class AdvanceTargetingMailing extends CommonObject
/**
* @var string Error code (or message)
*/
- public $error='';
+ public $error = '';
/**
* @var string[] Error codes (or messages)
@@ -46,12 +46,12 @@ class AdvanceTargetingMailing extends CommonObject
/**
* @var string ID to identify managed object
*/
- public $element='advtargetemailing';
+ public $element = 'advtargetemailing';
/**
* @var string Name of table without prefix where object is stored
*/
- public $table_element='advtargetemailing';
+ public $table_element = 'advtargetemailing';
/**
* @var int ID
@@ -64,12 +64,12 @@ class AdvanceTargetingMailing extends CommonObject
public $type_element;
public $filtervalue;
public $fk_user_author;
- public $datec='';
+ public $datec = '';
public $fk_user_mod;
- public $tms='';
+ public $tms = '';
public $select_target_type = array();
- public $type_statuscommprospect=array();
+ public $type_statuscommprospect = array();
public $thirdparty_lines;
public $contact_lines;
@@ -88,12 +88,12 @@ class AdvanceTargetingMailing extends CommonObject
$this->select_target_type = array(
'2' => $langs->trans('Contacts'),
- '1' => $langs->trans('Contacts') . '+' . $langs->trans('ThirdParty'),
+ '1' => $langs->trans('Contacts').'+'.$langs->trans('ThirdParty'),
'3' => $langs->trans('ThirdParty'),
'4' => $langs->trans('ContactsWithThirdpartyFilter')
);
$this->type_statuscommprospect = array(
- - 1 => $langs->trans("StatusProspect-1"),
+ -1 => $langs->trans("StatusProspect-1"),
0 => $langs->trans("StatusProspect0"),
1 => $langs->trans("StatusProspect1"),
2 => $langs->trans("StatusProspect2"),
@@ -111,50 +111,50 @@ class AdvanceTargetingMailing extends CommonObject
public function create($user, $notrigger = 0)
{
global $conf, $langs;
- $error=0;
+ $error = 0;
// Clean parameters
- if (isset($this->fk_element)) $this->fk_element=(int) $this->fk_element;
- if (isset($this->type_element)) $this->type_element=trim($this->type_element);
+ if (isset($this->fk_element)) $this->fk_element = (int) $this->fk_element;
+ if (isset($this->type_element)) $this->type_element = trim($this->type_element);
- if (isset($this->name)) $this->name=trim($this->name);
- if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
+ if (isset($this->name)) $this->name = trim($this->name);
+ if (isset($this->filtervalue)) $this->filtervalue = trim($this->filtervalue);
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."advtargetemailing(";
- $sql.= "name,";
- $sql.= "entity,";
- $sql.= "fk_element,";
- $sql.= "type_element,";
- $sql.= "filtervalue,";
- $sql.= "fk_user_author,";
- $sql.= "datec,";
- $sql.= "fk_user_mod";
- $sql.= ") VALUES (";
- $sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").",";
- $sql.= " ".$conf->entity.",";
- $sql.= " ".(! isset($this->fk_element)?'NULL':"'".$this->db->escape($this->fk_element)."'").",";
- $sql.= " ".(! isset($this->type_element)?'NULL':"'".$this->db->escape($this->type_element)."'").",";
- $sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
- $sql.= " ".$user->id.",";
- $sql.= " '".$this->db->idate(dol_now())."',";
- $sql.= " null";
- $sql.= ")";
+ $sql .= "name,";
+ $sql .= "entity,";
+ $sql .= "fk_element,";
+ $sql .= "type_element,";
+ $sql .= "filtervalue,";
+ $sql .= "fk_user_author,";
+ $sql .= "datec,";
+ $sql .= "fk_user_mod";
+ $sql .= ") VALUES (";
+ $sql .= " ".(!isset($this->name) ? 'NULL' : "'".$this->db->escape($this->name)."'").",";
+ $sql .= " ".$conf->entity.",";
+ $sql .= " ".(!isset($this->fk_element) ? 'NULL' : "'".$this->db->escape($this->fk_element)."'").",";
+ $sql .= " ".(!isset($this->type_element) ? 'NULL' : "'".$this->db->escape($this->type_element)."'").",";
+ $sql .= " ".(!isset($this->filtervalue) ? 'NULL' : "'".$this->db->escape($this->filtervalue)."'").",";
+ $sql .= " ".$user->id.",";
+ $sql .= " '".$this->db->idate(dol_now())."',";
+ $sql .= " null";
+ $sql .= ")";
$this->db->begin();
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
- $resql=$this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ $resql = $this->db->query($sql);
+ if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
- if (! $error)
+ if (!$error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."advtargetemailing");
- if (! $notrigger)
+ if (!$notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@@ -171,13 +171,13 @@ class AdvanceTargetingMailing extends CommonObject
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -196,30 +196,30 @@ class AdvanceTargetingMailing extends CommonObject
{
global $langs;
$sql = "SELECT";
- $sql.= " t.rowid,";
+ $sql .= " t.rowid,";
- $sql.= " t.name,";
- $sql.= " t.entity,";
- $sql.= " t.fk_element,";
- $sql.= " t.type_element,";
- $sql.= " t.filtervalue,";
- $sql.= " t.fk_user_author,";
- $sql.= " t.datec,";
- $sql.= " t.fk_user_mod,";
- $sql.= " t.tms";
+ $sql .= " t.name,";
+ $sql .= " t.entity,";
+ $sql .= " t.fk_element,";
+ $sql .= " t.type_element,";
+ $sql .= " t.filtervalue,";
+ $sql .= " t.fk_user_author,";
+ $sql .= " t.datec,";
+ $sql .= " t.fk_user_mod,";
+ $sql .= " t.tms";
- $sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
- $sql.= " WHERE t.rowid = ".$id;
+ $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
+ $sql .= " WHERE t.rowid = ".$id;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
+ $this->id = $obj->rowid;
$this->name = $obj->name;
$this->entity = $obj->entity;
@@ -237,7 +237,7 @@ class AdvanceTargetingMailing extends CommonObject
}
else
{
- $this->error="Error ".$this->db->lasterror();
+ $this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
@@ -255,34 +255,34 @@ class AdvanceTargetingMailing extends CommonObject
// phpcs:enable
global $langs;
$sql = "SELECT";
- $sql.= " t.rowid,";
+ $sql .= " t.rowid,";
- $sql.= " t.name,";
- $sql.= " t.entity,";
- $sql.= " t.fk_element,";
- $sql.= " t.type_element,";
- $sql.= " t.filtervalue,";
- $sql.= " t.fk_user_author,";
- $sql.= " t.datec,";
- $sql.= " t.fk_user_mod,";
- $sql.= " t.tms";
+ $sql .= " t.name,";
+ $sql .= " t.entity,";
+ $sql .= " t.fk_element,";
+ $sql .= " t.type_element,";
+ $sql .= " t.filtervalue,";
+ $sql .= " t.fk_user_author,";
+ $sql .= " t.datec,";
+ $sql .= " t.fk_user_mod,";
+ $sql .= " t.tms";
- $sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
+ $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
if (!empty($id)) {
- $sql.= " WHERE t.fk_element = ".$id." AND type_element='mailing'";
- }else {
- $sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='mailing'";
+ $sql .= " WHERE t.fk_element = ".$id." AND type_element='mailing'";
+ } else {
+ $sql .= " WHERE t.fk_element = ".$this->fk_element." AND type_element='mailing'";
}
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
+ $this->id = $obj->rowid;
$this->name = $obj->name;
$this->entity = $obj->entity;
@@ -300,7 +300,7 @@ class AdvanceTargetingMailing extends CommonObject
}
else
{
- $this->error="Error ".$this->db->lasterror();
+ $this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
@@ -322,34 +322,34 @@ class AdvanceTargetingMailing extends CommonObject
// phpcs:enable
global $langs;
$sql = "SELECT";
- $sql.= " t.rowid,";
+ $sql .= " t.rowid,";
- $sql.= " t.name,";
- $sql.= " t.entity,";
- $sql.= " t.fk_element,";
- $sql.= " t.type_element,";
- $sql.= " t.filtervalue,";
- $sql.= " t.fk_user_author,";
- $sql.= " t.datec,";
- $sql.= " t.fk_user_mod,";
- $sql.= " t.tms";
+ $sql .= " t.name,";
+ $sql .= " t.entity,";
+ $sql .= " t.fk_element,";
+ $sql .= " t.type_element,";
+ $sql .= " t.filtervalue,";
+ $sql .= " t.fk_user_author,";
+ $sql .= " t.datec,";
+ $sql .= " t.fk_user_mod,";
+ $sql .= " t.tms";
- $sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
+ $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
if (!empty($id)) {
- $sql.= " WHERE t.fk_element = ".$id." AND type_element='$type_element'";
- }else {
- $sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='$type_element'";
+ $sql .= " WHERE t.fk_element = ".$id." AND type_element='$type_element'";
+ } else {
+ $sql .= " WHERE t.fk_element = ".$this->fk_element." AND type_element='$type_element'";
}
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
+ $this->id = $obj->rowid;
$this->name = $obj->name;
$this->entity = $obj->entity;
@@ -367,7 +367,7 @@ class AdvanceTargetingMailing extends CommonObject
}
else
{
- $this->error="Error ".$this->db->lasterror();
+ $this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
@@ -383,13 +383,13 @@ class AdvanceTargetingMailing extends CommonObject
public function update($user, $notrigger = 0)
{
global $conf, $langs;
- $error=0;
+ $error = 0;
// Clean parameters
- if (isset($this->fk_element)) $this->fk_element=(int) $this->fk_element;
- if (isset($this->type_element)) $this->type_element=trim($this->type_element);
- if (isset($this->name)) $this->name=trim($this->name);
- if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue);
+ if (isset($this->fk_element)) $this->fk_element = (int) $this->fk_element;
+ if (isset($this->type_element)) $this->type_element = trim($this->type_element);
+ if (isset($this->name)) $this->name = trim($this->name);
+ if (isset($this->filtervalue)) $this->filtervalue = trim($this->filtervalue);
// Check parameters
// Put here code to add a control on parameters values
@@ -397,21 +397,21 @@ class AdvanceTargetingMailing extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."advtargetemailing SET";
- $sql.= " name=".(isset($this->name)?"'".$this->db->escape($this->name)."'":"''").",";
- $sql.= " entity=".$conf->entity.",";
- $sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").",";
- $sql.= " type_element=".(isset($this->type_element)?"'".$this->db->escape($this->type_element)."'":"null").",";
- $sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").",";
- $sql.= " fk_user_mod=".$user->id;
+ $sql .= " name=".(isset($this->name) ? "'".$this->db->escape($this->name)."'" : "''").",";
+ $sql .= " entity=".$conf->entity.",";
+ $sql .= " fk_element=".(isset($this->fk_element) ? $this->fk_element : "null").",";
+ $sql .= " type_element=".(isset($this->type_element) ? "'".$this->db->escape($this->type_element)."'" : "null").",";
+ $sql .= " filtervalue=".(isset($this->filtervalue) ? "'".$this->db->escape($this->filtervalue)."'" : "null").",";
+ $sql .= " fk_user_mod=".$user->id;
- $sql.= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
- if (! $resql) {
+ if (!$resql) {
$error++;
- $this->errors[]="Error ".$this->db->lasterror();
+ $this->errors[] = "Error ".$this->db->lasterror();
}
//if (! $error)
@@ -433,13 +433,13 @@ class AdvanceTargetingMailing extends CommonObject
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -458,13 +458,13 @@ class AdvanceTargetingMailing extends CommonObject
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
- $error=0;
+ $error = 0;
$this->db->begin();
- if (! $error)
+ if (!$error)
{
- if (! $notrigger)
+ if (!$notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@@ -478,26 +478,26 @@ class AdvanceTargetingMailing extends CommonObject
}
}
- if (! $error)
+ if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."advtargetemailing";
- $sql.= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
}
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -516,17 +516,17 @@ class AdvanceTargetingMailing extends CommonObject
*/
public function savequery($user, $arrayquery)
{
- global $langs,$conf;
+ global $langs, $conf;
if (!empty($arrayquery)) {
- $result=$this->fetch_by_mailing($this->fk_element);
- $this->filtervalue=json_encode($arrayquery);
- if ($result<0) {
+ $result = $this->fetch_by_mailing($this->fk_element);
+ $this->filtervalue = json_encode($arrayquery);
+ if ($result < 0) {
return -1;
}
if (!empty($this->id)) {
$this->update($user);
- }else {
+ } else {
$this->create($user);
}
}
@@ -662,7 +662,7 @@ class AdvanceTargetingMailing extends CommonObject
if ($num)
{
- while( $i < $num)
+ while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
@@ -675,8 +675,8 @@ class AdvanceTargetingMailing extends CommonObject
return $num;
} else {
- $this->error = "Error " . $this->db->lasterror();
- dol_syslog(get_class($this) . "::query_thirdparty " . $this->error, LOG_ERR);
+ $this->error = "Error ".$this->db->lasterror();
+ dol_syslog(get_class($this)."::query_thirdparty ".$this->error, LOG_ERR);
return -1;
}
}
@@ -905,7 +905,7 @@ class AdvanceTargetingMailing extends CommonObject
if ($num)
{
- while( $i < $num)
+ while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
@@ -918,8 +918,8 @@ class AdvanceTargetingMailing extends CommonObject
return $num;
} else {
- $this->error = "Error " . $this->db->lasterror();
- dol_syslog(get_class($this) . "::query_contact " . $this->error, LOG_ERR);
+ $this->error = "Error ".$this->db->lasterror();
+ dol_syslog(get_class($this)."::query_contact ".$this->error, LOG_ERR);
return -1;
}
}
@@ -940,26 +940,26 @@ class AdvanceTargetingMailing extends CommonObject
//This is a multiple value test
if (preg_match('/;/', $criteria)) {
- $return_sql_not_like=array();
- $return_sql_like=array();
+ $return_sql_not_like = array();
+ $return_sql_like = array();
- $criteria_array=explode(';', $criteria);
- foreach($criteria_array as $inter_criteria) {
+ $criteria_array = explode(';', $criteria);
+ foreach ($criteria_array as $inter_criteria) {
if (preg_match('/!/', $inter_criteria)) {
- $return_sql_not_like[]= '('.$column_to_test.' NOT LIKE \''.str_replace('!', '', $inter_criteria).'\')';
+ $return_sql_not_like[] = '('.$column_to_test.' NOT LIKE \''.str_replace('!', '', $inter_criteria).'\')';
} else {
- $return_sql_like[]= '('.$column_to_test.' LIKE \''.$inter_criteria.'\')';
+ $return_sql_like[] = '('.$column_to_test.' LIKE \''.$inter_criteria.'\')';
}
}
- if (count($return_sql_like)>0) {
- $return_sql_criteria .= '(' . implode(' OR ', $return_sql_like) .')';
+ if (count($return_sql_like) > 0) {
+ $return_sql_criteria .= '('.implode(' OR ', $return_sql_like).')';
}
- if (count($return_sql_not_like)>0) {
- $return_sql_criteria .= ' AND (' . implode(' AND ', $return_sql_not_like).')';
+ if (count($return_sql_not_like) > 0) {
+ $return_sql_criteria .= ' AND ('.implode(' AND ', $return_sql_not_like).')';
}
} else {
- $return_sql_criteria .= $column_to_test . ' LIKE \''.$this->db->escape($criteria).'\'';
+ $return_sql_criteria .= $column_to_test.' LIKE \''.$this->db->escape($criteria).'\'';
}
$return_sql_criteria .= ')';
diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php
index 0e3d7a7725e..b38a796d3c7 100644
--- a/htdocs/comm/mailing/list.php
+++ b/htdocs/comm/mailing/list.php
@@ -29,22 +29,22 @@ require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
$langs->load("mails");
// Security check
-$result=restrictedArea($user, 'mailing');
+$result = restrictedArea($user, 'mailing');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="m.date_creat";
+if (!$sortorder) $sortorder = "DESC";
+if (!$sortfield) $sortfield = "m.date_creat";
-$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
-$search_ref=GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
-$filteremail=GETPOST('filteremail', 'alpha');
+$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
+$search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
+$filteremail = GETPOST('filteremail', 'alpha');
$object = new Mailing($db);
@@ -55,7 +55,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
-$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
@@ -69,11 +69,11 @@ $fieldstosearchall = array(
* Actions
*/
-if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
+if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
-$parameters=array();
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
@@ -82,7 +82,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
- if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') ||GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
/*foreach($object->fields as $key => $val)
{
@@ -90,13 +90,13 @@ if (empty($reshook))
}*/
$search_ref = '';
$search_all = '';
- $toselect='';
- $search_array_options=array();
+ $toselect = '';
+ $search_array_options = array();
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
{
- $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
+ $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
// Mass actions
@@ -121,28 +121,28 @@ $form = new Form($db);
if ($filteremail)
{
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,";
- $sql.= " mc.statut as sendstatut";
- $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
- $sql.= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
- $sql.= " AND mc.email = '".$db->escape($filteremail)."'";
- if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'";
- if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
- if (! $sortorder) $sortorder="ASC";
- if (! $sortfield) $sortfield="m.rowid";
- $sql.= $db->order($sortfield, $sortorder);
- $sql.= $db->plimit($conf->liste_limit +1, $offset);
+ $sql .= " mc.statut as sendstatut";
+ $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
+ $sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
+ $sql .= " AND mc.email = '".$db->escape($filteremail)."'";
+ if ($search_ref) $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
+ if ($search_all) $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
+ if (!$sortorder) $sortorder = "ASC";
+ if (!$sortfield) $sortfield = "m.rowid";
+ $sql .= $db->order($sortfield, $sortorder);
+ $sql .= $db->plimit($conf->liste_limit + 1, $offset);
}
else
{
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
- $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
- $sql.= " WHERE m.entity = ".$conf->entity;
- if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'";
- if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
- if (! $sortorder) $sortorder="ASC";
- if (! $sortfield) $sortfield="m.rowid";
- $sql.= $db->order($sortfield, $sortorder);
- $sql.= $db->plimit($conf->liste_limit +1, $offset);
+ $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
+ $sql .= " WHERE m.entity = ".$conf->entity;
+ if ($search_ref) $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
+ if ($search_all) $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
+ if (!$sortorder) $sortorder = "ASC";
+ if (!$sortfield) $sortfield = "m.rowid";
+ $sql .= $db->order($sortfield, $sortorder);
+ $sql .= $db->plimit($conf->liste_limit + 1, $offset);
}
//print $sql;
@@ -151,19 +151,19 @@ if ($result)
{
$num = $db->num_rows($result);
- $title=$langs->trans("ListOfEMailings");
- if ($filteremail) $title.=' ('.$langs->trans("SentTo", $filteremail).')';
+ $title = $langs->trans("ListOfEMailings");
+ if ($filteremail) $title .= ' ('.$langs->trans("SentTo", $filteremail).')';
- $newcardbutton='';
+ $newcardbutton = '';
if ($user->rights->mailing->creer)
{
- $newcardbutton.= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create');
+ $newcardbutton .= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create');
}
$i = 0;
$param = "&search_all=".urlencode($search_all);
- if ($filteremail) $param.='&filteremail='.urlencode($filteremail);
+ if ($filteremail) $param .= '&filteremail='.urlencode($filteremail);
print ' | ';
@@ -707,7 +707,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
// Checkbox
print '';
print '';
- print ' | ' ;
+ print '';
print ' ';
@@ -719,7 +719,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '';
// Buttons actions
- print '
global->INVOICE_CLOSE_ORDERS_OFF_BY_DEFAULT_FORMASSINVOICE)?' checked="checked"':'').' name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
+ print ' global->INVOICE_CLOSE_ORDERS_OFF_BY_DEFAULT_FORMASSINVOICE) ? ' checked="checked"' : '').' name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
print ' ';
print '';
print '';
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 980cf6bd8f2..23f92c773f4 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -29,19 +29,19 @@
*/
require '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
-if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
+if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
+if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("banks","bills","categories","companies","compta"));
+$langs->loadLangs(array("banks", "bills", "categories", "companies", "compta"));
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
@@ -59,17 +59,17 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('bankcard','globalcard'));
+$hookmanager->initHooks(array('bankcard', 'globalcard'));
/*
* Actions
*/
-if ($cancel) $action='';
+if ($cancel) $action = '';
if ($action == 'add')
{
- $error=0;
+ $error = 0;
$db->begin();
@@ -124,26 +124,26 @@ if ($action == 'add')
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
- $action='create'; // Force chargement page en mode creation
+ $action = 'create'; // Force chargement page en mode creation
$error++;
}
if (empty($object->ref))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
- $action='create'; // Force chargement page en mode creation
+ $action = 'create'; // Force chargement page en mode creation
$error++;
}
if (empty($object->label))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
- $action='create'; // Force chargement page en mode creation
+ $action = 'create'; // Force chargement page en mode creation
$error++;
}
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
- if (! $error)
+ if (!$error)
{
$id = $object->create($user);
if ($id > 0)
@@ -152,19 +152,19 @@ if ($action == 'add')
$categories = GETPOST('categories', 'array');
$object->setCategories($categories);
- $_GET["id"]=$id; // Force chargement page en mode visu
+ $_GET["id"] = $id; // Force chargement page en mode visu
- $action='';
+ $action = '';
}
else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
- $action='create'; // Force chargement page en mode creation
+ $action = 'create'; // Force chargement page en mode creation
}
}
- if (! $error)
+ if (!$error)
{
$db->commit();
}
@@ -176,7 +176,7 @@ if ($action == 'add')
if ($action == 'update')
{
- $error=0;
+ $error = 0;
// Update account
$object = new Account($db);
@@ -225,31 +225,31 @@ if ($action == 'update')
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
- $action='edit'; // Force chargement page en mode creation
+ $action = 'edit'; // Force chargement page en mode creation
$error++;
}
if (empty($object->ref))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
- $action='edit'; // Force chargement page en mode creation
+ $action = 'edit'; // Force chargement page en mode creation
$error++;
}
if (empty($object->label))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
- $action='edit'; // Force chargement page en mode creation
+ $action = 'edit'; // Force chargement page en mode creation
$error++;
}
$db->begin();
- if (! $error)
+ if (!$error)
{
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
}
- if (! $error)
+ if (!$error)
{
$result = $object->update($user);
if ($result >= 0)
@@ -258,17 +258,17 @@ if ($action == 'update')
$categories = GETPOST('categories', 'array');
$object->setCategories($categories);
- $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
+ $_GET["id"] = $_POST["id"]; // Force chargement page en mode visu
}
else
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
- $action='edit'; // Force chargement page edition
+ $action = 'edit'; // Force chargement page edition
}
}
- if (! $error)
+ if (!$error)
{
$db->commit();
}
@@ -306,11 +306,11 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
$form = new Form($db);
$formbank = new FormBank($db);
$formcompany = new FormCompany($db);
-if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
+if (!empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
-$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
+$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
-$title = $langs->trans("FinancialAccount") . " - " . $langs->trans("Card");
+$title = $langs->trans("FinancialAccount")." - ".$langs->trans("Card");
$helpurl = "";
llxHeader("", $title, $helpurl);
@@ -319,7 +319,7 @@ llxHeader("", $title, $helpurl);
if ($action == 'create')
{
- $object=new Account($db);
+ $object = new Account($db);
print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'title_bank.png');
@@ -350,7 +350,7 @@ if ($action == 'create')
// Ref
print ' | '.$langs->trans("Ref").' | ';
- print 'ref).'" maxlength="12" autofocus> | ';
+ print 'ref).'" maxlength="12" autofocus> | ';
// Label
print '| '.$langs->trans("LabelBankCashAccount").' | ';
@@ -359,15 +359,15 @@ if ($action == 'create')
// Type
print ' | '.$langs->trans("AccountType").' | ';
print '';
- $formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]: Account::TYPE_CURRENT, "type");
+ $formbank->selectTypeOfBankAccount(isset($_POST["type"]) ? $_POST["type"] : Account::TYPE_CURRENT, "type");
print ' | ';
// Currency
print '| '.$langs->trans("Currency").' | ';
print '';
- $selectedcode=$object->currency_code;
- if (! $selectedcode) $selectedcode=$conf->currency;
- print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
+ $selectedcode = $object->currency_code;
+ if (!$selectedcode) $selectedcode = $conf->currency;
+ print $form->selectCurrency((isset($_POST["account_currency_code"]) ? $_POST["account_currency_code"] : $selectedcode), 'account_currency_code');
//print $langs->trans("Currency".$conf->currency);
//print '';
print ' | ';
@@ -375,17 +375,17 @@ if ($action == 'create')
// Status
print '| '.$langs->trans("Status").' | ';
print '';
- print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int')!=''?GETPOST("clos", 'int'):$object->clos));
+ print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos));
print ' | ';
// Country
- $selectedcode='';
+ $selectedcode = '';
if (isset($_POST["account_country_id"]))
{
- $selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$object->country_code;
+ $selectedcode = $_POST["account_country_id"] ? $_POST["account_country_id"] : $object->country_code;
}
- elseif (empty($selectedcode)) $selectedcode=$mysoc->country_code;
- $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
+ elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code;
+ $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
print '| '.$langs->trans("BankAccountCountry").' | ';
print '';
@@ -397,7 +397,7 @@ if ($action == 'create')
print ' | | '.$langs->trans('State').' | ';
if ($selectedcode)
{
- $formcompany->select_departement(isset($_POST["account_state_id"])?$_POST["account_state_id"]:'', $selectedcode, 'account_state_id');
+ $formcompany->select_departement(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : '', $selectedcode, 'account_state_id');
}
else
{
@@ -433,13 +433,13 @@ if ($action == 'create')
print ' | ';
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('account_comment', (GETPOST("account_comment")?GETPOST("account_comment"):$object->comment), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4, '90%');
+ $doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4, '90%');
$doleditor->Create();
print ' | ';
// Other attributes
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -454,7 +454,7 @@ if ($action == 'create')
// Sold
print '| '.$langs->trans("InitialBankBalance").' | ';
- print 'solde)).'"> | ';
+ print 'solde)).'"> | ';
print '| '.$langs->trans("Date").' | ';
print '';
@@ -462,10 +462,10 @@ if ($action == 'create')
print ' | ';
print '| '.$langs->trans("BalanceMinimalAllowed").' | ';
- print 'min_allowed).'"> | ';
+ print 'min_allowed).'"> | ';
print '| '.$langs->trans("BalanceMinimalDesired").' | ';
- print 'min_desired).'"> | ';
+ print 'min_desired).'"> | ';
print ' ';
print ' ';
@@ -476,7 +476,7 @@ if ($action == 'create')
// If bank account
print ' | | '.$langs->trans("BankName").' | ';
- print ' | ';
+ print ' | ';
print ' ';
// Show fields of bank account
@@ -500,32 +500,32 @@ if ($action == 'create')
}
print ''.$langs->trans($val).' | ';
- print ' | ';
+ print ' | ';
print '';
}
$ibankey = FormBank::getIBANLabel($object);
- $bickey="BICNumber";
- if ($object->getCountryCode() == 'IN') $bickey="SWIFT";
+ $bickey = "BICNumber";
+ if ($object->getCountryCode() == 'IN') $bickey = "SWIFT";
// IBAN
print '| '.$langs->trans($ibankey).' | ';
- print ' | ';
+ print ' | ';
print '| '.$langs->trans($bickey).' | ';
- print ' | ';
+ print ' | ';
print '| '.$langs->trans("BankAccountDomiciliation").' | ';
print " | ";
print '| '.$langs->trans("BankAccountOwner").' | ';
- print '';
+ print ' | ';
print ' | ';
print '| '.$langs->trans("BankAccountOwnerAddress").' | ';
print " | ";
print ' ';
@@ -534,10 +534,10 @@ if ($action == 'create')
print '';
// Accountancy code
- $fieldrequired='';
- if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired='fieldrequired ';
+ $fieldrequired = '';
+ if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired = 'fieldrequired ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print '| '.$langs->trans("AccountancyCode").' | ';
print '';
@@ -547,11 +547,11 @@ if ($action == 'create')
else
{
print ' | | '.$langs->trans("AccountancyCode").' | ';
- print 'account_number).'"> | ';
+ print 'account_number).'"> | ';
}
// Accountancy journal
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print '| '.$langs->trans("AccountancyJournal").' | ';
print '';
@@ -564,9 +564,9 @@ if ($action == 'create')
dol_fiche_end();
print ' ';
- print '';
+ print '';
print ' ';
- print '';
+ print '';
print ' ';
print '';
@@ -588,11 +588,11 @@ else
if ($_GET["ref"])
{
$object->fetch(0, $_GET["ref"]);
- $_GET["id"]=$object->id;
+ $_GET["id"] = $object->id;
}
// Show tabs
- $head=bank_prepare_head($object);
+ $head = bank_prepare_head($object);
dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
$formconfirm = '';
@@ -608,7 +608,7 @@ else
$linkback = ''.$langs->trans("BackToList").'';
- $morehtmlref='';
+ $morehtmlref = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@@ -648,7 +648,7 @@ else
// Accountancy code
print ' | | '.$langs->trans("AccountancyCode").' | ';
print '';
- if (! empty($conf->accounting->enabled)) {
+ if (!empty($conf->accounting->enabled)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_number, 1);
@@ -659,7 +659,7 @@ else
print ' | ';
// Accountancy journal
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print '| '.$langs->trans("AccountancyJournal").' | ';
print '';
@@ -675,7 +675,7 @@ else
// Other attributes
$cols = 2;
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print ' | ';
@@ -725,13 +725,13 @@ else
}
$ibankey = FormBank::getIBANLabel($object);
- $bickey="BICNumber";
- if ($object->getCountryCode() == 'IN') $bickey="SWIFT";
+ $bickey = "BICNumber";
+ if ($object->getCountryCode() == 'IN') $bickey = "SWIFT";
print ' | | '.$langs->trans($ibankey).' | ';
print ''.$object->iban.' ';
- if (! empty($object->iban)) {
- if (! checkIbanForAccount($object)) {
+ if (!empty($object->iban)) {
+ if (!checkIbanForAccount($object)) {
print img_picto($langs->trans("IbanNotValid"), 'warning');
} else {
print img_picto($langs->trans("IbanValid"), 'info');
@@ -741,8 +741,8 @@ else
print ' | | '.$langs->trans($bickey).' | ';
print ''.$object->bic.' ';
- if (! empty($object->bic)) {
- if (! checkSwiftForAccount($object)) {
+ if (!empty($object->bic)) {
+ if (!checkSwiftForAccount($object)) {
print img_picto($langs->trans("SwiftNotValid"), 'warning');
} else {
print img_picto($langs->trans("SwiftValid"), 'info');
@@ -783,7 +783,7 @@ else
print 'id.'">'.$langs->trans("Modify").'';
}
- $canbedeleted=$object->can_be_deleted(); // Renvoi vrai si compte sans mouvements
+ $canbedeleted = $object->can_be_deleted(); // Renvoi vrai si compte sans mouvements
if ($user->rights->banque->configurer && $canbedeleted)
{
print 'id.'">'.$langs->trans("Delete").'';
@@ -837,16 +837,16 @@ else
// Ref
print ' | | '.$langs->trans("Ref").' | ';
- print 'ref).'"> | ';
+ print 'ref).'"> | ';
// Label
print '| '.$langs->trans("Label").' | ';
- print 'label).'"> | ';
+ print 'label).'"> | ';
// Type
print '| '.$langs->trans("AccountType").' | ';
print '';
- $formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type), "type");
+ $formbank->selectTypeOfBankAccount((isset($_POST["type"]) ? $_POST["type"] : $object->type), "type");
print ' | ';
// Currency
@@ -854,9 +854,9 @@ else
print '';
print '';
print '';
- $selectedcode=$object->currency_code;
- if (! $selectedcode) $selectedcode=$conf->currency;
- print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
+ $selectedcode = $object->currency_code;
+ if (!$selectedcode) $selectedcode = $conf->currency;
+ print $form->selectCurrency((isset($_POST["account_currency_code"]) ? $_POST["account_currency_code"] : $selectedcode), 'account_currency_code');
//print $langs->trans("Currency".$conf->currency);
//print '';
print ' | ';
@@ -864,15 +864,15 @@ else
// Status
print '| '.$langs->trans("Status").' | ';
print '';
- print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos));
+ print $form->selectarray("clos", $object->status, (isset($_POST["clos"]) ? $_POST["clos"] : $object->clos));
print ' | ';
// Country
- $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id;
- $selectedcode=$object->country_code;
- if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
- elseif (empty($selectedcode)) $selectedcode=$mysoc->country_code;
- $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
+ $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
+ $selectedcode = $object->country_code;
+ if (isset($_POST["account_country_id"])) $selectedcode = $_POST["account_country_id"];
+ elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code;
+ $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
print '| '.$langs->trans("Country").' | ';
print '';
@@ -884,7 +884,7 @@ else
print ' | | '.$langs->trans('State').' | ';
if ($selectedcode)
{
- print $formcompany->select_state(isset($_POST["account_state_id"])?$_POST["account_state_id"]:$object->state_id, $selectedcode, 'account_state_id');
+ print $formcompany->select_state(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : $object->state_id, $selectedcode, 'account_state_id');
}
else
{
@@ -895,22 +895,22 @@ else
// Conciliable
print ' | | '.$langs->trans("Conciliable").' | ';
print '';
- $conciliate=$object->canBeConciliated();
+ $conciliate = $object->canBeConciliated();
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
- else print ' 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
+ else print ' 0) ? '' : ' checked="checked"').'"> '.$langs->trans("DisableConciliation");
print ' | ';
// Balance
print '| '.$langs->trans("BalanceMinimalAllowed").' | ';
- print 'min_allowed).'"> | ';
+ print 'min_allowed).'"> | ';
print '| '.$langs->trans("BalanceMinimalDesired").' | ';
- print 'min_desired).'"> | ';
+ print 'min_desired).'"> | ';
// Web
print '| '.$langs->trans("Web").' | ';
- print 'url).'">';
+ print ' | url).'">';
print ' | ';
// Tags-Categories
@@ -935,13 +935,13 @@ else
print '';
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('account_comment', (GETPOST("account_comment")?GETPOST("account_comment"):$object->comment), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4, '95%');
+ $doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4, '95%');
$doleditor->Create();
print ' | ';
// Other attributes
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -973,7 +973,7 @@ else
print '';
// Accountancy journal
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print '| '.$langs->trans("AccountancyJournal").' | ';
print '';
@@ -1022,8 +1022,8 @@ else
}
$ibankey = FormBank::getIBANLabel($object);
- $bickey="BICNumber";
- if ($object->getCountryCode() == 'IN') $bickey="SWIFT";
+ $bickey = "BICNumber";
+ if ($object->getCountryCode() == 'IN') $bickey = "SWIFT";
// IBAN
print ' | | '.$langs->trans($ibankey).' | ';
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 2244a73b02a..3a9db058c91 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -64,8 +64,8 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortfield) $sortfield='b.label';
-if (! $sortorder) $sortorder='ASC';
+if (!$sortfield) $sortfield = 'b.label';
+if (!$sortorder) $sortorder = 'ASC';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Account($db);
@@ -82,14 +82,14 @@ $fieldstosearchall = array(
'b.label'=>'Label',
);
-$checkedtypetiers=0;
-$arrayfields=array(
+$checkedtypetiers = 0;
+$arrayfields = array(
'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1),
'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
- 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(! empty($conf->accounting->enabled) || ! empty($conf->accounting->enabled))),
- 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(! empty($conf->accounting->enabled) || ! empty($conf->accounting->enabled))),
+ 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled))),
+ 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled))),
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0),
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
@@ -114,11 +114,11 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
* Actions
*/
-if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
+if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
-$parameters=array('socid'=>$socid);
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array('socid'=>$socid);
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
@@ -126,10 +126,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
- $search_ref='';
- $search_label='';
- $search_number='';
- $search_status='';
+ $search_ref = '';
+ $search_label = '';
+ $search_number = '';
+ $search_status = '';
}
@@ -179,7 +179,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $db->num_rows($result);
}
-$sql.= $db->plimit($limit + 1, $offset);
+$sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
if ($resql)
@@ -198,41 +198,41 @@ else dol_print_error($db);
-$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
+$help_url = 'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
llxHeader('', $title, $help_url);
-$link='';
+$link = '';
$num_rows = count($accounts);
-$arrayofselected=is_array($toselect)?$toselect:array();
+$arrayofselected = is_array($toselect) ? $toselect : array();
-$param='';
-if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
-if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
-if ($search_ref != '') $param.='&search_ref='.$search_ref;
-if ($search_label != '') $param.='&search_label='.$search_label;
-if ($search_number != '') $param.='&search_number='.$search_number;
-if ($search_status != '') $param.='&search_status='.$search_status;
-if ($show_files) $param.='&show_files=' .$show_files;
-if ($optioncss != '') $param.='&optioncss='.$optioncss;
+$param = '';
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
+if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
+if ($search_ref != '') $param .= '&search_ref='.$search_ref;
+if ($search_label != '') $param .= '&search_label='.$search_label;
+if ($search_number != '') $param .= '&search_number='.$search_number;
+if ($search_status != '') $param .= '&search_status='.$search_status;
+if ($show_files) $param .= '&show_files='.$show_files;
+if ($optioncss != '') $param .= '&optioncss='.$optioncss;
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
-$arrayofmassactions = array(
+$arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"),
);
-if ($user->rights->banque->supprimer) $arrayofmassactions['predelete']=''.$langs->trans("Delete");
-if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
-$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
+if ($user->rights->banque->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete");
+if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
+$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
-$newcardbutton='';
+$newcardbutton = '';
if ($user->rights->banque->configurer)
{
- $newcardbutton.= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create');
+ $newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create');
}
@@ -249,89 +249,89 @@ print '';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank', 0, $newcardbutton, '', $limit, 1);
-$topicmail="Information";
+$topicmail = "Information";
//$modelmail="subscription";
-$objecttmp=new Account($db);
+$objecttmp = new Account($db);
//$trackid='sub'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
{
- foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
- print ''.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).' ';
+ foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
+ print ''.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).' ';
}
-$moreforfilter='';
+$moreforfilter = '';
// Bank accounts
-$parameters=array();
-$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
-if (! empty($moreforfilter))
+if (!empty($moreforfilter))
{
print '';
print $moreforfilter;
print ' ';
}
-$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
-$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '';
-print ' '."\n";
+print ''."\n";
print '';
// Ref
-if (! empty($arrayfields['b.ref']['checked']))
+if (!empty($arrayfields['b.ref']['checked']))
{
print '| ';
print '';
print ' | ';
}
// Label
-if (! empty($arrayfields['b.label']['checked']))
+if (!empty($arrayfields['b.label']['checked']))
{
print '';
print '';
print ' | ';
}
// Account type
-if (! empty($arrayfields['accountype']['checked']))
+if (!empty($arrayfields['accountype']['checked']))
{
print '';
print ' | ';
}
// Bank number
-if (! empty($arrayfields['b.number']['checked']))
+if (!empty($arrayfields['b.number']['checked']))
{
print '';
print '';
print ' | ';
}
// Account number
-if (! empty($arrayfields['b.account_number']['checked']))
+if (!empty($arrayfields['b.account_number']['checked']))
{
print '';
print ' | ';
}
// Accountancy journal
-if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
+if (!empty($arrayfields['b.fk_accountancy_journal']['checked']))
{
print '';
print ' | ';
}
// Transactions to reconcile
-if (! empty($arrayfields['toreconcile']['checked']))
+if (!empty($arrayfields['toreconcile']['checked']))
{
print '';
print ' | ';
}
// Currency
-if (! empty($arrayfields['b.currency_code']['checked']))
+if (!empty($arrayfields['b.currency_code']['checked']))
{
print '';
print ' | ';
@@ -340,26 +340,26 @@ if (! empty($arrayfields['b.currency_code']['checked']))
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
-$parameters=array('arrayfields'=>$arrayfields);
-$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
+$parameters = array('arrayfields'=>$arrayfields);
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
-if (! empty($arrayfields['b.datec']['checked']))
+if (!empty($arrayfields['b.datec']['checked']))
{
print '';
print ' | ';
}
// Date modification
-if (! empty($arrayfields['b.tms']['checked']))
+if (!empty($arrayfields['b.tms']['checked']))
{
print '';
print ' | ';
}
// Status
-if (! empty($arrayfields['b.clos']['checked']))
+if (!empty($arrayfields['b.clos']['checked']))
{
print '';
- $array=array(
+ $array = array(
'opened'=>$langs->trans("Opened"),
'closed'=>$langs->trans("Closed")
);
@@ -367,42 +367,42 @@ if (! empty($arrayfields['b.clos']['checked']))
print ' | ';
}
// Balance
-if (! empty($arrayfields['balance']['checked']))
+if (!empty($arrayfields['balance']['checked']))
{
print ' | ';
}
// Action column
print '';
-$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
+$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print ' | ';
print ' ';
// Fields title
print '';
-if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'], $_SERVER["PHP_SELF"], 'b.ref', '', $param, '', $sortfield, $sortorder);
-if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER["PHP_SELF"], 'b.label', '', $param, '', $sortfield, $sortorder);
-if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
-if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'], $_SERVER["PHP_SELF"], 'b.number', '', $param, '', $sortfield, $sortorder);
-if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'], $_SERVER["PHP_SELF"], 'b.account_number', '', $param, '', $sortfield, $sortorder);
-if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.fk_accountancy_journal']['label'], $_SERVER["PHP_SELF"], 'b.fk_accountancy_journal', '', $param, '', $sortfield, $sortorder);
-if (! empty($arrayfields['b.currency_code']['checked'])) print_liste_field_titre($arrayfields['b.currency_code']['label'], $_SERVER["PHP_SELF"], 'b.currency_code', '', $param, '', $sortfield, $sortorder, 'center ');
-if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'], $_SERVER["PHP_SELF"], 'b.ref', '', $param, '', $sortfield, $sortorder);
+if (!empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER["PHP_SELF"], 'b.label', '', $param, '', $sortfield, $sortorder);
+if (!empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
+if (!empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'], $_SERVER["PHP_SELF"], 'b.number', '', $param, '', $sortfield, $sortorder);
+if (!empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'], $_SERVER["PHP_SELF"], 'b.account_number', '', $param, '', $sortfield, $sortorder);
+if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.fk_accountancy_journal']['label'], $_SERVER["PHP_SELF"], 'b.fk_accountancy_journal', '', $param, '', $sortfield, $sortorder);
+if (!empty($arrayfields['b.currency_code']['checked'])) print_liste_field_titre($arrayfields['b.currency_code']['label'], $_SERVER["PHP_SELF"], 'b.currency_code', '', $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
-$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
-$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
-if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'], $_SERVER["PHP_SELF"], "b.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
-if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'], $_SERVER["PHP_SELF"], "b.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
-if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'], $_SERVER["PHP_SELF"], 'b.clos', '', $param, '', $sortfield, $sortorder, 'center ');
-if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
+if (!empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'], $_SERVER["PHP_SELF"], "b.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+if (!empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'], $_SERVER["PHP_SELF"], "b.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+if (!empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'], $_SERVER["PHP_SELF"], 'b.clos', '', $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print " \n";
-$total = array(); $found = 0; $i=0; $lastcurrencycode='';
+$total = array(); $found = 0; $i = 0; $lastcurrencycode = '';
foreach ($accounts as $key=>$type)
{
@@ -488,26 +488,26 @@ foreach ($accounts as $key=>$type)
print '';
}
print '';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Currency
- if (! empty($arrayfields['b.currency_code']['checked']))
+ if (!empty($arrayfields['b.currency_code']['checked']))
{
print '';
print $objecttmp->currency_code;
print ' | ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Transactions to reconcile
- if (! empty($arrayfields['toreconcile']['checked']))
+ if (!empty($arrayfields['toreconcile']['checked']))
{
print '';
if ($objecttmp->rappro)
{
- $result=$objecttmp->load_board($user, $objecttmp->id);
- if ($result<0) {
+ $result = $objecttmp->load_board($user, $objecttmp->id);
+ if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print ''.$result->nbtodo.'';
@@ -571,12 +571,12 @@ foreach ($accounts as $key=>$type)
print ' | ';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
- $selected=0;
- if (in_array($objecttmp->id, $arrayofselected)) $selected=1;
- print '';
+ $selected = 0;
+ if (in_array($objecttmp->id, $arrayofselected)) $selected = 1;
+ print '';
}
print ' | ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
print '';
@@ -586,10 +586,10 @@ foreach ($accounts as $key=>$type)
}
// If no record found
-if (! $found)
+if (!$found)
{
- $colspan=1;
- foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
+ $colspan = 1;
+ foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '| '.$langs->trans("NoRecordFound").' | ';
}
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index 5e7904ad7d6..c80a0cd0ab8 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
-if (! empty($conf->projet->enabled))
+if (!empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
@@ -85,39 +85,39 @@ if (empty($reshook))
{
if ($action != 'addlink')
{
- $urltogo=$backtopage?$backtopage:dol_buildpath('/compta/bank/various_payment/list.php', 1);
+ $urltogo = $backtopage ? $backtopage : dol_buildpath('/compta/bank/various_payment/list.php', 1);
header("Location: ".$urltogo);
exit;
}
- if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id, $ref);
- $action='';
+ if ($id > 0 || !empty($ref)) $ret = $object->fetch($id, $ref);
+ $action = '';
}
if ($action == 'add')
{
- $error=0;
+ $error = 0;
- $datep=dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int'));
- $datev=dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
- if (empty($datev)) $datev=$datep;
+ $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int'));
+ $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
+ if (empty($datev)) $datev = $datep;
- $object->ref=''; // TODO
- $object->accountid=GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0;
- $object->datev=$datev;
- $object->datep=$datep;
- $object->amount=price2num(GETPOST("amount", 'alpha'));
- $object->label=GETPOST("label", 'none');
- $object->note=GETPOST("note", 'none');
- $object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
- $object->num_payment=GETPOST("num_payment", 'alpha');
- $object->fk_user_author=$user->id;
- $object->category_transaction=GETPOST("category_transaction", 'alpha');
+ $object->ref = ''; // TODO
+ $object->accountid = GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0;
+ $object->datev = $datev;
+ $object->datep = $datep;
+ $object->amount = price2num(GETPOST("amount", 'alpha'));
+ $object->label = GETPOST("label", 'none');
+ $object->note = GETPOST("note", 'none');
+ $object->type_payment = GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
+ $object->num_payment = GETPOST("num_payment", 'alpha');
+ $object->fk_user_author = $user->id;
+ $object->category_transaction = GETPOST("category_transaction", 'alpha');
- $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
- $object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "";
+ $object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
+ $object->subledger_account = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "";
- $object->sens=GETPOST('sens');
- $object->fk_project= GETPOST('fk_project', 'int');
+ $object->sens = GETPOST('sens');
+ $object->fk_project = GETPOST('fk_project', 'int');
if (empty($datep) || empty($datev))
{
@@ -137,29 +137,29 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$error++;
}
- if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
+ if (!empty($conf->banque->enabled) && !$object->accountid > 0)
{
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
$error++;
}
// TODO Remove this and allow instead to edit a various payment to enter accounting code
- if (! empty($conf->accounting->enabled) && ! $object->accountancy_code)
+ if (!empty($conf->accounting->enabled) && !$object->accountancy_code)
{
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
$error++;
}
- if (! $error)
+ if (!$error)
{
$db->begin();
- $ret=$object->create($user);
+ $ret = $object->create($user);
if ($ret > 0)
{
$db->commit();
- $urltogo=($backtopage ? $backtopage : DOL_URL_ROOT.'/compta/bank/various_payment/list.php');
+ $urltogo = ($backtopage ? $backtopage : DOL_URL_ROOT.'/compta/bank/various_payment/list.php');
header("Location: ".$urltogo);
exit;
}
@@ -167,29 +167,29 @@ if (empty($reshook))
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
- $action="create";
+ $action = "create";
}
}
- $action='create';
+ $action = 'create';
}
if ($action == 'delete')
{
- $result=$object->fetch($id);
+ $result = $object->fetch($id);
if ($object->rappro == 0)
{
$db->begin();
- $ret=$object->delete($user);
+ $ret = $object->delete($user);
if ($ret > 0)
{
if ($object->fk_bank)
{
- $accountline=new AccountLine($db);
- $result=$accountline->fetch($object->fk_bank);
- if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
+ $accountline = new AccountLine($db);
+ $result = $accountline->fetch($object->fk_bank);
+ if ($result > 0) $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
}
if ($result >= 0)
@@ -200,7 +200,7 @@ if (empty($reshook))
}
else
{
- $object->error=$accountline->error;
+ $object->error = $accountline->error;
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -226,8 +226,8 @@ if (empty($reshook))
llxHeader("", $langs->trans("VariousPayment"));
$form = new Form($db);
-if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
-if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db);
+if (!empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
+if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
if ($id)
{
@@ -271,25 +271,25 @@ if ($action == 'create')
// Date payment
print '| ';
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).' | ';
- print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1);
+ print $form->selectDate((empty($datep) ?-1 : $datep), "datep", '', '', '', 'add', 1, 1);
print ' | ';
// Date value for bank
print '| ';
print $form->editfieldkey('DateValue', 'datev', '', $object, 0).' | ';
- print $form->selectDate((empty($datev)?-1:$datev), "datev", '', '', '', 'add', 1, 1);
+ print $form->selectDate((empty($datev) ?-1 : $datev), "datev", '', '', '', 'add', 1, 1);
print ' | ';
// Label
print '| ';
print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).' | ';
- print '';
+ print '';
print ' | ';
// Sens
print '| ';
print $form->editfieldkey('Sens', 'sens', '', $object, 0, 'string', '', 1).' | ';
- $sensarray=array( '0' => $langs->trans("Debit"), '1' => $langs->trans("Credit"));
+ $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit"));
print $form->selectarray('sens', $sensarray, $sens);
print ' | ';
@@ -300,11 +300,11 @@ if ($action == 'create')
print '';
// Bank
- if (! empty($conf->banque->enabled))
+ if (!empty($conf->banque->enabled))
{
print '| ';
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).' | ';
- $form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant
+ $form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant
print ' | ';
}
@@ -315,7 +315,7 @@ if ($action == 'create')
print '';
// Number
- if (! empty($conf->banque->enabled))
+ if (!empty($conf->banque->enabled))
{
// Number
print ' | ';
@@ -355,7 +355,7 @@ if ($action == 'create')
}
// Accountancy account
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
// TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '| '.$langs->trans("AccountAccounting").' | ';
@@ -371,11 +371,11 @@ if ($action == 'create')
}
// Subledger account
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print ' | '.$langs->trans("SubledgerAccount").' | ';
print '';
- if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
+ if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, '');
}
@@ -484,7 +484,7 @@ if ($id)
print ' | | ';
print $langs->trans("AccountAccounting");
print ' | ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->accountancy_code, 1);
@@ -502,11 +502,11 @@ if ($id)
print $object->subledger_account;
print ' | ';
- if (! empty($conf->banque->enabled))
+ if (!empty($conf->banque->enabled))
{
if ($object->fk_account > 0)
{
- $bankline=new AccountLine($db);
+ $bankline = new AccountLine($db);
$bankline->fetch($object->fk_bank);
print '';
@@ -519,8 +519,8 @@ if ($id)
}
// Other attributes
- $parameters=array('socid'=>$object->id);
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+ $parameters = array('socid'=>$object->id);
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print ' ';
@@ -542,7 +542,7 @@ if ($id)
// Delete
if (empty($object->rappro))
{
- if (! empty($user->rights->banque->modifier))
+ if (!empty($user->rights->banque->modifier))
{
print '';
}
diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php
index 7070946e2c7..6e8fb2a65ea 100644
--- a/htdocs/compta/bank/various_payment/document.php
+++ b/htdocs/compta/bank/various_payment/document.php
@@ -50,22 +50,22 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="ASC";
-if (! $sortfield) $sortfield="name";
+if (!$sortorder) $sortorder = "ASC";
+if (!$sortfield) $sortfield = "name";
$object = new PaymentVarious($db);
$object->fetch($id, $ref);
$upload_dir = $conf->bank->dir_output.'/'.dol_sanitizeFileName($object->id);
-$modulepart='banque';
+$modulepart = 'banque';
/*
* Actions
*/
-include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
+include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
@@ -125,11 +125,11 @@ if ($object->id)
print '';
// Build file list
- $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
- $totalsize=0;
- foreach($filearray as $key => $file)
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file)
{
- $totalsize+=$file['size'];
+ $totalsize += $file['size'];
}
print '';
@@ -146,8 +146,8 @@ if ($object->id)
$modulepart = 'banque';
$permission = $user->rights->banque->modifier;
- $param = '&id=' . $object->id;
- include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
+ $param = '&id='.$object->id;
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php
index 602cd9142cf..ef88c586ede 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_card.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_card.php
@@ -31,20 +31,20 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
-$langs->loadLangs(array("install","cashdesk","admin","banks"));
+$langs->loadLangs(array("install", "cashdesk", "admin", "banks"));
-$id=GETPOST('id', 'int');
+$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$action=GETPOST('action', 'aZ09');
+$action = GETPOST('action', 'aZ09');
$categid = GETPOST('categid');
$label = GETPOST("label");
-$now=dol_now();
-$syear = (GETPOSTISSET('closeyear')?GETPOST('closeyear', 'int'):dol_print_date($now, "%Y"));
-$smonth = (GETPOSTISSET('closemonth')?GETPOST('closemonth', 'int'):dol_print_date($now, "%m"));
-$sday = (GETPOSTISSET('closeday')?GETPOST('closeday', 'int'):dol_print_date($now, "%d"));
+$now = dol_now();
+$syear = (GETPOSTISSET('closeyear') ?GETPOST('closeyear', 'int') : dol_print_date($now, "%Y"));
+$smonth = (GETPOSTISSET('closemonth') ?GETPOST('closemonth', 'int') : dol_print_date($now, "%m"));
+$sday = (GETPOSTISSET('closeday') ?GETPOST('closeday', 'int') : dol_print_date($now, "%d"));
-$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
@@ -52,30 +52,30 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortfield) $sortfield='rowid';
-if (! $sortorder) $sortorder='ASC';
+if (!$sortfield) $sortfield = 'rowid';
+if (!$sortorder) $sortorder = 'ASC';
// Security check
-if (! $user->rights->cashdesk->use && ! $user->rights->takepos->use)
+if (!$user->rights->cashdesk->use && !$user->rights->takepos->use)
{
accessforbidden();
}
-$arrayofpaymentmode=array('cash'=>'Cash', 'cheque'=>'Cheque', 'card'=>'CreditCard');
+$arrayofpaymentmode = array('cash'=>'Cash', 'cheque'=>'Cheque', 'card'=>'CreditCard');
-$arrayofposavailable=array();
-if (! empty($conf->cashdesk->enabled)) $arrayofposavailable['cashdesk']=$langs->trans('CashDesk').' (cashdesk)';
-if (! empty($conf->takepos->enabled)) $arrayofposavailable['takepos']=$langs->trans('TakePOS').' (takepos)';
+$arrayofposavailable = array();
+if (!empty($conf->cashdesk->enabled)) $arrayofposavailable['cashdesk'] = $langs->trans('CashDesk').' (cashdesk)';
+if (!empty($conf->takepos->enabled)) $arrayofposavailable['takepos'] = $langs->trans('TakePOS').' (takepos)';
// TODO Add hook here to allow other POS to add themself
-$object= new CashControl($db);
+$object = new CashControl($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('cashcontrolcard','globalcard'));
+$hookmanager->initHooks(array('cashcontrolcard', 'globalcard'));
/*
@@ -86,7 +86,7 @@ $permissiontoadd = ($user->rights->cashdesk->use || $user->rights->takepos->use)
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
-$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
+$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH1))
{
@@ -99,70 +99,70 @@ if (GETPOST('cancel', 'alpha'))
$action = 'create';
}
-if ($action=="start")
+if ($action == "start")
{
- $error=0;
- if (! GETPOST('posmodule', 'alpha') || GETPOST('posmodule', 'alpha') == '-1')
+ $error = 0;
+ if (!GETPOST('posmodule', 'alpha') || GETPOST('posmodule', 'alpha') == '-1')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Module")), null, 'errors');
- $action='create';
+ $action = 'create';
$error++;
}
if (GETPOST('posnumber', 'alpha') == '')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CashDesk")), null, 'errors');
- $action='create';
+ $action = 'create';
$error++;
}
- if (! GETPOST('closeyear', 'alpha') || GETPOST('closeyear', 'alpha') == '-1')
+ if (!GETPOST('closeyear', 'alpha') || GETPOST('closeyear', 'alpha') == '-1')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Year")), null, 'errors');
- $action='create';
+ $action = 'create';
$error++;
}
}
-elseif ($action=="add")
+elseif ($action == "add")
{
if (GETPOST('opening', 'alpha') == '')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InitialBankBalance")), null, 'errors');
- $action='start';
+ $action = 'start';
$error++;
}
- $error=0;
- foreach($arrayofpaymentmode as $key=>$val)
+ $error = 0;
+ foreach ($arrayofpaymentmode as $key=>$val)
{
$object->$key = price2num(GETPOST($key.'_amount', 'alpha'));
}
- if (! $error)
+ if (!$error)
{
$object->day_close = GETPOST('closeday', 'int');
$object->month_close = GETPOST('closemonth', 'int');
$object->year_close = GETPOST('closeyear', 'int');
- $object->opening=price2num(GETPOST('opening', 'alpha'));
- $object->posmodule=GETPOST('posmodule', 'alpha');
- $object->posnumber=GETPOST('posnumber', 'alpha');
+ $object->opening = price2num(GETPOST('opening', 'alpha'));
+ $object->posmodule = GETPOST('posmodule', 'alpha');
+ $object->posnumber = GETPOST('posnumber', 'alpha');
$db->begin();
- $id=$object->create($user);
+ $id = $object->create($user);
if ($id > 0)
{
$db->commit();
- $action="view";
+ $action = "view";
}
else
{
$db->rollback;
- $action="view";
+ $action = "view";
}
}
}
-if ($action=="close")
+if ($action == "close")
{
$object->fetch($id);
@@ -176,21 +176,21 @@ if ($action=="close")
setEventMessages($langs->trans("CashFenceDone"), null);
}
- $action="view";
+ $action = "view";
}
// Action to delete
-if ($action == 'confirm_delete' && ! empty($permissiontodelete))
+if ($action == 'confirm_delete' && !empty($permissiontodelete))
{
$object->fetch($id);
- if (! ($object->id > 0))
+ if (!($object->id > 0))
{
dol_print_error('', 'Error, object must be fetched before being deleted');
exit;
}
- $result=$object->delete($user);
+ $result = $object->delete($user);
//var_dump($result);
if ($result > 0)
{
@@ -201,7 +201,7 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
}
else
{
- if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
+ if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
}
}
@@ -211,15 +211,15 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
* View
*/
-$form=new Form($db);
+$form = new Form($db);
-if ($action=="create" || $action=="start")
+if ($action == "create" || $action == "start")
{
llxHeader();
- $initialbalanceforterminal=array();
- $theoricalamountforterminal=array();
- $theoricalnbofinvoiceforterminal=array();
+ $initialbalanceforterminal = array();
+ $theoricalamountforterminal = array();
+ $theoricalnbofinvoiceforterminal = array();
if (GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '-1')
{
@@ -227,16 +227,16 @@ if ($action=="create" || $action=="start")
$terminalid = GETPOST('posnumber', 'alpha');
$terminaltouse = $terminalid;
- if ($terminaltouse == '1' && $posmodule=='cashdesk') $terminaltouse = '';
+ if ($terminaltouse == '1' && $posmodule == 'cashdesk') $terminaltouse = '';
- if ($posmodule=='cashdesk' && $terminaltouse != '' && $terminaltouse != '1') {
+ if ($posmodule == 'cashdesk' && $terminaltouse != '' && $terminaltouse != '1') {
$terminaltouse = '';
setEventMessages($langs->trans("OnlyTerminal1IsAvailableForCashDeskModule"), null, 'errors');
$error++;
}
// Calculate $initialbalanceforterminal for terminal 0
- foreach($arrayofpaymentmode as $key => $val)
+ foreach ($arrayofpaymentmode as $key => $val)
{
if ($key != 'cash')
{
@@ -245,18 +245,18 @@ if ($action=="create" || $action=="start")
}
// Get the bank account dedicated to this point of sale module/terminal
- $vartouse='CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse;
- $bankid = $conf->global->$vartouse; // This value is ok for 'Terminal 0' for module 'CashDesk' and 'TakePos' (they manage only 1 terminal)
+ $vartouse = 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse;
+ $bankid = $conf->global->$vartouse; // This value is ok for 'Terminal 0' for module 'CashDesk' and 'TakePos' (they manage only 1 terminal)
// Hook to get the good bank id according to posmodule and posnumber.
// @TODO add hook here
if ($bankid > 0)
{
$sql = "SELECT SUM(amount) as total FROM ".MAIN_DB_PREFIX."bank";
- $sql.= " WHERE fk_account = ".$bankid;
- if ($syear && ! $smonth) $sql.= " AND dateo < '".$db->idate(dol_get_first_day($syear, 1))."'";
- elseif ($syear && $smonth && ! $sday) $sql.= " AND dateo < '".$db->idate(dol_get_first_day($syear, $smonth))."'";
- elseif ($syear && $smonth && $sday) $sql.= " AND dateo < '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."'";
+ $sql .= " WHERE fk_account = ".$bankid;
+ if ($syear && !$smonth) $sql .= " AND dateo < '".$db->idate(dol_get_first_day($syear, 1))."'";
+ elseif ($syear && $smonth && !$sday) $sql .= " AND dateo < '".$db->idate(dol_get_first_day($syear, $smonth))."'";
+ elseif ($syear && $smonth && $sday) $sql .= " AND dateo < '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."'";
else dol_print_error('', 'Year not defined');
$resql = $db->query($sql);
@@ -275,28 +275,28 @@ if ($action=="create" || $action=="start")
}
// Calculate $theoricalamountforterminal for terminal 0
- foreach($arrayofpaymentmode as $key => $val)
+ foreach ($arrayofpaymentmode as $key => $val)
{
/*$sql = "SELECT SUM(amount) as total FROM ".MAIN_DB_PREFIX."bank";
$sql.= " WHERE fk_account = ".$bankid;*/
$sql = "SELECT SUM(pf.amount) as total, COUNT(*) as nb";
- $sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp";
- $sql.= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement";
- $sql.= " AND f.module_source = '".$db->escape($posmodule)."'";
- $sql.= " AND f.pos_source = '".$db->escape($terminalid)."'";
- $sql.= " AND f.paye = 1";
- $sql.= " AND p.entity IN (".getEntity('facture').")";
- if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
- elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
- elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";
+ $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp";
+ $sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement";
+ $sql .= " AND f.module_source = '".$db->escape($posmodule)."'";
+ $sql .= " AND f.pos_source = '".$db->escape($terminalid)."'";
+ $sql .= " AND f.paye = 1";
+ $sql .= " AND p.entity IN (".getEntity('facture').")";
+ if ($key == 'cash') $sql .= " AND cp.code = 'LIQ'";
+ elseif ($key == 'cheque') $sql .= " AND cp.code = 'CHQ'";
+ elseif ($key == 'card') $sql .= " AND cp.code = 'CB'";
else
{
dol_print_error('Value for key = '.$key.' not supported');
exit;
}
- if ($syear && ! $smonth) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'";
- elseif ($syear && $smonth && ! $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, $smonth))."' AND '".$db->idate(dol_get_last_day($syear, $smonth))."'";
- elseif ($syear && $smonth && $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
+ if ($syear && !$smonth) $sql .= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'";
+ elseif ($syear && $smonth && !$sday) $sql .= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, $smonth))."' AND '".$db->idate(dol_get_last_day($syear, $smonth))."'";
+ elseif ($syear && $smonth && $sday) $sql .= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
else dol_print_error('', 'Year not defined');
$resql = $db->query($sql);
@@ -337,53 +337,53 @@ if ($action=="create" || $action=="start")
print ' | ';
print "\n";
- $disabled=0;
- $prefix='close';
+ $disabled = 0;
+ $prefix = 'close';
print '';
- print '| '.$form->selectarray('posmodule', $arrayofposavailable, GETPOST('posmodule', 'alpha'), (count($arrayofposavailable)>1?1:0)).' | ';
+ print ''.$form->selectarray('posmodule', $arrayofposavailable, GETPOST('posmodule', 'alpha'), (count($arrayofposavailable) > 1 ? 1 : 0)).' | ';
print '';
- $array=array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6", 7=>"7", 8=>"8", 9=>"9");
- $selectedposnumber=0; $showempty=1;
+ $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6", 7=>"7", 8=>"8", 9=>"9");
+ $selectedposnumber = 0; $showempty = 1;
if ($conf->global->TAKEPOS_NUM_TERMINALS == '1')
{
- $selectedposnumber=1; $showempty=0;
+ $selectedposnumber = 1; $showempty = 0;
}
- print $form->selectarray('posnumber', $array, GETPOSTISSET('posnumber')?GETPOST('posnumber', 'int'):$selectedposnumber, $showempty);
+ print $form->selectarray('posnumber', $array, GETPOSTISSET('posnumber') ?GETPOST('posnumber', 'int') : $selectedposnumber, $showempty);
//print '';
print ' | ';
// Year
print '';
- $retstring='\n";
print $retstring;
print ' | ';
// Month
print '';
- $retstring='';
- $retstring.='';
- for ($month = 1 ; $month <= 12 ; $month++)
+ $retstring = '';
+ $retstring .= '';
+ for ($month = 1; $month <= 12; $month++)
{
- $retstring.='";
+ $retstring .= '";
}
- $retstring.="";
+ $retstring .= "";
print $retstring;
print ' | ';
// Day
print '';
- $retstring='';
- $retstring.='';
- for ($day = 1 ; $day <= 31; $day++)
+ $retstring = '';
+ $retstring .= '';
+ for ($day = 1; $day <= 31; $day++)
{
- $retstring.='';
+ $retstring .= '';
}
- $retstring.="";
+ $retstring .= "";
print $retstring;
print ' | ';
// Button Start
@@ -425,10 +425,10 @@ if ($action=="create" || $action=="start")
print ''.$langs->trans("Cash");
//print ' '.$langs->trans("TheoricalAmount").' '.$langs->trans("RealAmount");
print ' | ';
- $i=0;
- foreach($arrayofpaymentmode as $key => $val)
+ $i = 0;
+ foreach ($arrayofpaymentmode as $key => $val)
{
- print ''.$langs->trans($val);
+ print ' | '.$langs->trans($val);
//print ' '.$langs->trans("TheoricalAmount").' '.$langs->trans("RealAmount");
print ' | ';
$i++;
@@ -442,10 +442,10 @@ if ($action=="create" || $action=="start")
print '';
print ' | ';
// Amount per payment type
- $i=0;
- foreach($arrayofpaymentmode as $key => $val)
+ $i = 0;
+ foreach ($arrayofpaymentmode as $key => $val)
{
- print '';
+ print ' | ';
print $theoricalnbofinvoiceforterminal[$terminalid][$key];
print ' | ';
$i++;
@@ -461,10 +461,10 @@ if ($action=="create" || $action=="start")
print price($initialbalanceforterminal[$terminalid]['cash']).' ';
print '';
// Amount per payment type
- $i=0;
- foreach($arrayofpaymentmode as $key => $val)
+ $i = 0;
+ foreach ($arrayofpaymentmode as $key => $val)
{
- print '';
+ print ' | ';
print price($theoricalamountforterminal[$terminalid][$key]).' ';
print ' | ';
$i++;
@@ -477,14 +477,14 @@ if ($action=="create" || $action=="start")
print ''.$langs->trans("RealAmount").' | ';
// Initial amount
print '';
- print '';
+ print '';
print ' | ';
// Amount per payment type
- $i=0;
- foreach($arrayofpaymentmode as $key => $val)
+ $i = 0;
+ foreach ($arrayofpaymentmode as $key => $val)
{
- print '';
- print '';
+ print ' | ';
+ print '';
print ' | ';
$i++;
}
@@ -500,23 +500,23 @@ if ($action=="create" || $action=="start")
print '';
}
-if (empty($action) || $action=="view")
+if (empty($action) || $action == "view")
{
$object->fetch($id);
llxHeader('', $langs->trans("CashControl"));
- $head=array();
+ $head = array();
$head[0][0] = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$object->id;
$head[0][1] = $langs->trans("Card");
$head[0][2] = 'cashcontrol';
dol_fiche_head($head, 'cashcontrol', $langs->trans("CashControl"), -1, 'cashcontrol');
- $linkback = '' . $langs->trans("BackToList") . '';
+ $linkback = ''.$langs->trans("BackToList").'';
- $morehtmlref='';
- $morehtmlref.=' ';
+ $morehtmlref = '';
+ $morehtmlref .= ' ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
@@ -563,7 +563,7 @@ if (empty($action) || $action=="view")
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
print " ";
- foreach($arrayofpaymentmode as $key => $val)
+ foreach ($arrayofpaymentmode as $key => $val)
{
print '| '.$langs->trans($val).' | ';
print price($object->$key, 0, $langs, 1, -1, -1, $conf->currency);
@@ -578,12 +578,12 @@ if (empty($action) || $action=="view")
dol_fiche_end();
print '';
- print ' ';
+ print ' ';
if ($object->status == CashControl::STATUS_DRAFT)
{
- print ' ';
+ print ' ';
- print ' ';
+ print ' ';
}
print ' ';
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 72bb79545e5..0c0e3d1a99c 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -89,7 +89,7 @@ elseif ($action == 'swapstatut' && $user->rights->facture->creer)
{
if ($object->fetch($id))
{
- $result=$object->swapContactStatus(GETPOST('ligne'));
+ $result = $object->swapContactStatus(GETPOST('ligne'));
}
else
{
@@ -118,14 +118,14 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer)
* View
*/
-$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('ContactsAddresses');
+$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
$form = new Form($db);
$formcompany = new FormCompany($db);
-$contactstatic=new Contact($db);
-$userstatic=new User($db);
+$contactstatic = new Contact($db);
+$userstatic = new User($db);
/* *************************************************************************** */
@@ -134,7 +134,7 @@ $userstatic=new User($db);
/* */
/* *************************************************************************** */
-if ($id > 0 || ! empty($ref))
+if ($id > 0 || !empty($ref))
{
if ($object->fetch($id, $ref) > 0)
{
@@ -201,10 +201,10 @@ if ($id > 0 || ! empty($ref))
print ' ';
// Contacts lines (modules that overwrite templates must declare this into descriptor)
- $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
- foreach($dirtpls as $reldir)
+ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
+ foreach ($dirtpls as $reldir)
{
- $res=@include dol_buildpath($reldir.'/contacts.tpl.php');
+ $res = @include dol_buildpath($reldir.'/contacts.tpl.php');
if ($res) break;
}
}
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 36f768991f8..91e6ab46c5a 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -63,14 +63,14 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="ASC";
-if (! $sortfield) $sortfield="name";
+if (!$sortorder) $sortorder = "ASC";
+if (!$sortfield) $sortfield = "name";
$object = new Facture($db);
if ($object->fetch($id))
{
$object->fetch_thirdparty();
- $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->facture->dir_output."/".dol_sanitizeFileName($object->ref);
}
@@ -78,20 +78,20 @@ if ($object->fetch($id))
* Actions
*/
-require_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
* View
*/
-$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Documents');
+$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
$form = new Form($db);
-if ($id > 0 || ! empty($ref))
+if ($id > 0 || !empty($ref))
{
if ($object->fetch($id, $ref) > 0)
{
@@ -105,60 +105,60 @@ if ($id > 0 || ! empty($ref))
$totalpaye = $object->getSommePaiement();
// Build file list
- $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
- $totalsize=0;
- foreach($filearray as $key => $file)
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file)
{
- $totalsize+=$file['size'];
+ $totalsize += $file['size'];
}
// Invoice content
- $linkback = '' . $langs->trans("BackToList") . '';
+ $linkback = ''.$langs->trans("BackToList").'';
- $morehtmlref='';
+ $morehtmlref = ' ';
// Ref customer
- $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+ $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+ $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
- $morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'customer');
+ $morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
// Project
- if (! empty($conf->projet->enabled))
+ if (!empty($conf->projet->enabled))
{
$langs->load("projects");
- $morehtmlref.=' '.$langs->trans('Project') . ' ';
+ $morehtmlref .= ' '.$langs->trans('Project').' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
//$morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- $morehtmlref.=' : ';
+ $morehtmlref .= ' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
} else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
- if (! empty($object->fk_project)) {
+ if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref.=' ';
- $morehtmlref.=$proj->ref;
- $morehtmlref.='';
+ $morehtmlref .= ' ';
+ $morehtmlref .= $proj->ref;
+ $morehtmlref .= '';
} else {
- $morehtmlref.='';
+ $morehtmlref .= '';
}
}
}
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
@@ -178,8 +178,8 @@ if ($id > 0 || ! empty($ref))
$modulepart = 'facture';
$permission = $user->rights->facture->creer;
$permtoedit = $user->rights->facture->creer;
- $param = '&id=' . $object->id;
- include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
+ $param = '&id='.$object->id;
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index 6769b184e40..36a2496bdcf 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -28,15 +28,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
-if (! empty($conf->projet->enabled)) {
- include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
+if (!empty($conf->projet->enabled)) {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array('companies', 'bills'));
$id = GETPOST("facid", "int");
-$ref=GETPOST("ref", 'alpha');
+$ref = GETPOST("ref", 'alpha');
/*
@@ -45,7 +45,7 @@ $ref=GETPOST("ref", 'alpha');
$form = new Form($db);
-$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info');
+$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
@@ -62,50 +62,50 @@ $totalpaye = $object->getSommePaiement();
// Invoice content
-$linkback = '' . $langs->trans("BackToList") . '';
+$linkback = ''.$langs->trans("BackToList").'';
-$morehtmlref='';
+$morehtmlref = ' ';
// Ref customer
-$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
-$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
-$morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'customer');
+$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
// Project
-if (! empty($conf->projet->enabled))
+if (!empty($conf->projet->enabled))
{
$langs->load("projects");
- $morehtmlref.=' '.$langs->trans('Project') . ' ';
+ $morehtmlref .= ' '.$langs->trans('Project').' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
//$morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- $morehtmlref.=' : ';
+ $morehtmlref .= ' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
} else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
- if (! empty($object->fk_project)) {
+ if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref.=' ';
- $morehtmlref.=$proj->ref;
- $morehtmlref.='';
+ $morehtmlref .= ' ';
+ $morehtmlref .= $proj->ref;
+ $morehtmlref .= '';
} else {
- $morehtmlref.='';
+ $morehtmlref .= '';
}
}
}
-$morehtmlref.=' ';
+$morehtmlref .= ' ';
-$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index 12e437e6110..3e8ea324fda 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -33,15 +33,15 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
-if (! empty($conf->projet->enabled)) {
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
+if (!empty($conf->projet->enabled)) {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
//require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
}
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'compta', 'admin', 'other'));
@@ -104,19 +104,19 @@ if (($id > 0 || $ref) && $action != 'create' && $action != 'add')
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('invoicereccard','globalcard'));
+$hookmanager->initHooks(array('invoicereccard', 'globalcard'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('facture_rec');
-$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
-$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
+$permissiondellink = $user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php
-$arrayfields=array(
+$arrayfields = array(
'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
'f.total'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
@@ -137,10 +137,10 @@ $arrayfields=array(
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
- foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
- if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
+ if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
+ $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');
@@ -151,8 +151,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
* Actions
*/
-if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
+if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -160,7 +160,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
- if (GETPOST('cancel', 'alpha')) $action='';
+ if (GETPOST('cancel', 'alpha')) $action = '';
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
@@ -168,24 +168,24 @@ if (empty($reshook))
// Do we click on purge search criteria ?
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_ref='';
- $search_societe='';
- $search_montant_ht='';
- $search_montant_vat='';
- $search_montant_ttc='';
- $search_payment_mode='';
- $search_payment_term='';
- $search_day='';
- $search_year='';
- $search_month='';
- $search_day_date_when='';
- $search_year_date_when='';
- $search_month_date_when='';
- $search_recurring='';
- $search_frequency='';
- $search_unit_frequency='';
- $search_status='';
- $search_array_options=array();
+ $search_ref = '';
+ $search_societe = '';
+ $search_montant_ht = '';
+ $search_montant_vat = '';
+ $search_montant_ttc = '';
+ $search_payment_mode = '';
+ $search_payment_term = '';
+ $search_day = '';
+ $search_year = '';
+ $search_month = '';
+ $search_day_date_when = '';
+ $search_year_date_when = '';
+ $search_month_date_when = '';
+ $search_recurring = '';
+ $search_frequency = '';
+ $search_unit_frequency = '';
+ $search_status = '';
+ $search_array_options = array();
}
// Mass actions
@@ -247,22 +247,22 @@ if ($search_societe) $sql .= natural_search('s.nom', $search_societ
if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql .= natural_search('f.total_ttc', $search_montant_ttc, 1);
-if (! empty($search_payment_mode) && $search_payment_mode != '-1') $sql .= natural_search('f.fk_mode_reglement', $search_payment_mode, 1);
-if (! empty($search_payment_term) && $search_payment_term != '-1') $sql .= natural_search('f.fk_cond_reglement', $search_payment_term, 1);
+if (!empty($search_payment_mode) && $search_payment_mode != '-1') $sql .= natural_search('f.fk_mode_reglement', $search_payment_mode, 1);
+if (!empty($search_payment_term) && $search_payment_term != '-1') $sql .= natural_search('f.fk_cond_reglement', $search_payment_term, 1);
if ($search_recurring == '1') $sql .= ' AND f.frequency > 0';
if ($search_recurring == '0') $sql .= ' AND (f.frequency IS NULL or f.frequency = 0)';
if ($search_frequency != '') $sql .= natural_search('f.frequency', $search_frequency, 1);
if ($search_unit_frequency != '') $sql .= ' AND f.frequency > 0'.natural_search('f.unit_frequency', $search_unit_frequency);
if ($search_status != '' && $search_status >= -1)
{
- if ($search_status == 0) $sql.= ' AND frequency = 0 AND suspended = 0';
- if ($search_status == 1) $sql.= ' AND frequency != 0 AND suspended = 0';
- if ($search_status == -1) $sql.= ' AND suspended = 1';
+ if ($search_status == 0) $sql .= ' AND frequency = 0 AND suspended = 0';
+ if ($search_status == 1) $sql .= ' AND frequency != 0 AND suspended = 0';
+ if ($search_status == -1) $sql .= ' AND suspended = 1';
}
-$sql.=dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
-$sql.=dolSqlDateFilter('f.date_last_gen', $search_day_date_when, $search_month_date_when, $search_year_date_when);
+$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
+$sql .= dolSqlDateFilter('f.date_last_gen', $search_day_date_when, $search_month_date_when, $search_year_date_when);
-$sql.= $db->order($sortfield, $sortorder);
+$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@@ -276,43 +276,43 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
}
}
-$sql.= $db->plimit($limit+1, $offset);
+$sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
- $param='';
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
- if ($socid) $param.='&socid='.urlencode($socid);
- if ($search_day) $param.='&search_day='.urlencode($search_day);
- if ($search_month) $param.='&search_month='.urlencode($search_month);
- if ($search_year) $param.='&search_year=' .urlencode($search_year);
- if ($search_day_date_when) $param.='&search_day_date_when='.urlencode($search_day_date_when);
- if ($search_month_date_when) $param.='&search_month_date_when='.urlencode($search_month_date_when);
- if ($search_year_date_when) $param.='&search_year_date_when=' .urlencode($search_year_date_when);
- if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
- if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
- if ($search_montant_ht != '') $param.='&search_montant_ht=' .urlencode($search_montant_ht);
- if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
- if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
- if ($search_payment_mode != '') $param.='&search_payment_mode='.urlencode($search_payment_mode);
- if ($search_payment_type != '') $param.='&search_payment_type='.urlencode($search_payment_type);
- if ($search_recurring != '' && $search_recurrning != '-1') $param.='&search_recurring=' .urlencode($search_recurring);
- if ($search_frequency > 0) $param.='&search_frequency=' .urlencode($search_frequency);
- if ($search_unit_frequency != '') $param.='&search_unit_frequency='.urlencode($search_unit_frequency);
- if ($search_status != '') $param.='&search_status='.urlencode($search_status);
- if ($option) $param.="&option=".urlencode($option);
- if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
+ $param = '';
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
+ if ($socid) $param .= '&socid='.urlencode($socid);
+ if ($search_day) $param .= '&search_day='.urlencode($search_day);
+ if ($search_month) $param .= '&search_month='.urlencode($search_month);
+ if ($search_year) $param .= '&search_year='.urlencode($search_year);
+ if ($search_day_date_when) $param .= '&search_day_date_when='.urlencode($search_day_date_when);
+ if ($search_month_date_when) $param .= '&search_month_date_when='.urlencode($search_month_date_when);
+ if ($search_year_date_when) $param .= '&search_year_date_when='.urlencode($search_year_date_when);
+ if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
+ if ($search_societe) $param .= '&search_societe='.urlencode($search_societe);
+ if ($search_montant_ht != '') $param .= '&search_montant_ht='.urlencode($search_montant_ht);
+ if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat);
+ if ($search_montant_ttc != '') $param .= '&search_montant_ttc='.urlencode($search_montant_ttc);
+ if ($search_payment_mode != '') $param .= '&search_payment_mode='.urlencode($search_payment_mode);
+ if ($search_payment_type != '') $param .= '&search_payment_type='.urlencode($search_payment_type);
+ if ($search_recurring != '' && $search_recurrning != '-1') $param .= '&search_recurring='.urlencode($search_recurring);
+ if ($search_frequency > 0) $param .= '&search_frequency='.urlencode($search_frequency);
+ if ($search_unit_frequency != '') $param .= '&search_unit_frequency='.urlencode($search_unit_frequency);
+ if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
+ if ($option) $param .= "&option=".urlencode($option);
+ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
- $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
+ $massactionbutton = $form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
- $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
- $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
//$selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print ' | ";
print " \n";
@@ -671,8 +671,8 @@ if ($resql)
}
else
{
- $colspan=1;
- foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
+ $colspan = 1;
+ foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '| '.$langs->trans("NoRecordFound").' | ';
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index ff71b1ff9af..d211c04d375 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -64,13 +64,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
* View
*/
-$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Notes');
+$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
$form = new Form($db);
-if ($id > 0 || ! empty($ref))
+if ($id > 0 || !empty($ref))
{
$object = new Facture($db);
$object->fetch($id, $ref);
@@ -85,50 +85,50 @@ if ($id > 0 || ! empty($ref))
// Invoice content
- $linkback = '' . $langs->trans("BackToList") . '';
+ $linkback = ''.$langs->trans("BackToList").'';
- $morehtmlref='';
+ $morehtmlref = ' ';
// Ref customer
- $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+ $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+ $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
- $morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'customer');
+ $morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
// Project
- if (! empty($conf->projet->enabled))
+ if (!empty($conf->projet->enabled))
{
$langs->load("projects");
- $morehtmlref.=' '.$langs->trans('Project') . ' ';
+ $morehtmlref .= ' '.$langs->trans('Project').' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
//$morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- $morehtmlref.=' : ';
+ $morehtmlref .= ' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
} else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
- if (! empty($object->fk_project)) {
+ if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref.=' ';
- $morehtmlref.=$proj->ref;
- $morehtmlref.='';
+ $morehtmlref .= ' ';
+ $morehtmlref .= $proj->ref;
+ $morehtmlref .= '';
} else {
- $morehtmlref.='';
+ $morehtmlref .= '';
}
}
}
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
- $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
@@ -136,7 +136,7 @@ if ($id > 0 || ! empty($ref))
print '';
- $cssclass="titlefield";
+ $cssclass = "titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end();
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index e0569878b57..f1cbb613b18 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -32,8 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
-if (! empty($conf->projet->enabled)) {
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
+if (!empty($conf->projet->enabled)) {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
if (!$user->rights->facture->lire) accessforbidden();
@@ -95,7 +95,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
}
- $action='';
+ $action = '';
}
if ($action == "delete")
@@ -117,9 +117,9 @@ if (empty($reshook))
* View
*/
-$now=dol_now();
+$now = dol_now();
-$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('StandingOrders');
+$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
@@ -135,7 +135,7 @@ if ($object->id > 0)
{
$selleruserevenustamp = $mysoc->useRevenueStamp();
- $totalpaye = $object->getSommePaiement();
+ $totalpaye = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
@@ -146,10 +146,10 @@ if ($object->id > 0)
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
- if ($object->paye) $resteapayer=0;
- $resteapayeraffiche=$resteapayer;
+ if ($object->paye) $resteapayer = 0;
+ $resteapayeraffiche = $resteapayer;
- if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
@@ -157,10 +157,10 @@ if ($object->id > 0)
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
- $absolute_discount=$object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
- $absolute_creditnote=$object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
- $absolute_discount=price2num($absolute_discount, 'MT');
- $absolute_creditnote=price2num($absolute_creditnote, 'MT');
+ $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
+ $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
+ $absolute_discount = price2num($absolute_discount, 'MT');
+ $absolute_creditnote = price2num($absolute_creditnote, 'MT');
$author = new User($db);
if ($object->user_author)
@@ -233,27 +233,27 @@ if ($object->id > 0)
print $object->getLibType();
if ($object->type == Facture::TYPE_REPLACEMENT)
{
- $facreplaced=new Facture($db);
+ $facreplaced = new Facture($db);
$facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE)
{
- $facusing=new Facture($db);
+ $facusing = new Facture($db);
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
}
- $facidavoir=$object->getListIdAvoirFromInvoice();
+ $facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0)
{
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
- $i=0;
- foreach($facidavoir as $id)
+ $i = 0;
+ foreach ($facidavoir as $id)
{
- if ($i==0) print ' ';
+ if ($i == 0) print ' ';
else print ',';
- $facavoir=new Facture($db);
+ $facavoir = new Facture($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
@@ -274,7 +274,7 @@ if ($object->id > 0)
$thirdparty = $object->thirdparty;
$discount_type = 0;
- $backtopage = urlencode($_SERVER["PHP_SELF"] . '?facid=' . $object->id);
+ $backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
$cannotApplyDiscount = 1;
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
@@ -285,7 +285,7 @@ if ($object->id > 0)
print '';
print '';
@@ -312,7 +312,7 @@ if ($object->id > 0)
print '';
print ' | ';
if ($object->type != Facture::TYPE_CREDIT_NOTE)
@@ -337,7 +337,7 @@ if ($object->id > 0)
print '';
print ' | ';
if ($object->type != Facture::TYPE_CREDIT_NOTE)
@@ -365,7 +365,7 @@ if ($object->id > 0)
print '';
print ' | ';
if ($action == 'editmode')
@@ -383,7 +383,7 @@ if ($object->id > 0)
print '| ';
print $langs->trans('BankAccount');
print ' | ';
- if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
+ if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon))
print ' | id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' | ';
print ' ';
print ' | ';
@@ -414,39 +414,39 @@ if ($object->id > 0)
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{
// Multicurrency Amount HT
- print ' | | ' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . ' | ';
- print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
+ print ' | '.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).' | ';
+ print ''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' | ';
print ' ';
// Multicurrency Amount VAT
- print '| ' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . ' | ';
- print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
+ print ' | '.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).' | ';
+ print ''.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' | ';
print ' ';
// Multicurrency Amount TTC
- print '| ' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . ' | ';
- print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
+ print ' | '.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).' | ';
+ print ''.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' | ';
print ' ';
}
// Amount
- print '| ' . $langs->trans('AmountHT') . ' | ';
- print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
+ print '| '.$langs->trans('AmountHT').' | ';
+ print ''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).' | ';
// Vat
- print '| ' . $langs->trans('AmountVAT') . ' | ' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
+ print '| '.$langs->trans('AmountVAT').' | '.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).' | ';
print '';
// Amount Local Taxes
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
{
- print '| ' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ' | ';
- print '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
+ print '| '.$langs->transcountry("AmountLT1", $mysoc->country_code).' | ';
+ print ''.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).' | ';
}
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
{
- print '| ' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ' | ';
- print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
+ print '| '.$langs->transcountry("AmountLT2", $mysoc->country_code).' | ';
+ print ''.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).' | ';
}
// Revenue stamp
@@ -456,9 +456,9 @@ if ($object->id > 0)
print '';
print '';
@@ -467,7 +467,7 @@ if ($object->id > 0)
}
// Total with tax
- print ' | | ' . $langs->trans('AmountTTC') . ' | ' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
+ print '| '.$langs->trans('AmountTTC').' | '.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' | ';
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
@@ -545,10 +545,10 @@ if ($object->id > 0)
$remaintopaylesspendingdebit = $resteapayer - $pending;
print '';
}
@@ -596,14 +596,14 @@ if ($object->id > 0)
print '';
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
- $sql.= " , pfd.date_traite as date_traite, pfd.amount,";
- $sql.= " u.rowid as user_id, u.lastname, u.firstname, u.login";
- $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
- $sql.= " WHERE fk_facture = ".$object->id;
- $sql.= " AND pfd.traite = 0";
- $sql.= " ORDER BY pfd.date_demande DESC";
+ $sql .= " , pfd.date_traite as date_traite, pfd.amount,";
+ $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
+ $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
+ $sql .= " WHERE fk_facture = ".$object->id;
+ $sql .= " AND pfd.traite = 0";
+ $sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
@@ -646,14 +646,14 @@ if ($object->id > 0)
// Past requests
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
- $sql.= " pb.ref,";
- $sql.= " u.rowid as user_id, u.lastname, u.firstname, u.login";
- $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
- $sql.= " WHERE fk_facture = ".$object->id;
- $sql.= " AND pfd.traite = 1";
- $sql.= " ORDER BY pfd.date_demande DESC";
+ $sql .= " pb.ref,";
+ $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
+ $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
+ $sql .= " WHERE fk_facture = ".$object->id;
+ $sql .= " AND pfd.traite = 1";
+ $sql .= " ORDER BY pfd.date_demande DESC";
$result = $db->query($sql);
if ($result)
@@ -677,9 +677,9 @@ if ($object->id > 0)
print '';
if ($obj->fk_prelevement_bons > 0)
{
- $withdrawreceipt=new BonPrelevement($db);
- $withdrawreceipt->id=$obj->fk_prelevement_bons;
- $withdrawreceipt->ref=$obj->ref;
+ $withdrawreceipt = new BonPrelevement($db);
+ $withdrawreceipt->id = $obj->fk_prelevement_bons;
+ $withdrawreceipt->ref = $obj->ref;
print $withdrawreceipt->getNomUrl(1);
}
print " | \n";
@@ -694,7 +694,7 @@ if ($object->id > 0)
$i++;
}
- if (! $numopen && ! $numclosed)
+ if (!$numopen && !$numclosed)
print '| '.$langs->trans("None").' | ';
$db->free($result);
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index 3f1e4aef717..609181dec96 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -42,21 +42,21 @@ $langs->loadLangs(array('companies', 'bills', 'banks', 'multicurrency'));
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
-$facid = GETPOST('facid', 'int');
-$accountid = GETPOST('accountid', 'int');
+$facid = GETPOST('facid', 'int');
+$accountid = GETPOST('accountid', 'int');
$paymentnum = GETPOST('num_paiement', 'alpha');
$socid = GETPOST('socid', 'int');
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOST('page', 'int');
-$amounts=array();
-$amountsresttopay=array();
-$addwarning=0;
+$amounts = array();
+$amountsresttopay = array();
+$addwarning = 0;
-$multicurrency_amounts=array();
-$multicurrency_amountsresttopay=array();
+$multicurrency_amounts = array();
+$multicurrency_amountsresttopay = array();
// Security check
if ($user->socid > 0)
@@ -64,24 +64,24 @@ if ($user->socid > 0)
$socid = $user->socid;
}
-$object=new Facture($db);
+$object = new Facture($db);
// Load object
if ($facid > 0)
{
- $ret=$object->fetch($facid);
+ $ret = $object->fetch($facid);
}
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('paiementcard','globalcard'));
+$hookmanager->initHooks(array('paiementcard', 'globalcard'));
/*
* Actions
*/
-$parameters=array('socid'=>$socid);
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array('socid'=>$socid);
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
@@ -97,7 +97,7 @@ if (empty($reshook))
$atleastonepaymentnotnull = 0;
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
- $tmpinvoice=new Facture($db);
+ $tmpinvoice = new Facture($db);
foreach ($_POST as $key => $value)
{
if (substr($key, 0, 7) == 'amount_' && GETPOST($key) != '')
@@ -105,16 +105,16 @@ if (empty($reshook))
$cursorfacid = substr($key, 7);
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
$totalpayment = $totalpayment + $amounts[$cursorfacid];
- if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
- $result=$tmpinvoice->fetch($cursorfacid);
+ if (!empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
+ $result = $tmpinvoice->fetch($cursorfacid);
if ($result <= 0) dol_print_error($db);
- $amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
+ $amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
if ($amounts[$cursorfacid])
{
// Check amount
if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
{
- $addwarning=1;
+ $addwarning = 1;
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay");
}
// Check date
@@ -126,23 +126,23 @@ if (empty($reshook))
}
}
- $formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
+ $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => $_POST[$key]);
}
elseif (substr($key, 0, 21) == 'multicurrency_amount_')
{
$cursorfacid = substr($key, 21);
$multicurrency_amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
$multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
- if (! empty($multicurrency_amounts[$cursorfacid])) $atleastonepaymentnotnull++;
- $result=$tmpinvoice->fetch($cursorfacid);
+ if (!empty($multicurrency_amounts[$cursorfacid])) $atleastonepaymentnotnull++;
+ $result = $tmpinvoice->fetch($cursorfacid);
if ($result <= 0) dol_print_error($db);
- $multicurrency_amountsresttopay[$cursorfacid]=price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
+ $multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
if ($multicurrency_amounts[$cursorfacid])
{
// Check amount
if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid])))
{
- $addwarning=1;
+ $addwarning = 1;
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay");
}
// Check date
@@ -154,18 +154,18 @@ if (empty($reshook))
}
}
- $formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => GETPOST($key, 'int'));
+ $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOST($key, 'int'));
}
}
// Check parameters
- if (! GETPOST('paiementcode'))
+ if (!GETPOST('paiementcode'))
{
setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('PaymentMode')), null, 'errors');
$error++;
}
- if (! empty($conf->banque->enabled))
+ if (!empty($conf->banque->enabled))
{
// If bank module is on, account is required to enter a payment
if (GETPOST('accountid') <= 0)
@@ -212,7 +212,7 @@ if (empty($reshook))
*/
if ($action == 'confirm_paiement' && $confirm == 'yes')
{
- $error=0;
+ $error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
@@ -244,7 +244,7 @@ if (empty($reshook))
}
}
- if (! empty($conf->banque->enabled))
+ if (!empty($conf->banque->enabled))
{
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
if (GETPOST('accountid', 'int') <= 0)
@@ -257,17 +257,17 @@ if (empty($reshook))
// Creation of payment line
$paiement = new Paiement($db);
$paiement->datepaye = $datepaye;
- $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
- $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
+ $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
+ $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
$paiement->num_paiement = GETPOST('num_paiement', 'alpha');
$paiement->note = GETPOST('comment', 'alpha');
- if (! $error)
+ if (!$error)
{
// Create payment and update this->multicurrency_amounts if this->amounts filled or
// this->amounts if this->multicurrency_amounts filled.
- $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0), $thirdparty); // This include closing invoices and regenerating documents
+ $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); // This include closing invoices and regenerating documents
if ($paiement_id < 0)
{
setEventMessages($paiement->error, $paiement->errors, 'errors');
@@ -275,11 +275,11 @@ if (empty($reshook))
}
}
- if (! $error)
+ if (!$error)
{
- $label='(CustomerInvoicePayment)';
- if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) $label='(CustomerInvoicePaymentBack)'; // Refund of a credit note
- $result=$paiement->addPaymentToBank($user, 'payment', $label, GETPOST('accountid'), GETPOST('chqemetteur'), GETPOST('chqbank'));
+ $label = '(CustomerInvoicePayment)';
+ if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
+ $result = $paiement->addPaymentToBank($user, 'payment', $label, GETPOST('accountid'), GETPOST('chqemetteur'), GETPOST('chqbank'));
if ($result < 0)
{
setEventMessages($paiement->error, $paiement->errors, 'errors');
@@ -287,19 +287,19 @@ if (empty($reshook))
}
}
- if (! $error)
+ if (!$error)
{
$db->commit();
// If payment dispatching on more than one invoice, we stay on summary page, otherwise jump on invoice card
- $invoiceid=0;
+ $invoiceid = 0;
foreach ($paiement->amounts as $key => $amount)
{
$facid = $key;
if (is_numeric($amount) && $amount <> 0)
{
- if ($invoiceid != 0) $invoiceid=-1; // There is more than one invoice payed by this payment
- else $invoiceid=$facid;
+ if ($invoiceid != 0) $invoiceid = -1; // There is more than one invoice payed by this payment
+ else $invoiceid = $facid;
}
}
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$invoiceid;
@@ -319,7 +319,7 @@ if (empty($reshook))
* View
*/
-$form=new Form($db);
+$form = new Form($db);
llxHeader('', $langs->trans("Payment"));
@@ -335,31 +335,31 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
$facture->fetch_thirdparty();
- $title='';
- if ($facture->type != Facture::TYPE_CREDIT_NOTE) $title.=$langs->trans("EnterPaymentReceivedFromCustomer");
- if ($facture->type == Facture::TYPE_CREDIT_NOTE) $title.=$langs->trans("EnterPaymentDueToCustomer");
+ $title = '';
+ if ($facture->type != Facture::TYPE_CREDIT_NOTE) $title .= $langs->trans("EnterPaymentReceivedFromCustomer");
+ if ($facture->type == Facture::TYPE_CREDIT_NOTE) $title .= $langs->trans("EnterPaymentDueToCustomer");
print load_fiche_titre($title);
// Initialize data for confirmation (this is used because data can be change during confirmation)
if ($action == 'add_paiement')
{
- $i=0;
+ $i = 0;
- $formquestion[$i++]=array('type' => 'hidden','name' => 'facid', 'value' => $facture->id);
- $formquestion[$i++]=array('type' => 'hidden','name' => 'socid', 'value' => $facture->socid);
- $formquestion[$i++]=array('type' => 'hidden','name' => 'type', 'value' => $facture->type);
+ $formquestion[$i++] = array('type' => 'hidden', 'name' => 'facid', 'value' => $facture->id);
+ $formquestion[$i++] = array('type' => 'hidden', 'name' => 'socid', 'value' => $facture->socid);
+ $formquestion[$i++] = array('type' => 'hidden', 'name' => 'type', 'value' => $facture->type);
}
// Invoice with Paypal transaction
// TODO add hook possibility (regis)
- if (! empty($conf->paypalplus->enabled) && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int))
+ if (!empty($conf->paypalplus->enabled) && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && !empty($facture->ref_int))
{
- if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT;
- $paymentnum=$facture->ref_int;
+ if (!empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid = $conf->global->PAYPAL_BANK_ACCOUNT;
+ $paymentnum = $facture->ref_int;
}
// Add realtime total information
- if (! empty($conf->use_javascript_ajax))
+ if (!empty($conf->use_javascript_ajax))
{
print "\n".''."\n";
+ $this->stringtoshow .= 'plotWithOptions_'.$tag.'();'."\n";
+ $this->stringtoshow .= '});'."\n";
+ $this->stringtoshow .= ''."\n";
}
@@ -1138,8 +1138,8 @@ class DolGraph
if ($shownographyet)
{
- $s= '';
- $s.=''.$langs->trans("NotEnoughDataYet").' ';
+ $s = '';
+ $s .= ''.$langs->trans("NotEnoughDataYet").' ';
return $s;
}
@@ -1161,11 +1161,11 @@ class DolGraph
if ($direction == 'width')
{
if (empty($conf->dol_optimize_smallscreen)) return ($defaultsize ? $defaultsize : '500');
- else return (empty($_SESSION['dol_screen_width']) ? '280' : ($_SESSION['dol_screen_width']-40));
+ else return (empty($_SESSION['dol_screen_width']) ? '280' : ($_SESSION['dol_screen_width'] - 40));
}
if ($direction == 'height')
{
- return (empty($conf->dol_optimize_smallscreen)?($defaultsize?$defaultsize:'200'):'160');
+ return (empty($conf->dol_optimize_smallscreen) ? ($defaultsize ? $defaultsize : '200') : '160');
}
return 0;
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 8567ef595a0..81dffc51b67 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -140,7 +140,7 @@ class ExtraFields
/**
* @var string Error code (or message)
*/
- public $error='';
+ public $error = '';
/**
* @var string[] Array of Error code (or message)
@@ -153,7 +153,7 @@ class ExtraFields
public $errno;
- public static $type2label=array(
+ public static $type2label = array(
'varchar'=>'String',
'text'=>'TextLong',
'html'=>'HtmlText',
@@ -280,67 +280,67 @@ class ExtraFields
*/
private function create($attrname, $type = 'varchar', $length = 255, $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = '', $perms = '', $list = '0', $computed = '', $help = '')
{
- if ($elementtype == 'thirdparty') $elementtype='societe';
- if ($elementtype == 'contact') $elementtype='socpeople';
+ if ($elementtype == 'thirdparty') $elementtype = 'societe';
+ if ($elementtype == 'contact') $elementtype = 'socpeople';
- $table=$elementtype.'_extrafields';
- if ($elementtype == 'categorie') $table='categories_extrafields';
+ $table = $elementtype.'_extrafields';
+ if ($elementtype == 'categorie') $table = 'categories_extrafields';
- if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/", $attrname) && ! is_numeric($attrname))
+ if (!empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/", $attrname) && !is_numeric($attrname))
{
- if ($type=='boolean') {
- $typedb='int';
- $lengthdb='1';
- } elseif($type=='price') {
- $typedb='double';
- $lengthdb='24,8';
- } elseif($type=='phone') {
- $typedb='varchar';
- $lengthdb='20';
- } elseif($type=='mail') {
- $typedb='varchar';
- $lengthdb='128';
- } elseif($type=='url') {
- $typedb='varchar';
- $lengthdb='255';
- } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){
- $typedb='varchar';
- $lengthdb='255';
- } elseif ($type=='link') {
- $typedb='int';
- $lengthdb='11';
- } elseif ($type=='html') {
- $typedb='text';
- $lengthdb=$length;
- } elseif($type=='password') {
- $typedb='varchar';
- $lengthdb='128';
+ if ($type == 'boolean') {
+ $typedb = 'int';
+ $lengthdb = '1';
+ } elseif ($type == 'price') {
+ $typedb = 'double';
+ $lengthdb = '24,8';
+ } elseif ($type == 'phone') {
+ $typedb = 'varchar';
+ $lengthdb = '20';
+ } elseif ($type == 'mail') {
+ $typedb = 'varchar';
+ $lengthdb = '128';
+ } elseif ($type == 'url') {
+ $typedb = 'varchar';
+ $lengthdb = '255';
+ } elseif (($type == 'select') || ($type == 'sellist') || ($type == 'radio') || ($type == 'checkbox') || ($type == 'chkbxlst')) {
+ $typedb = 'varchar';
+ $lengthdb = '255';
+ } elseif ($type == 'link') {
+ $typedb = 'int';
+ $lengthdb = '11';
+ } elseif ($type == 'html') {
+ $typedb = 'text';
+ $lengthdb = $length;
+ } elseif ($type == 'password') {
+ $typedb = 'varchar';
+ $lengthdb = '128';
} else {
- $typedb=$type;
- $lengthdb=$length;
- if ($type == 'varchar' && empty($lengthdb)) $lengthdb='255';
+ $typedb = $type;
+ $lengthdb = $length;
+ if ($type == 'varchar' && empty($lengthdb)) $lengthdb = '255';
}
$field_desc = array(
'type'=>$typedb,
'value'=>$lengthdb,
- 'null'=>($required?'NOT NULL':'NULL'),
+ 'null'=>($required ? 'NOT NULL' : 'NULL'),
'default' => $default_value
);
- $result=$this->db->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
+ $result = $this->db->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
if ($result > 0)
{
if ($unique)
{
- $sql="ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
- $resql=$this->db->query($sql, 1, 'dml');
+ $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
+ $resql = $this->db->query($sql, 1, 'dml');
}
return 1;
}
else
{
- $this->error=$this->db->lasterror();
- $this->errno=$this->db->lasterrno();
+ $this->error = $this->db->lasterror();
+ $this->errno = $this->db->lasterrno();
return -1;
}
}
@@ -378,19 +378,19 @@ class ExtraFields
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
{
// phpcs:enable
- global $conf,$user;
+ global $conf, $user;
- if ($elementtype == 'thirdparty') $elementtype='societe';
- if ($elementtype == 'contact') $elementtype='socpeople';
+ if ($elementtype == 'thirdparty') $elementtype = 'societe';
+ if ($elementtype == 'contact') $elementtype = 'socpeople';
// Clean parameters
- if (empty($pos)) $pos=0;
- if (empty($list)) $list='0';
- if (empty($required)) $required=0;
- if (empty($unique)) $unique=0;
- if (empty($alwayseditable)) $alwayseditable=0;
+ if (empty($pos)) $pos = 0;
+ if (empty($list)) $list = '0';
+ if (empty($required)) $required = 0;
+ if (empty($unique)) $unique = 0;
+ if (empty($alwayseditable)) $alwayseditable = 0;
- if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname) && ! is_numeric($attrname))
+ if (!empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname) && !is_numeric($attrname))
{
if (is_array($param) && count($param) > 0)
{
@@ -460,8 +460,8 @@ class ExtraFields
}
else
{
- $this->error=$this->db->lasterror();
- $this->errno=$this->db->lasterrno();
+ $this->error = $this->db->lasterror();
+ $this->errno = $this->db->lasterrno();
return -1;
}
}
@@ -476,30 +476,30 @@ class ExtraFields
*/
public function delete($attrname, $elementtype = 'member')
{
- if ($elementtype == 'thirdparty') $elementtype='societe';
- if ($elementtype == 'contact') $elementtype='socpeople';
+ if ($elementtype == 'thirdparty') $elementtype = 'societe';
+ if ($elementtype == 'contact') $elementtype = 'socpeople';
- $table=$elementtype.'_extrafields';
- if ($elementtype == 'categorie') $table='categories_extrafields';
+ $table = $elementtype.'_extrafields';
+ if ($elementtype == 'categorie') $table = 'categories_extrafields';
- $error=0;
+ $error = 0;
- if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname))
+ if (!empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname))
{
- $result=$this->delete_label($attrname, $elementtype);
+ $result = $this->delete_label($attrname, $elementtype);
if ($result < 0)
{
- $this->error=$this->db->lasterror();
- $this->errors[]=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
+ $this->errors[] = $this->db->lasterror();
$error++;
}
- if (! $error)
+ if (!$error)
{
$sql = "SELECT COUNT(rowid) as nb";
- $sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
- $sql.= " WHERE elementtype = '".$elementtype."'";
- $sql.= " AND name = '".$attrname."'";
+ $sql .= " FROM ".MAIN_DB_PREFIX."extrafields";
+ $sql .= " WHERE elementtype = '".$elementtype."'";
+ $sql .= " AND name = '".$attrname."'";
//$sql.= " AND entity IN (0,".$conf->entity.")"; Do not test on entity here. We want to see if there is still on field remaning in other entities before deleting field in table
$resql = $this->db->query($sql);
if ($resql)
@@ -507,11 +507,11 @@ class ExtraFields
$obj = $this->db->fetch_object($resql);
if ($obj->nb <= 0)
{
- $result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table, $attrname); // This also drop the unique key
+ $result = $this->db->DDLDropField(MAIN_DB_PREFIX.$table, $attrname); // This also drop the unique key
if ($result < 0)
{
- $this->error=$this->db->lasterror();
- $this->errors[]=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
+ $this->errors[] = $this->db->lasterror();
$error++;
}
}
@@ -539,18 +539,18 @@ class ExtraFields
// phpcs:enable
global $conf;
- if ($elementtype == 'thirdparty') $elementtype='societe';
- if ($elementtype == 'contact') $elementtype='socpeople';
+ if ($elementtype == 'thirdparty') $elementtype = 'societe';
+ if ($elementtype == 'contact') $elementtype = 'socpeople';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
- $sql.= " WHERE name = '".$attrname."'";
- $sql.= " AND entity IN (0,".$conf->entity.')';
- $sql.= " AND elementtype = '".$elementtype."'";
+ $sql .= " WHERE name = '".$attrname."'";
+ $sql .= " AND entity IN (0,".$conf->entity.')';
+ $sql .= " AND elementtype = '".$elementtype."'";
dol_syslog(get_class($this)."::delete_label", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
return 1;
@@ -593,80 +593,80 @@ class ExtraFields
*/
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
{
- if ($elementtype == 'thirdparty') $elementtype='societe';
- if ($elementtype == 'contact') $elementtype='socpeople';
+ if ($elementtype == 'thirdparty') $elementtype = 'societe';
+ if ($elementtype == 'contact') $elementtype = 'socpeople';
- $table=$elementtype.'_extrafields';
- if ($elementtype == 'categorie') $table='categories_extrafields';
+ $table = $elementtype.'_extrafields';
+ if ($elementtype == 'categorie') $table = 'categories_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname))
{
- if ($type=='boolean') {
- $typedb='int';
- $lengthdb='1';
- } elseif($type=='price') {
- $typedb='double';
- $lengthdb='24,8';
- } elseif($type=='phone') {
- $typedb='varchar';
- $lengthdb='20';
- } elseif($type=='mail') {
- $typedb='varchar';
- $lengthdb='128';
- } elseif($type=='url') {
- $typedb='varchar';
- $lengthdb='255';
- } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) {
- $typedb='varchar';
- $lengthdb='255';
+ if ($type == 'boolean') {
+ $typedb = 'int';
+ $lengthdb = '1';
+ } elseif ($type == 'price') {
+ $typedb = 'double';
+ $lengthdb = '24,8';
+ } elseif ($type == 'phone') {
+ $typedb = 'varchar';
+ $lengthdb = '20';
+ } elseif ($type == 'mail') {
+ $typedb = 'varchar';
+ $lengthdb = '128';
+ } elseif ($type == 'url') {
+ $typedb = 'varchar';
+ $lengthdb = '255';
+ } elseif (($type == 'select') || ($type == 'sellist') || ($type == 'radio') || ($type == 'checkbox') || ($type == 'chkbxlst')) {
+ $typedb = 'varchar';
+ $lengthdb = '255';
} elseif ($type == 'html') {
- $typedb='text';
- } elseif ($type=='link') {
- $typedb='int';
- $lengthdb='11';
- } elseif($type=='password') {
- $typedb='varchar';
- $lengthdb='50';
+ $typedb = 'text';
+ } elseif ($type == 'link') {
+ $typedb = 'int';
+ $lengthdb = '11';
+ } elseif ($type == 'password') {
+ $typedb = 'varchar';
+ $lengthdb = '50';
} else {
- $typedb=$type;
- $lengthdb=$length;
+ $typedb = $type;
+ $lengthdb = $length;
}
- $field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL'), 'default'=>$default);
+ $field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required ? 'NOT NULL' : 'NULL'), 'default'=>$default);
if ($type != 'separate') // No table update when separate type
{
- $result=$this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
+ $result = $this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
}
if ($result > 0 || $type == 'separate')
{
if ($label)
{
- $result=$this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable);
+ $result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable);
}
if ($result > 0)
{
- $sql='';
+ $sql = '';
if ($unique)
{
- $sql="ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
+ $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
}
else
{
- $sql="ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname;
+ $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname;
}
dol_syslog(get_class($this).'::update', LOG_DEBUG);
- $resql=$this->db->query($sql, 1, 'dml');
+ $resql = $this->db->query($sql, 1, 'dml');
return 1;
}
else
{
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
return -1;
}
}
else
{
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
return -1;
}
}
@@ -708,17 +708,17 @@ class ExtraFields
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable);
// Clean parameters
- if ($elementtype == 'thirdparty') $elementtype='societe';
- if ($elementtype == 'contact') $elementtype='socpeople';
+ if ($elementtype == 'thirdparty') $elementtype = 'societe';
+ if ($elementtype == 'contact') $elementtype = 'socpeople';
- if (empty($pos)) $pos=0;
- if (empty($list)) $list='0';
+ if (empty($pos)) $pos = 0;
+ if (empty($list)) $list = '0';
if (empty($totalizable)) {
$totalizable = 0;
}
- if (empty($required)) $required=0;
- if (empty($unique)) $unique=0;
- if (empty($alwayseditable)) $alwayseditable=0;
+ if (empty($required)) $required = 0;
+ if (empty($unique)) $unique = 0;
+ if (empty($alwayseditable)) $alwayseditable = 0;
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname))
{
@@ -734,76 +734,76 @@ class ExtraFields
}
else
{
- $params='';
+ $params = '';
}
if ($entity === '' || $entity != '0')
{
// We dont want on all entities, we delete all and current
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
- $sql_del.= " WHERE name = '".$attrname."'";
- $sql_del.= " AND entity IN (0, ".($entity===''?$conf->entity:$entity).")";
- $sql_del.= " AND elementtype = '".$elementtype."'";
+ $sql_del .= " WHERE name = '".$attrname."'";
+ $sql_del .= " AND entity IN (0, ".($entity === '' ? $conf->entity : $entity).")";
+ $sql_del .= " AND elementtype = '".$elementtype."'";
}
else
{
// We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity)
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
- $sql_del.= " WHERE name = '".$attrname."'";
- $sql_del.= " AND entity = 0";
- $sql_del.= " AND elementtype = '".$elementtype."'";
+ $sql_del .= " WHERE name = '".$attrname."'";
+ $sql_del .= " AND entity = 0";
+ $sql_del .= " AND elementtype = '".$elementtype."'";
}
- $resql1=$this->db->query($sql_del);
+ $resql1 = $this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(";
- $sql.= " name,"; // This is code
- $sql.= " entity,";
- $sql.= " label,";
- $sql.= " type,";
- $sql.= " size,";
- $sql.= " elementtype,";
- $sql.= " fieldunique,";
- $sql.= " fieldrequired,";
- $sql.= " perms,";
- $sql.= " langs,";
- $sql.= " pos,";
- $sql.= " alwayseditable,";
- $sql.= " param,";
- $sql.= " list,";
- $sql.= " totalizable,";
- $sql.= " fielddefault,";
- $sql.= " fieldcomputed,";
- $sql.= " fk_user_author,";
- $sql.= " fk_user_modif,";
- $sql.= " datec,";
- $sql.= " enabled,";
- $sql.= " help";
- $sql.= ") VALUES (";
- $sql.= "'".$attrname."',";
- $sql.= " ".($entity===''?$conf->entity:$entity).",";
- $sql.= " '".$this->db->escape($label)."',";
- $sql.= " '".$this->db->escape($type)."',";
- $sql.= " '".$this->db->escape($size)."',";
- $sql.= " '".$this->db->escape($elementtype)."',";
- $sql.= " ".$unique.",";
- $sql.= " ".$required.",";
- $sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
- $sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
- $sql.= " ".$pos.",";
- $sql.= " '".$this->db->escape($alwayseditable)."',";
- $sql.= " '".$this->db->escape($params)."',";
- $sql.= " '".$this->db->escape($list)."', ";
- $sql.= " ".$totalizable.",";
- $sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").",";
- $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
- $sql .= " " . $user->id . ",";
- $sql .= " " . $user->id . ",";
- $sql .= "'" . $this->db->idate(dol_now()) . "',";
- $sql .= "'" . $this->db->escape($enabled). "',";
- $sql.= " ".($help?"'".$this->db->escape($help)."'":"null");
- $sql.= ")";
+ $sql .= " name,"; // This is code
+ $sql .= " entity,";
+ $sql .= " label,";
+ $sql .= " type,";
+ $sql .= " size,";
+ $sql .= " elementtype,";
+ $sql .= " fieldunique,";
+ $sql .= " fieldrequired,";
+ $sql .= " perms,";
+ $sql .= " langs,";
+ $sql .= " pos,";
+ $sql .= " alwayseditable,";
+ $sql .= " param,";
+ $sql .= " list,";
+ $sql .= " totalizable,";
+ $sql .= " fielddefault,";
+ $sql .= " fieldcomputed,";
+ $sql .= " fk_user_author,";
+ $sql .= " fk_user_modif,";
+ $sql .= " datec,";
+ $sql .= " enabled,";
+ $sql .= " help";
+ $sql .= ") VALUES (";
+ $sql .= "'".$attrname."',";
+ $sql .= " ".($entity === '' ? $conf->entity : $entity).",";
+ $sql .= " '".$this->db->escape($label)."',";
+ $sql .= " '".$this->db->escape($type)."',";
+ $sql .= " '".$this->db->escape($size)."',";
+ $sql .= " '".$this->db->escape($elementtype)."',";
+ $sql .= " ".$unique.",";
+ $sql .= " ".$required.",";
+ $sql .= " ".($perms ? "'".$this->db->escape($perms)."'" : "null").",";
+ $sql .= " ".($langfile ? "'".$this->db->escape($langfile)."'" : "null").",";
+ $sql .= " ".$pos.",";
+ $sql .= " '".$this->db->escape($alwayseditable)."',";
+ $sql .= " '".$this->db->escape($params)."',";
+ $sql .= " '".$this->db->escape($list)."', ";
+ $sql .= " ".$totalizable.",";
+ $sql .= " ".(($default != '') ? "'".$this->db->escape($default)."'" : "null").",";
+ $sql .= " ".($computed ? "'".$this->db->escape($computed)."'" : "null").",";
+ $sql .= " ".$user->id.",";
+ $sql .= " ".$user->id.",";
+ $sql .= "'".$this->db->idate(dol_now())."',";
+ $sql .= "'".$this->db->escape($enabled)."',";
+ $sql .= " ".($help ? "'".$this->db->escape($help)."'" : "null");
+ $sql .= ")";
- $resql2=$this->db->query($sql);
+ $resql2 = $this->db->query($sql);
if ($resql1 && $resql2)
{
@@ -839,11 +839,11 @@ class ExtraFields
if (empty($elementtype)) return array();
- if ($elementtype == 'thirdparty') $elementtype='societe';
- if ($elementtype == 'contact') $elementtype='socpeople';
- if ($elementtype == 'order_supplier') $elementtype='commande_fournisseur';
+ if ($elementtype == 'thirdparty') $elementtype = 'societe';
+ if ($elementtype == 'contact') $elementtype = 'socpeople';
+ if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
- $array_name_label=array();
+ $array_name_label = array();
// To avoid conflicts with external modules. TODO Remove this.
if (empty($forceload) && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
@@ -871,12 +871,12 @@ class ExtraFields
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help";
- $sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
+ $sql .= " FROM ".MAIN_DB_PREFIX."extrafields";
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
- if ($elementtype) $sql.= " WHERE elementtype = '".$elementtype."'"; // Filed with object->table_element
- $sql.= " ORDER BY pos";
+ if ($elementtype) $sql .= " WHERE elementtype = '".$elementtype."'"; // Filed with object->table_element
+ $sql .= " ORDER BY pos";
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
@@ -888,7 +888,7 @@ class ExtraFields
// This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field without default value
if ($tab->fieldrequired && is_null($tab->fielddefault))
{
- $this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type;
+ $this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name] = $tab->type;
}
continue;
}
@@ -969,58 +969,58 @@ class ExtraFields
*/
public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0)
{
- global $conf,$langs,$form;
+ global $conf, $langs, $form;
- if (! is_object($form))
+ if (!is_object($form))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
- $form=new Form($this->db);
+ $form = new Form($this->db);
}
- $out='';
+ $out = '';
- if (! preg_match('/options_$/', $keyprefix)) // Because we work on extrafields, we add 'options_' to prefix if not already added
+ if (!preg_match('/options_$/', $keyprefix)) // Because we work on extrafields, we add 'options_' to prefix if not already added
{
$keyprefix = $keyprefix.'options_';
}
- if (! empty($extrafieldsobjectkey))
+ if (!empty($extrafieldsobjectkey))
{
- $label=$this->attributes[$extrafieldsobjectkey]['label'][$key];
- $type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
- $size=$this->attributes[$extrafieldsobjectkey]['size'][$key];
- $default=$this->attributes[$extrafieldsobjectkey]['default'][$key];
- $computed=$this->attributes[$extrafieldsobjectkey]['computed'][$key];
- $unique=$this->attributes[$extrafieldsobjectkey]['unique'][$key];
- $required=$this->attributes[$extrafieldsobjectkey]['required'][$key];
- $param=$this->attributes[$extrafieldsobjectkey]['param'][$key];
- $perms=dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1);
- $langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key];
- $list=dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1);
- $totalizable=$this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
- $help=$this->attributes[$extrafieldsobjectkey]['help'][$key];
- $hidden=(empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
+ $label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
+ $type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
+ $size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
+ $default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
+ $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
+ $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
+ $required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
+ $param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
+ $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1);
+ $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
+ $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1);
+ $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
+ $help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
+ $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}
else // Old usage
{
- $label=$this->attribute_label[$key];
- $type =$this->attribute_type[$key];
- $size =$this->attribute_size[$key];
- $elementtype=$this->attribute_elementtype[$key]; // Seems not used
- $default=$this->attribute_default[$key];
- $computed=$this->attribute_computed[$key];
- $unique=$this->attribute_unique[$key];
- $required=$this->attribute_required[$key];
- $param=$this->attribute_param[$key];
- $langfile=$this->attribute_langfile[$key];
- $list=$this->attribute_list[$key];
- $totalizable=$this->attribute_totalizable[$key];
- $hidden=(empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
+ $label = $this->attribute_label[$key];
+ $type = $this->attribute_type[$key];
+ $size = $this->attribute_size[$key];
+ $elementtype = $this->attribute_elementtype[$key]; // Seems not used
+ $default = $this->attribute_default[$key];
+ $computed = $this->attribute_computed[$key];
+ $unique = $this->attribute_unique[$key];
+ $required = $this->attribute_required[$key];
+ $param = $this->attribute_param[$key];
+ $langfile = $this->attribute_langfile[$key];
+ $list = $this->attribute_list[$key];
+ $totalizable = $this->attribute_totalizable[$key];
+ $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}
if ($computed)
{
- if (! preg_match('/^search_/', $keyprefix)) return ''.$langs->trans("AutomaticallyCalculated").'';
+ if (!preg_match('/^search_/', $keyprefix)) return ''.$langs->trans("AutomaticallyCalculated").'';
else return '';
}
@@ -1034,21 +1034,21 @@ class ExtraFields
{
$morecss = 'minwidth200imp';
}
- elseif (in_array($type, array('int','integer','double','price')))
+ elseif (in_array($type, array('int', 'integer', 'double', 'price')))
{
$morecss = 'maxwidth75';
}
elseif ($type == 'password')
{
- $morecss='maxwidth100';
+ $morecss = 'maxwidth100';
}
elseif ($type == 'url')
{
- $morecss='minwidth400';
+ $morecss = 'minwidth400';
}
elseif ($type == 'boolean')
{
- $morecss='';
+ $morecss = '';
}
else
{
@@ -1067,10 +1067,10 @@ class ExtraFields
}
}
- if (in_array($type, array('date','datetime')))
+ if (in_array($type, array('date', 'datetime')))
{
- $tmp=explode(',', $size);
- $newsize=$tmp[0];
+ $tmp = explode(',', $size);
+ $newsize = $tmp[0];
$showtime = in_array($type, array('datetime')) ? 1 : 0;
@@ -1080,118 +1080,118 @@ class ExtraFields
// TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
}
- elseif (in_array($type, array('int','integer')))
+ elseif (in_array($type, array('int', 'integer')))
{
- $tmp=explode(',', $size);
- $newsize=$tmp[0];
- $out='';
+ $tmp = explode(',', $size);
+ $newsize = $tmp[0];
+ $out = '';
}
elseif (preg_match('/varchar/', $type))
{
- $out='';
+ $out = '';
}
elseif (in_array($type, array('mail', 'phone', 'url')))
{
- $out='';
+ $out = '';
}
elseif ($type == 'text')
{
- if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
+ if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%');
- $out=$doleditor->Create(1);
+ $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%');
+ $out = $doleditor->Create(1);
}
else
{
- $out='';
+ $out = '';
}
}
elseif ($type == 'html')
{
- if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
+ if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, ! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%');
- $out=$doleditor->Create(1);
+ $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%');
+ $out = $doleditor->Create(1);
}
else
{
- $out='';
+ $out = '';
}
}
elseif ($type == 'boolean')
{
if (empty($mode))
{
- $checked='';
+ $checked = '';
if (!empty($value)) {
- $checked=' checked value="1" ';
+ $checked = ' checked value="1" ';
} else {
- $checked=' value="1" ';
+ $checked = ' value="1" ';
}
- $out='';
+ $out = '';
}
else
{
- $out.=$form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);
+ $out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);
}
}
elseif ($type == 'price')
{
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
- $value=price($value);
+ $value = price($value);
}
- $out=' '.$langs->getCurrencySymbol($conf->currency);
+ $out = ' '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
- $value=price($value);
+ $value = price($value);
}
- $out=' ';
+ $out = ' ';
}
elseif ($type == 'select')
{
$out = '';
- if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
+ if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
+ $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
}
- $out.='';
- $out.='';
+ $out .= '';
+ $out .= '';
foreach ($param['options'] as $key => $val)
{
if ((string) $key == '') continue;
list($val, $parent) = explode('|', $val);
- $out.='';
+ $out .= '';
}
- $out.='';
+ $out .= '';
}
elseif ($type == 'sellist')
{
$out = '';
- if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
+ if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
+ $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
}
- $out.='';
+ $out .= '';
if (is_array($param['options']))
{
- $param_list=array_keys($param['options']);
+ $param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
- $parentName='';
- $parentField='';
+ $parentName = '';
+ $parentField = '';
// 0 : tableName
// 1 : label field name
// 2 : key fields name (if differ of rowid)
@@ -1199,22 +1199,22 @@ class ExtraFields
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
// 5 : id category type
// 6 : ids categories list separated by comma for category root
- $keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid');
+ $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid');
- if (count($InfoFieldList) > 4 && ! empty($InfoFieldList[4]))
+ if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4]))
{
if (strpos($InfoFieldList[4], 'extra.') !== false)
{
- $keyList='main.'.$InfoFieldList[2].' as rowid';
+ $keyList = 'main.'.$InfoFieldList[2].' as rowid';
} else {
- $keyList=$InfoFieldList[2].' as rowid';
+ $keyList = $InfoFieldList[2].' as rowid';
}
}
- if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3]))
+ if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3]))
{
list($parentName, $parentField) = explode('|', $InfoFieldList[3]);
- $keyList.= ', '.$parentField;
+ $keyList .= ', '.$parentField;
}
$filter_categorie = false;
@@ -1232,8 +1232,8 @@ class ExtraFields
}
$sqlwhere = '';
- $sql = 'SELECT ' . $keyList;
- $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
+ $sql = 'SELECT '.$keyList;
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
if (!empty($InfoFieldList[4])) {
// can use curent entity filter
if (strpos($InfoFieldList[4], '$ENTITY$') !== false) {
@@ -1252,24 +1252,24 @@ class ExtraFields
}
//We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) {
- $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
- $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
+ $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
+ $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4];
} else {
- $sqlwhere .= ' WHERE ' . $InfoFieldList[4];
+ $sqlwhere .= ' WHERE '.$InfoFieldList[4];
}
} else {
$sqlwhere .= ' WHERE 1=1';
}
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array('tablewithentity'))) {
- $sqlwhere .= ' AND entity = ' . $conf->entity;
+ $sqlwhere .= ' AND entity = '.$conf->entity;
}
$sql .= $sqlwhere;
//print $sql;
- $sql .= ' ORDER BY ' . implode(', ', $fields_label);
+ $sql .= ' ORDER BY '.implode(', ', $fields_label);
- dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
+ dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= '';
@@ -1285,7 +1285,7 @@ class ExtraFields
if (is_array($fields_label) && count($fields_label) > 1) {
$notrans = true;
foreach ($fields_label as $field_toshow) {
- $labeltoshow .= $obj->$field_toshow . ' ';
+ $labeltoshow .= $obj->$field_toshow.' ';
}
} else {
$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -1296,10 +1296,10 @@ class ExtraFields
if (!$notrans) {
foreach ($fields_label as $field_toshow) {
$translabel = $langs->trans($obj->$field_toshow);
- $labeltoshow = dol_trunc($translabel, 18) . ' ';
+ $labeltoshow = dol_trunc($translabel, 18).' ';
}
}
- $out .= '';
+ $out .= '';
} else {
if (!$notrans) {
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -1308,48 +1308,48 @@ class ExtraFields
if (empty($labeltoshow)) $labeltoshow = '(not defined)';
if (!empty($InfoFieldList[3]) && $parentField) {
- $parent = $parentName . ':' . $obj->{$parentField};
+ $parent = $parentName.':'.$obj->{$parentField};
}
- $out .= '';
+ $out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
+ $out .= '>'.$labeltoshow.'';
}
$i++;
}
$this->db->free($resql);
} else {
- print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters. ';
+ print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters. ';
}
} else {
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out .= '';
foreach ($data as $data_key => $data_value) {
- $out .= '';
}
}
}
- $out.='';
+ $out .= '';
}
elseif ($type == 'checkbox')
{
- $value_arr=explode(',', $value);
- $out=$form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
+ $value_arr = explode(',', $value);
+ $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
}
elseif ($type == 'radio')
{
- $out='';
+ $out = '';
foreach ($param['options'] as $keyopt => $val)
{
- $out.=' ';
+ $out .= ''.$val.' ';
}
}
elseif ($type == 'chkbxlst')
@@ -1364,8 +1364,8 @@ class ExtraFields
if (is_array($param['options'])) {
$param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
- $parentName='';
- $parentField='';
+ $parentName = '';
+ $parentField = '';
// 0 : tableName
// 1 : label field name
// 2 : key fields name (if differ of rowid)
@@ -1373,17 +1373,17 @@ class ExtraFields
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
// 5 : id category type
// 6 : ids categories list separated by comma for category root
- $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid');
+ $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid');
- if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) {
- list ( $parentName, $parentField ) = explode('|', $InfoFieldList[3]);
- $keyList .= ', ' . $parentField;
+ if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) {
+ list ($parentName, $parentField) = explode('|', $InfoFieldList[3]);
+ $keyList .= ', '.$parentField;
}
- if (count($InfoFieldList) > 4 && ! empty($InfoFieldList[4])) {
+ if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
- $keyList = 'main.' . $InfoFieldList[2] . ' as rowid';
+ $keyList = 'main.'.$InfoFieldList[2].' as rowid';
} else {
- $keyList = $InfoFieldList[2] . ' as rowid';
+ $keyList = $InfoFieldList[2].' as rowid';
}
}
@@ -1402,8 +1402,8 @@ class ExtraFields
}
$sqlwhere = '';
- $sql = 'SELECT ' . $keyList;
- $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
+ $sql = 'SELECT '.$keyList;
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
if (!empty($InfoFieldList[4])) {
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -1426,11 +1426,11 @@ class ExtraFields
// Init des compteurs
$nbPregRepl = $nbPregSel = 0;
// On retire toutes les parenthèses sans = avant
- $InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*(' . $word . ')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl);
+ $InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*('.$word.')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl);
// On retire les espaces autour des = et parenthèses
$InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
// On retire toutes les parenthèses avec = avant
- $InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel);
+ $InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*('.$word.')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel);
// On retire les espaces autour des = et parenthèses
$InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
@@ -1439,7 +1439,7 @@ class ExtraFields
}
// Si l'on a un AND ou un OR, avant ou après
- preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
+ preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
while (!empty($matchCondition[0])) {
// If the two sides differ but are not empty
if (!empty($matchCondition[1]) && !empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3]) {
@@ -1448,7 +1448,7 @@ class ExtraFields
} else {
if (!empty($matchCondition[1])) {
$boolCond = (($matchCondition[1] == "AND") ? ' AND TRUE ' : ' OR FALSE ');
- $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]);
+ $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond.$matchCondition[3], $InfoFieldList[4]);
} elseif (!empty($matchCondition[3])) {
$boolCond = (($matchCondition[3] == "AND") ? ' TRUE AND ' : ' FALSE OR');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
@@ -1458,7 +1458,7 @@ class ExtraFields
}
// Si l'on a un AND ou un OR, avant ou après
- preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
+ preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
}
} else {
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
@@ -1466,23 +1466,23 @@ class ExtraFields
// We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) {
- $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
- $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
+ $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
+ $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4];
} else {
- $sqlwhere .= ' WHERE ' . $InfoFieldList[4];
+ $sqlwhere .= ' WHERE '.$InfoFieldList[4];
}
} else {
$sqlwhere .= ' WHERE 1=1';
}
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array('tablewithentity'))) {
- $sqlwhere .= ' AND entity = ' . $conf->entity;
+ $sqlwhere .= ' AND entity = '.$conf->entity;
}
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
// print $sql;
$sql .= $sqlwhere;
- dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
+ dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@@ -1500,7 +1500,7 @@ class ExtraFields
if (is_array($fields_label)) {
$notrans = true;
foreach ($fields_label as $field_toshow) {
- $labeltoshow .= $obj->$field_toshow . ' ';
+ $labeltoshow .= $obj->$field_toshow.' ';
}
} else {
$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -1511,9 +1511,9 @@ class ExtraFields
foreach ($fields_label as $field_toshow) {
$translabel = $langs->trans($obj->$field_toshow);
if ($translabel != $obj->$field_toshow) {
- $labeltoshow = dol_trunc($translabel, 18) . ' ';
+ $labeltoshow = dol_trunc($translabel, 18).' ';
} else {
- $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
+ $labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
}
}
@@ -1535,7 +1535,7 @@ class ExtraFields
}
if (!empty($InfoFieldList[3]) && $parentField) {
- $parent = $parentName . ':' . $obj->{$parentField};
+ $parent = $parentName.':'.$obj->{$parentField};
}
$data[$obj->rowid] = $labeltoshow;
@@ -1653,70 +1653,70 @@ class ExtraFields
//$value=price($value);
$sizeparts = explode(",", $size);
$number_decimals = $sizeparts[1];
- $value=price($value, 0, $langs, 0, 0, $number_decimals, '');
+ $value = price($value, 0, $langs, 0, 0, $number_decimals, '');
}
}
elseif ($type == 'boolean')
{
- $checked='';
+ $checked = '';
if (!empty($value)) {
- $checked=' checked ';
+ $checked = ' checked ';
}
- $value='';
+ $value = '';
}
elseif ($type == 'mail')
{
- $value=dol_print_email($value, 0, 0, 0, 64, 1, 1);
+ $value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
}
elseif ($type == 'url')
{
- $value=dol_print_url($value, '_blank', 32, 1);
+ $value = dol_print_url($value, '_blank', 32, 1);
}
elseif ($type == 'phone')
{
- $value=dol_print_phone($value, '', 0, 0, '', ' ', 'phone');
+ $value = dol_print_phone($value, '', 0, 0, '', ' ', 'phone');
}
elseif ($type == 'price')
{
- $value=price($value, 0, $langs, 0, 0, -1, $conf->currency);
+ $value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
}
elseif ($type == 'select')
{
- if ($langfile && $param['options'][$value]) $value=$langs->trans($param['options'][$value]);
- else $value=$param['options'][$value];
+ if ($langfile && $param['options'][$value]) $value = $langs->trans($param['options'][$value]);
+ else $value = $param['options'][$value];
}
elseif ($type == 'sellist')
{
- $param_list=array_keys($param['options']);
+ $param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
- $selectkey="rowid";
- $keyList='rowid';
+ $selectkey = "rowid";
+ $keyList = 'rowid';
- if (count($InfoFieldList)>=3)
+ if (count($InfoFieldList) >= 3)
{
$selectkey = $InfoFieldList[2];
- $keyList=$InfoFieldList[2].' as rowid';
+ $keyList = $InfoFieldList[2].' as rowid';
}
$fields_label = explode('|', $InfoFieldList[1]);
- if(is_array($fields_label)) {
- $keyList .=', ';
+ if (is_array($fields_label)) {
+ $keyList .= ', ';
$keyList .= implode(', ', $fields_label);
}
$sql = 'SELECT '.$keyList;
- $sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
- if (strpos($InfoFieldList[4], 'extra')!==false)
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
+ if (strpos($InfoFieldList[4], 'extra') !== false)
{
- $sql.= ' as main';
+ $sql .= ' as main';
}
- if ($selectkey=='rowid' && empty($value)) {
- $sql.= " WHERE ".$selectkey."=0";
- } elseif ($selectkey=='rowid') {
- $sql.= " WHERE ".$selectkey."=".$this->db->escape($value);
- }else {
- $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
+ if ($selectkey == 'rowid' && empty($value)) {
+ $sql .= " WHERE ".$selectkey."=0";
+ } elseif ($selectkey == 'rowid') {
+ $sql .= " WHERE ".$selectkey."=".$this->db->escape($value);
+ } else {
+ $sql .= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
}
//$sql.= ' AND entity = '.$conf->entity;
@@ -1725,38 +1725,38 @@ class ExtraFields
$resql = $this->db->query($sql);
if ($resql)
{
- $value=''; // value was used, so now we reste it to use it to build final output
+ $value = ''; // value was used, so now we reste it to use it to build final output
$obj = $this->db->fetch_object($resql);
// Several field into label (eq table:code|libelle:rowid)
$fields_label = explode('|', $InfoFieldList[1]);
- if(is_array($fields_label) && count($fields_label)>1)
+ if (is_array($fields_label) && count($fields_label) > 1)
{
foreach ($fields_label as $field_toshow)
{
- $translabel='';
+ $translabel = '';
if (!empty($obj->$field_toshow)) {
- $translabel=$langs->trans($obj->$field_toshow);
+ $translabel = $langs->trans($obj->$field_toshow);
}
- if ($translabel!=$field_toshow) {
- $value.=dol_trunc($translabel, 18).' ';
- }else {
- $value.=$obj->$field_toshow.' ';
+ if ($translabel != $field_toshow) {
+ $value .= dol_trunc($translabel, 18).' ';
+ } else {
+ $value .= $obj->$field_toshow.' ';
}
}
}
else
{
- $translabel='';
+ $translabel = '';
if (!empty($obj->{$InfoFieldList[1]})) {
- $translabel=$langs->trans($obj->{$InfoFieldList[1]});
+ $translabel = $langs->trans($obj->{$InfoFieldList[1]});
}
- if ($translabel!=$obj->{$InfoFieldList[1]}) {
- $value=dol_trunc($translabel, 18);
- }else {
- $value=$obj->{$InfoFieldList[1]};
+ if ($translabel != $obj->{$InfoFieldList[1]}) {
+ $value = dol_trunc($translabel, 18);
+ } else {
+ $value = $obj->{$InfoFieldList[1]};
}
}
}
@@ -1764,20 +1764,20 @@ class ExtraFields
}
elseif ($type == 'radio')
{
- $value=$param['options'][$value];
+ $value = $param['options'][$value];
}
elseif ($type == 'checkbox')
{
- $value_arr=explode(',', $value);
- $value='';
- $toprint=array();
+ $value_arr = explode(',', $value);
+ $value = '';
+ $toprint = array();
if (is_array($value_arr))
{
foreach ($value_arr as $keyval=>$valueval) {
- $toprint[]=''.$param['options'][$valueval].'';
+ $toprint[] = ''.$param['options'][$valueval].'';
}
}
- $value=''.implode(' ', $toprint).' ';
+ $value = ''.implode(' ', $toprint).' ';
}
elseif ($type == 'chkbxlst')
{
@@ -1791,7 +1791,7 @@ class ExtraFields
if (count($InfoFieldList) >= 3) {
$selectkey = $InfoFieldList[2];
- $keyList = $InfoFieldList[2] . ' as rowid';
+ $keyList = $InfoFieldList[2].' as rowid';
}
$fields_label = explode('|', $InfoFieldList[1]);
@@ -1820,53 +1820,53 @@ class ExtraFields
if (is_array($fields_label) && count($fields_label) > 1) {
foreach ($fields_label as $field_toshow) {
$translabel = '';
- if (! empty($obj->$field_toshow)) {
+ if (!empty($obj->$field_toshow)) {
$translabel = $langs->trans($obj->$field_toshow);
}
if ($translabel != $field_toshow) {
- $toprint[]=''.dol_trunc($translabel, 18).'';
+ $toprint[] = ''.dol_trunc($translabel, 18).'';
} else {
- $toprint[]=''.$obj->$field_toshow.'';
+ $toprint[] = ''.$obj->$field_toshow.'';
}
}
} else {
$translabel = '';
- if (! empty($obj->{$InfoFieldList[1]})) {
+ if (!empty($obj->{$InfoFieldList[1]})) {
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
}
if ($translabel != $obj->{$InfoFieldList[1]}) {
- $toprint[]=''.dol_trunc($translabel, 18).'';
+ $toprint[] = ''.dol_trunc($translabel, 18).'';
} else {
- $toprint[]=''.$obj->{$InfoFieldList[1]}.'';
+ $toprint[] = ''.$obj->{$InfoFieldList[1]}.'';
}
}
}
}
- $value=''.implode(' ', $toprint).' ';
+ $value = ''.implode(' ', $toprint).' ';
} else {
- dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING);
+ dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING);
}
}
elseif ($type == 'link')
{
- $out='';
+ $out = '';
// Only if something to display (perf)
if ($value) // If we have -1 here, pb is into insert, not into ouptut (fix insert instead of changing code here to compensate)
{
- $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
+ $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath'
$InfoFieldList = explode(":", $param_list[0]);
- $classname=$InfoFieldList[0];
- $classpath=$InfoFieldList[1];
- if (! empty($classpath))
+ $classname = $InfoFieldList[0];
+ $classpath = $InfoFieldList[1];
+ if (!empty($classpath))
{
dol_include_once($InfoFieldList[1]);
if ($classname && class_exists($classname))
{
$object = new $classname($this->db);
$object->fetch($value);
- $value=$object->getNomUrl(3);
+ $value = $object->getNomUrl(3);
}
}
else
@@ -1878,24 +1878,24 @@ class ExtraFields
}
elseif ($type == 'text')
{
- $value=dol_htmlentitiesbr($value);
+ $value = dol_htmlentitiesbr($value);
}
elseif ($type == 'html')
{
- $value=dol_htmlentitiesbr($value);
+ $value = dol_htmlentitiesbr($value);
}
elseif ($type == 'password')
{
- $value=dol_trunc(preg_replace('/./i', '*', $value), 8, 'right', 'UTF-8', 1);
+ $value = dol_trunc(preg_replace('/./i', '*', $value), 8, 'right', 'UTF-8', 1);
}
else
{
- $showsize=round($size);
- if ($showsize > 48) $showsize=48;
+ $showsize = round($size);
+ if ($showsize > 48) $showsize = 48;
}
//print $type.'-'.$size;
- $out=$value;
+ $out = $value;
return $out;
}
@@ -1909,44 +1909,44 @@ class ExtraFields
*/
public function getAlignFlag($key, $extrafieldsobjectkey = '')
{
- global $conf,$langs;
+ global $conf, $langs;
- if (! empty($extrafieldsobjectkey)) $type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
- else $type=$this->attribute_type[$key];
+ if (!empty($extrafieldsobjectkey)) $type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
+ else $type = $this->attribute_type[$key];
- $align='';
+ $align = '';
if ($type == 'date')
{
- $align="center";
+ $align = "center";
}
elseif ($type == 'datetime')
{
- $align="center";
+ $align = "center";
}
elseif ($type == 'int')
{
- $align="right";
+ $align = "right";
}
elseif ($type == 'double')
{
- $align="right";
+ $align = "right";
}
elseif ($type == 'boolean')
{
- $align="center";
+ $align = "center";
}
elseif ($type == 'radio')
{
- $align="center";
+ $align = "center";
}
elseif ($type == 'checkbox')
{
- $align="center";
+ $align = "center";
}
elseif ($type == 'price')
{
- $align="right";
+ $align = "right";
}
return $align;
@@ -1964,8 +1964,8 @@ class ExtraFields
global $langs;
$out = '';
+ $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]);
+ $out .= '';
$extrafield_param = $this->attributes[$object->table_element]['param'][$key];
if (!empty($extrafield_param) && is_array($extrafield_param)) {
@@ -1982,19 +1982,19 @@ class ExtraFields
$out .= '\n";
}
- if (! empty($conf->use_javascript_ajax) || $onlyselect)
+ if (!empty($conf->use_javascript_ajax) || $onlyselect)
{
//var_dump($selected);
- if ($selected == 'done') $selected='100';
- print '';
- if ($showempty) print '';
- foreach($listofstatus as $key => $val)
+ if ($selected == 'done') $selected = '100';
+ print '';
+ if ($showempty) print '';
+ foreach ($listofstatus as $key => $val)
{
print '';
if ($key == '50' && $onlyselect == 2)
@@ -140,17 +140,17 @@ class FormActions
}
}
print '';
- if ($selected == 0 || $selected == 100) $canedit=0;
+ if ($selected == 0 || $selected == 100) $canedit = 0;
if (empty($onlyselect))
{
- print ' =0)?'':' disabled').'>';
+ print ' = 0) ? '' : ' disabled').'>';
print '%';
}
}
else
{
- print ' %';
+ print ' %';
}
}
@@ -170,79 +170,79 @@ class FormActions
*/
public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlright = '')
{
- global $langs,$conf,$user;
+ global $langs, $conf, $user;
global $bc;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
- $sortfield='a.datep,a.id';
- $sortorder='DESC,DESC';
+ $sortfield = 'a.datep,a.id';
+ $sortorder = 'DESC,DESC';
- $listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max?($max+1):0));
- if (! is_array($listofactions)) dol_print_error($this->db, 'FailedToGetActions');
+ $listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
+ if (!is_array($listofactions)) dol_print_error($this->db, 'FailedToGetActions');
$num = count($listofactions);
if ($num || $forceshowtitle)
{
- if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
- elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnBill');
- elseif ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
- elseif ($typeelement == 'supplier_proposal') $title=$langs->trans('ActionsOnSupplierProposal');
- elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
- elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
- elseif ($typeelement == 'shipping') $title=$langs->trans('ActionsOnShipping');
- elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter');
- elseif ($typeelement == 'project') $title=$langs->trans('LatestLinkedEvents', $max?$max:'');
- elseif ($typeelement == 'task') $title=$langs->trans('LatestLinkedEvents', $max?$max:'');
- elseif ($typeelement == 'member') $title=$langs->trans('LatestLinkedEvents', $max?$max:'');
- else $title=$langs->trans("LatestLinkedEvents", $max?$max:'');
+ if ($typeelement == 'invoice') $title = $langs->trans('ActionsOnBill');
+ elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title = $langs->trans('ActionsOnBill');
+ elseif ($typeelement == 'propal') $title = $langs->trans('ActionsOnPropal');
+ elseif ($typeelement == 'supplier_proposal') $title = $langs->trans('ActionsOnSupplierProposal');
+ elseif ($typeelement == 'order') $title = $langs->trans('ActionsOnOrder');
+ elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title = $langs->trans('ActionsOnOrder');
+ elseif ($typeelement == 'shipping') $title = $langs->trans('ActionsOnShipping');
+ elseif ($typeelement == 'fichinter') $title = $langs->trans('ActionsOnFicheInter');
+ elseif ($typeelement == 'project') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
+ elseif ($typeelement == 'task') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
+ elseif ($typeelement == 'member') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
+ else $title = $langs->trans("LatestLinkedEvents", $max ? $max : '');
- $urlbacktopage=$_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage?'&'.$moreparambacktopage:'');
+ $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage ? '&'.$moreparambacktopage : '');
$projectid = $object->fk_project;
if ($typeelement == 'project') $projectid = $object->id;
- $newcardbutton='';
- if (! empty($conf->agenda->enabled))
+ $newcardbutton = '';
+ if (!empty($conf->agenda->enabled))
{
- $newcardbutton.= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:($socid>0?'&socid='.$socid:'')).($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage));
+ $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage));
}
print ''."\n";
print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlright);
- $page=0; $param='';
+ $page = 0; $param = '';
print '';
- print ' ';
+ print '';
print '';
- print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
- print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
- print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
+ print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
+ print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
+ print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Title', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
- print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, '', $sortfield, $sortorder, 'center ', 1);
- print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, 'right ', 1);
+ print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, '', $sortfield, $sortorder, 'center ', 1);
+ print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, 'right ', 1);
print ' ';
print "\n";
if (is_array($listofactions) && count($listofactions))
{
- $cacheusers=array();
+ $cacheusers = array();
$cursorevent = 0;
- foreach($listofactions as $action)
+ foreach ($listofactions as $action)
{
if ($max && $cursorevent >= $max) break;
- $ref=$action->getNomUrl(1, -1);
- $label=$action->getNomUrl(0, 38);
+ $ref = $action->getNomUrl(1, -1);
+ $label = $action->getNomUrl(0, 38);
print '';
// Ref
print '| '.$ref.' | ';
// Onwer
print '';
- if (! empty($action->userownerid))
+ if (!empty($action->userownerid))
{
if (is_object($cacheusers[$action->userownerid]))
{
@@ -262,17 +262,17 @@ class FormActions
print ' | ';
// Type
print '';
- $imgpicto='';
- if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
+ $imgpicto = '';
+ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
- if ($action->type_picto) $imgpicto=img_picto('', $action->type_picto);
+ if ($action->type_picto) $imgpicto = img_picto('', $action->type_picto);
else {
- if ($action->type_code == 'AC_RDV') $imgpicto=img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
- elseif ($action->type_code == 'AC_TEL') $imgpicto=img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
- elseif ($action->type_code == 'AC_FAX') $imgpicto=img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
- elseif ($action->type_code == 'AC_EMAIL') $imgpicto=img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
- elseif ($action->type_code == 'AC_INT') $imgpicto=img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
- elseif (! preg_match('/_AUTO/', $action->type_code)) $imgpicto=img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' ';
+ if ($action->type_code == 'AC_RDV') $imgpicto = img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
+ elseif ($action->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
+ elseif ($action->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
+ elseif ($action->type_code == 'AC_EMAIL') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
+ elseif ($action->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
+ elseif (!preg_match('/_AUTO/', $action->type_code)) $imgpicto = img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' ';
}
}
print $imgpicto;
@@ -284,8 +284,8 @@ class FormActions
print ' | '.dol_print_date($action->datep, 'dayhour', 'tzuserrel');
if ($action->datef)
{
- $tmpa=dol_getdate($action->datep);
- $tmpb=dol_getdate($action->datef);
+ $tmpa = dol_getdate($action->datep);
+ $tmpb = dol_getdate($action->datef);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year'])
{
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($action->datef, 'hour', 'tzuserrel');
@@ -335,39 +335,39 @@ class FormActions
public function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0)
{
// phpcs:enable
- global $langs,$user,$form,$conf;
+ global $langs, $user, $form, $conf;
- if (! is_object($form)) $form=new Form($this->db);
+ if (!is_object($form)) $form = new Form($this->db);
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
- $caction=new CActionComm($this->db);
+ $caction = new CActionComm($this->db);
// Suggest a list with manual events or all auto events
- $arraylist=$caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
- array_unshift($arraylist, ' '); // Add empty line at start
+ $arraylist = $caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
+ array_unshift($arraylist, ' '); // Add empty line at start
//asort($arraylist);
- if ($selected == 'manual') $selected='AC_OTH';
- if ($selected == 'auto') $selected='AC_OTH_AUTO';
+ if ($selected == 'manual') $selected = 'AC_OTH';
+ if ($selected == 'auto') $selected = 'AC_OTH_AUTO';
- if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']);
+ if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']);
- $out='';
+ $out = '';
- if (! empty($multiselect))
+ if (!empty($multiselect))
{
if (!is_array($selected) && !empty($selected)) $selected = explode(',', $selected);
- $out.=$form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0);
+ $out .= $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0);
}
else
{
- $out.=$form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth200', 1);
+ $out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth200', 1);
}
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
{
- $out.=info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup").($hideinfohelp == -1 ? ". ".$langs->trans("YouCanSetDefaultValueInModuleSetup") : ''), 1);
+ $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup").($hideinfohelp == -1 ? ". ".$langs->trans("YouCanSetDefaultValueInModuleSetup") : ''), 1);
}
if ($nooutput) return $out;
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index 76b9d07a2c4..759b7cc4c0d 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -46,17 +46,17 @@ class FormCompany extends Form
public function typent_array($mode = 0, $filter = '')
{
// phpcs:enable
- global $langs,$mysoc;
+ global $langs, $mysoc;
$effs = array();
$sql = "SELECT id, code, libelle";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_typent";
- $sql.= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id)?'0':$mysoc->country_id).")";
- if ($filter) $sql.=" ".$filter;
- $sql.= " ORDER by position, id";
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_typent";
+ $sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ? '0' : $mysoc->country_id).")";
+ if ($filter) $sql .= " ".$filter;
+ $sql .= " ORDER by position, id";
dol_syslog(get_class($this).'::typent_array', LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
@@ -65,11 +65,11 @@ class FormCompany extends Form
while ($i < $num)
{
$objp = $this->db->fetch_object($resql);
- if (! $mode) $key=$objp->id;
- else $key=$objp->code;
+ if (!$mode) $key = $objp->id;
+ else $key = $objp->code;
if ($langs->trans($objp->code) != $objp->code) $effs[$key] = $langs->trans($objp->code);
else $effs[$key] = $objp->libelle;
- if ($effs[$key]=='-') $effs[$key]='';
+ if ($effs[$key] == '-') $effs[$key] = '';
$i++;
}
$this->db->free($resql);
@@ -93,11 +93,11 @@ class FormCompany extends Form
$sql = "SELECT id, code, libelle";
$sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
- $sql.= " WHERE active = 1";
- if ($filter) $sql.=" ".$filter;
+ $sql .= " WHERE active = 1";
+ if ($filter) $sql .= " ".$filter;
$sql .= " ORDER BY id ASC";
dol_syslog(get_class($this).'::effectif_array', LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
@@ -106,10 +106,10 @@ class FormCompany extends Form
while ($i < $num)
{
$objp = $this->db->fetch_object($resql);
- if (! $mode) $key=$objp->id;
- else $key=$objp->code;
+ if (!$mode) $key = $objp->id;
+ else $key = $objp->code;
- $effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
+ $effs[$key] = $objp->libelle != '-' ? $objp->libelle : '';
$i++;
}
$this->db->free($resql);
@@ -139,9 +139,9 @@ class FormCompany extends Form
dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG);
$sql = "SELECT code, label";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
- $sql.= " WHERE active > 0";
- $sql.= " ORDER BY sortorder";
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
+ $sql .= " WHERE active > 0";
+ $sql .= " ORDER BY sortorder";
$resql = $this->db->query($sql);
if ($resql)
{
@@ -164,7 +164,7 @@ class FormCompany extends Form
print Form::selectarray($htmlname, $options, $selected);
}
else dol_print_error($this->db);
- if (! empty($htmlname) && $user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ if (!empty($htmlname) && $user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '';
print '';
}
@@ -203,88 +203,88 @@ class FormCompany extends Form
public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'state_id')
{
// phpcs:enable
- global $conf,$langs,$user;
+ global $conf, $langs, $user;
dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid, LOG_DEBUG);
$langs->load("dict");
- $out='';
+ $out = '';
// Serch departements/cantons/province active d'une region et pays actif
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
- $sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
+ $sql .= " ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
if ($country_codeid && is_numeric($country_codeid)) $sql .= " AND c.rowid = '".$this->db->escape($country_codeid)."'";
- if ($country_codeid && ! is_numeric($country_codeid)) $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
+ if ($country_codeid && !is_numeric($country_codeid)) $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
$sql .= " ORDER BY c.code, d.code_departement";
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
- if (!empty($htmlname)) $out.= '';
- if ($country_codeid) $out.= '';
+ if (!empty($htmlname)) $out .= '';
+ if ($country_codeid) $out .= '';
$num = $this->db->num_rows($result);
$i = 0;
dol_syslog(get_class($this)."::select_departement num=".$num, LOG_DEBUG);
if ($num)
{
- $country='';
+ $country = '';
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($obj->code == '0') // Le code peut etre une chaine
{
- $out.= '';
+ $out .= '';
}
else {
- if (! $country || $country != $obj->country)
+ if (!$country || $country != $obj->country)
{
// Affiche la rupture si on est en mode liste multipays
- if (! $country_codeid && $obj->country_code)
+ if (!$country_codeid && $obj->country_code)
{
- $out.= '\n";
- $country=$obj->country;
+ $out .= '\n";
+ $country = $obj->country;
}
}
- if ((! empty($selected) && $selected == $obj->rowid)
- || (empty($selected) && ! empty($conf->global->MAIN_FORCE_DEFAULT_STATE_ID) && $conf->global->MAIN_FORCE_DEFAULT_STATE_ID == $obj->rowid))
+ if ((!empty($selected) && $selected == $obj->rowid)
+ || (empty($selected) && !empty($conf->global->MAIN_FORCE_DEFAULT_STATE_ID) && $conf->global->MAIN_FORCE_DEFAULT_STATE_ID == $obj->rowid))
{
- $out.= '';
+ $out .= '';
}
$i++;
}
}
- if (! empty($htmlname)) $out.= '';
- if (! empty($htmlname) && $user->admin) $out.= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ if (!empty($htmlname)) $out .= '';
+ if (!empty($htmlname) && $user->admin) $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
else
{
@@ -292,9 +292,9 @@ class FormCompany extends Form
}
// Make select dynamic
- if (! empty($htmlname))
+ if (!empty($htmlname))
{
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
@@ -316,16 +316,16 @@ class FormCompany extends Form
public function select_region($selected = '', $htmlname = 'region_id')
{
// phpcs:enable
- global $conf,$langs;
+ global $conf, $langs;
$langs->load("dict");
$sql = "SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c";
- $sql.= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
- $sql.= " ORDER BY c.code, c.label ASC";
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c";
+ $sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
+ $sql .= " ORDER BY c.code, c.label ASC";
dol_syslog(get_class($this)."::select_region", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
print '';
@@ -333,7 +333,7 @@ class FormCompany extends Form
$i = 0;
if ($num)
{
- $country='';
+ $country = '';
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
@@ -344,10 +344,10 @@ class FormCompany extends Form
if ($country == '' || $country != $obj->country)
{
// Show break
- $key=$langs->trans("Country".strtoupper($obj->country_code));
- $valuetoshow=($key != "Country".strtoupper($obj->country_code))?$obj->country_code." - ".$key:$obj->country;
+ $key = $langs->trans("Country".strtoupper($obj->country_code));
+ $valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country;
print '\n";
- $country=$obj->country;
+ $country = $obj->country;
}
if ($selected > 0 && $selected == $obj->code)
@@ -382,20 +382,20 @@ class FormCompany extends Form
public function select_civility($selected = '', $htmlname = 'civility_id', $morecss = 'maxwidth100')
{
// phpcs:enable
- global $conf,$langs,$user;
+ global $conf, $langs, $user;
$langs->load("dict");
- $out='';
+ $out = '';
$sql = "SELECT rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_civility";
- $sql.= " WHERE active = 1";
+ $sql .= " WHERE active = 1";
dol_syslog("Form::select_civility", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
- $out.= '';
- $out.= '';
+ $out .= '';
+ $out .= '';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
@@ -405,20 +405,20 @@ class FormCompany extends Form
$obj = $this->db->fetch_object($resql);
if ($selected == $obj->code)
{
- $out.= '';
+ $out .= ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
+ $out .= '';
$i++;
}
}
- $out.= '';
- if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ $out .= '';
+ if ($user->admin) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
else
{
@@ -460,10 +460,10 @@ class FormCompany extends Form
public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
{
// phpcs:enable
- global $conf,$langs,$user;
+ global $conf, $langs, $user;
$langs->load("dict");
- $out='';
+ $out = '';
// On recherche les formes juridiques actives des pays actifs
$sql = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
@@ -475,70 +475,70 @@ class FormCompany extends Form
$sql .= " ORDER BY c.code";
dol_syslog(get_class($this)."::select_juridicalstatus", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
- $out.= '';
- $out.= ' ';
- if ($country_codeid) $out.= ''; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
+ $out .= '';
+ $out .= '';
+ if ($country_codeid) $out .= ''; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
$num = $this->db->num_rows($resql);
if ($num)
{
$i = 0;
- $country=''; $arraydata=array();
+ $country = ''; $arraydata = array();
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($obj->code) // We exclude empty line, we will add it later
{
- $labelcountry=(($langs->trans("Country".$obj->country_code)!="Country".$obj->country_code) ? $langs->trans("Country".$obj->country_code) : $obj->country);
- $labeljs=(($langs->trans("JuridicalStatus".$obj->code)!="JuridicalStatus".$obj->code) ? $langs->trans("JuridicalStatus".$obj->code) : ($obj->label!='-'?$obj->label:'')); // $obj->label is already in output charset (converted by database driver)
- $arraydata[$obj->code]=array('code'=>$obj->code, 'label'=>$labeljs, 'label_sort'=>$labelcountry.'_'.$labeljs, 'country_code'=>$obj->country_code, 'country'=>$labelcountry);
+ $labelcountry = (($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) ? $langs->trans("Country".$obj->country_code) : $obj->country);
+ $labeljs = (($langs->trans("JuridicalStatus".$obj->code) != "JuridicalStatus".$obj->code) ? $langs->trans("JuridicalStatus".$obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver)
+ $arraydata[$obj->code] = array('code'=>$obj->code, 'label'=>$labeljs, 'label_sort'=>$labelcountry.'_'.$labeljs, 'country_code'=>$obj->country_code, 'country'=>$labelcountry);
}
$i++;
}
- $arraydata=dol_sort_array($arraydata, 'label_sort', 'ASC');
+ $arraydata = dol_sort_array($arraydata, 'label_sort', 'ASC');
if (empty($country_codeid)) // Introduce empty value (if $country_codeid not empty, empty value was already added)
{
- $arraydata[0]=array('code'=>0, 'label'=>'', 'label_sort'=>'_', 'country_code'=>'', 'country'=>'');
+ $arraydata[0] = array('code'=>0, 'label'=>'', 'label_sort'=>'_', 'country_code'=>'', 'country'=>'');
}
- foreach($arraydata as $key => $val)
+ foreach ($arraydata as $key => $val)
{
- if (! $country || $country != $val['country'])
+ if (!$country || $country != $val['country'])
{
// Show break when we are in multi country mode
if (empty($country_codeid) && $val['country_code'])
{
- $out.= '\n";
- $country=$val['country'];
+ $out .= '\n";
+ $country = $val['country'];
}
}
if ($selected > 0 && $selected == $val['code'])
{
- $out.= '';
+ $out .= $val['label'];
+ $out .= '';
}
}
- $out.= '';
- if ($user->admin) $out.= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ $out .= '';
+ if ($user->admin) $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
// Make select dynamic
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
- $out.= ' ';
+ $out .= ' ';
}
else
{
@@ -566,15 +566,15 @@ class FormCompany extends Form
{
global $conf, $langs;
- if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT))
+ if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT))
{
// Use Ajax search
- $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
+ $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2);
- $socid=0; $name='';
+ $socid = 0; $name = '';
if ($selected > 0)
{
- $tmpthirdparty=new Societe($this->db);
+ $tmpthirdparty = new Societe($this->db);
$result = $tmpthirdparty->fetch($selected);
if ($result > 0)
{
@@ -584,13 +584,13 @@ class FormCompany extends Form
}
- $events=array();
+ $events = array();
// Add an entry 'method' to say 'yes, we must execute url with param action = method';
// Add an entry 'url' to say which url to execute
// Add an entry htmlname to say which element we must change once url is called
// Add entry params => array('cssid' => 'attr') to say to remov or add attribute attr if answer of url return 0 or >0 lines
// To refresh contacts list on thirdparty list change
- $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
+ $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
if (count($events)) // If there is some ajax events to run once selection is done, we add code here to run events
{
@@ -646,29 +646,29 @@ class FormCompany extends Form
print "\n".''."\n";
print '';
- print ajax_autocompleter(($socid?$socid:-1), $htmlname, DOL_URL_ROOT.'/societe/ajaxcompanies.php', '', $minLength, 0);
+ print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.'/societe/ajaxcompanies.php', '', $minLength, 0);
return $socid;
}
else
{
// Search to list thirdparties
$sql = "SELECT s.rowid, s.nom as name FROM";
- $sql.= " ".MAIN_DB_PREFIX."societe as s";
- $sql.= " WHERE s.entity IN (".getEntity('societe').")";
+ $sql .= " ".MAIN_DB_PREFIX."societe as s";
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")";
// For ajax search we limit here. For combo list, we limit later
if (is_array($limitto) && count($limitto))
{
- $sql.= " AND s.rowid IN (".join(',', $limitto).")";
+ $sql .= " AND s.rowid IN (".join(',', $limitto).")";
}
- $sql.= " ORDER BY s.nom ASC";
+ $sql .= " ORDER BY s.nom ASC";
$resql = $this->db->query($sql);
if ($resql)
{
- print 'use_javascript_ajax)
{
- $javaScript = "window.location='".$_SERVER['PHP_SELF']."?".$var_id."=".($forceid>0?$forceid:$object->id).$moreparam."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
+ $javaScript = "window.location='".$_SERVER['PHP_SELF']."?".$var_id."=".($forceid > 0 ? $forceid : $object->id).$moreparam."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
print ' onChange="'.$javaScript.'"';
}
print '>';
@@ -680,8 +680,8 @@ class FormCompany extends Form
{
$obj = $this->db->fetch_object($resql);
if ($i == 0) $firstCompany = $obj->rowid;
- $disabled=0;
- if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid, $limitto)) $disabled=1;
+ $disabled = 0;
+ if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) $disabled = 1;
if ($selected > 0 && $selected == $obj->rowid)
{
print '';
}
- $i ++;
+ $i++;
}
}
print "\n";
@@ -729,9 +729,9 @@ class FormCompany extends Form
if (is_object($object) && method_exists($object, 'liste_type_contact'))
{
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
- print '';
+ print '';
if ($showempty) print '';
- foreach($lesTypes as $key=>$value)
+ foreach ($lesTypes as $key=>$value)
{
print ' | ";
- $i=0;
+ $i = 0;
while ($i < $num)
{
diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php
index 4088b00c151..8128a449cfd 100644
--- a/htdocs/core/lib/cron.lib.php
+++ b/htdocs/core/lib/cron.lib.php
@@ -87,17 +87,17 @@ function dol_print_cron_urls()
global $dolibarr_main_url_root;
// Define $urlwithroot
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
- $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Cron launch
print '';
print $langs->trans("URLToLaunchCronJobs").': ';
- $url=$urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY)?'':'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login;
+ $url = $urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login;
print img_picto('', 'globe').' '.$url."\n";
print ' '.$langs->trans("OrToLaunchASpecificJob").' ';
- $url=$urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY)?'':'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid';
+ $url = $urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid';
print img_picto('', 'globe').' '.$url."\n";
print ' ';
print ' ';
@@ -107,22 +107,22 @@ function dol_print_cron_urls()
print ''.$langs->trans("FileToLaunchCronJobs").': ';
- $file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]';
+ $file = '/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]';
print ' \n";
print ' ';
// Add note
if (empty($conf->global->CRON_DISABLE_TUTORIAL_CRON))
{
- $linuxlike=1;
- if (preg_match('/^win/i', PHP_OS)) $linuxlike=0;
- if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0;
+ $linuxlike = 1;
+ if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0;
+ if (preg_match('/^mac/i', PHP_OS)) $linuxlike = 0;
print $langs->trans("Note").': ';
if ($linuxlike)
{
print $langs->trans("CronExplainHowToRunUnix");
print ' ';
- print ' ';
+ print ' ';
}
else
{
diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php
index 568da82368f..66b39809b29 100644
--- a/htdocs/core/lib/payments.lib.php
+++ b/htdocs/core/lib/payments.lib.php
@@ -136,12 +136,12 @@ function showOnlinePaymentUrl($type, $ref)
// Load translation files required by the page
$langs->loadLangs(array('payment', 'paybox'));
- $servicename=$langs->transnoentitiesnoconv('Online');
+ $servicename = $langs->transnoentitiesnoconv('Online');
$out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).' ';
$url = getOnlinePaymentUrl(0, $type, $ref);
- $out.= '';
- $out.= ajax_autoselect("onlinepaymenturl", 0);
+ $out .= '';
+ $out .= ajax_autoselect("onlinepaymenturl", 0);
return $out;
}
@@ -160,12 +160,12 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
{
global $conf, $dolibarr_main_url_root;
- $ref=str_replace(' ', '', $ref);
- $out='';
+ $ref = str_replace(' ', '', $ref);
+ $out = '';
// Define $urlwithroot
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
- $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$urltouse = DOL_MAIN_URL_ROOT;
@@ -295,51 +295,51 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0,
global $conf;
// Juridical status
- $line1="";
+ $line1 = "";
if ($fromcompany->forme_juridique_code)
{
- $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
+ $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
}
// Capital
if ($fromcompany->capital)
{
- $line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
+ $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
}
// Prof Id 1
- if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2))
+ if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2))
{
- $field=$langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
- if (preg_match('/\((.*)\)/i', $field, $reg)) $field=$reg[1];
- $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
+ $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
+ if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
+ $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
}
// Prof Id 2
if ($fromcompany->idprof2)
{
- $field=$langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
- if (preg_match('/\((.*)\)/i', $field, $reg)) $field=$reg[1];
- $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
+ $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
+ if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
+ $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
}
// Second line of company infos
- $line2="";
+ $line2 = "";
// Prof Id 3
if ($fromcompany->idprof3)
{
- $field=$langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
- if (preg_match('/\((.*)\)/i', $field, $reg)) $field=$reg[1];
- $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
+ $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
+ if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
+ $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
}
// Prof Id 4
if ($fromcompany->idprof4)
{
- $field=$langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
- if (preg_match('/\((.*)\)/i', $field, $reg)) $field=$reg[1];
- $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
+ $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
+ if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
+ $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '')
{
- $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
+ $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
}
print ' ';
@@ -350,16 +350,16 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0,
print '';
print ' ';
- $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
- if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
- elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
+ $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
+ if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
+ elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
// Add other message if VAT exists
if ($object->total_vat != 0 || $object->total_tva != 0)
{
- $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
- if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
- elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
+ $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
+ if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
+ elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
}
}
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index bdeb9181d3b..095a65c3584 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -45,7 +45,7 @@ function product_prepare_head($object)
$head[$h][2] = 'card';
$h++;
- if (! empty($object->status))
+ if (!empty($object->status))
{
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id;
$head[$h][1] = $langs->trans("SellingPrices");
@@ -53,10 +53,10 @@ function product_prepare_head($object)
$h++;
}
- if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase
+ if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase
{
- if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
- || (! empty($conf->margin->enabled) && $user->rights->margin->liretous)
+ if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
+ || (!empty($conf->margin->enabled) && $user->rights->margin->liretous)
)
{
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
@@ -67,7 +67,7 @@ function product_prepare_head($object)
}
// Multilangs
- if (! empty($conf->global->MAIN_MULTILANGS))
+ if (!empty($conf->global->MAIN_MULTILANGS))
{
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$object->id;
$head[$h][1] = $langs->trans("Translation");
@@ -130,16 +130,16 @@ function product_prepare_head($object)
// Tab to link resources
if (!empty($conf->resource->enabled))
{
- if ($object->isProduct() && ! empty($conf->global->RESOURCE_ON_PRODUCTS))
+ if ($object->isProduct() && !empty($conf->global->RESOURCE_ON_PRODUCTS))
{
- $head[$h][0] = DOL_URL_ROOT . '/resource/element_resource.php?element=product&ref=' . $object->ref;
+ $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=product&ref='.$object->ref;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
$h++;
}
- if ($object->isService() && ! empty($conf->global->RESOURCE_ON_SERVICES))
+ if ($object->isService() && !empty($conf->global->RESOURCE_ON_SERVICES))
{
- $head[$h][0] = DOL_URL_ROOT . '/resource/element_resource.php?element=service&ref=' . $object->ref;
+ $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=service&ref='.$object->ref;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
$h++;
@@ -188,10 +188,10 @@ function product_prepare_head($object)
// Log
$head[$h][0] = DOL_URL_ROOT.'/product/agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
- if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
+ if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
{
- $head[$h][1].= '/';
- $head[$h][1].= $langs->trans("Agenda");
+ $head[$h][1] .= '/';
+ $head[$h][1] .= $langs->trans("Agenda");
}
$head[$h][2] = 'agenda';
$h++;
@@ -210,7 +210,7 @@ function productlot_prepare_head($object)
global $db, $langs, $conf, $user;
// Load translation files required by the page
- $langs->loadLangs(array("products","productbatch"));
+ $langs->loadLangs(array("products", "productbatch"));
$h = 0;
$head = array();
@@ -270,7 +270,7 @@ function product_admin_prepare_head()
$head[$h][2] = 'general';
$h++;
- if (!empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL))
+ if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL))
{
$head[$h] = array(
0 => DOL_URL_ROOT."/product/admin/price_rules.php",
@@ -342,7 +342,7 @@ function product_lot_admin_prepare_head()
*/
function show_stats_for_company($product, $socid)
{
- global $conf,$langs,$user,$db;
+ global $conf, $langs, $user, $db;
$nblines = 0;
@@ -354,10 +354,10 @@ function show_stats_for_company($product, $socid)
print '';
// Customer proposals
- if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
+ if (!empty($conf->propal->enabled) && $user->rights->propale->lire)
{
$nblines++;
- $ret=$product->load_stats_propale($socid);
+ $ret = $product->load_stats_propale($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("propal");
print '| ';
@@ -372,10 +372,10 @@ function show_stats_for_company($product, $socid)
print ' | ';
}
// Supplier proposals
- if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
+ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
{
$nblines++;
- $ret=$product->load_stats_proposal_supplier($socid);
+ $ret = $product->load_stats_proposal_supplier($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("propal");
print '| ';
@@ -390,10 +390,10 @@ function show_stats_for_company($product, $socid)
print ' | ';
}
// Customer orders
- if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
+ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$nblines++;
- $ret=$product->load_stats_commande($socid);
+ $ret = $product->load_stats_commande($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
print '| ';
@@ -408,10 +408,10 @@ function show_stats_for_company($product, $socid)
print ' | ';
}
// Supplier orders
- if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
+ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
$nblines++;
- $ret=$product->load_stats_commande_fournisseur($socid);
+ $ret = $product->load_stats_commande_fournisseur($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
print '| ';
@@ -426,10 +426,10 @@ function show_stats_for_company($product, $socid)
print ' | ';
}
// Customer invoices
- if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
+ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$nblines++;
- $ret=$product->load_stats_facture($socid);
+ $ret = $product->load_stats_facture($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("bills");
print '| ';
@@ -444,10 +444,10 @@ function show_stats_for_company($product, $socid)
print ' | ';
}
// Supplier invoices
- if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
+ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
{
$nblines++;
- $ret=$product->load_stats_facture_fournisseur($socid);
+ $ret = $product->load_stats_facture_fournisseur($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("bills");
print '| ';
@@ -463,10 +463,10 @@ function show_stats_for_company($product, $socid)
}
// Contracts
- if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
+ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$nblines++;
- $ret=$product->load_stats_contrat($socid);
+ $ret = $product->load_stats_contrat($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("contracts");
print ' | ';
@@ -514,7 +514,7 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho
{
global $langs, $db;
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
- $measuringUnits= new CUnits($db);
+ $measuringUnits = new CUnits($db);
if ($scale !== '')
{
@@ -534,10 +534,10 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho
}
$result = $measuringUnits->fetchAll('', '', 0, 0, $arrayforfilter);
- if ($result<0) {
+ if ($result < 0) {
return -1;
} else {
- if (is_array($measuringUnits->records) && count($measuringUnits->records)>0) {
+ if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
if ($use_short_label) return $measuringUnits->records[key($measuringUnits->records)]->short_label;
else return $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
} else {
@@ -555,8 +555,8 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho
*/
function measuring_units_squared($unit)
{
- $measuring_units=array();
- $measuring_units[0] = 0; // m -> m3
+ $measuring_units = array();
+ $measuring_units[0] = 0; // m -> m3
$measuring_units[-1] = -2; // dm-> dm2
$measuring_units[-2] = -4; // cm -> cm2
$measuring_units[-3] = -6; // mm -> mm2
@@ -575,8 +575,8 @@ function measuring_units_squared($unit)
*/
function measuring_units_cubed($unit)
{
- $measuring_units=array();
- $measuring_units[0] = 0; // m -> m2
+ $measuring_units = array();
+ $measuring_units[0] = 0; // m -> m2
$measuring_units[-1] = -3; // dm-> dm3
$measuring_units[-2] = -6; // cm -> cm3
$measuring_units[-3] = -9; // mm -> mm3
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 21df0301d49..b7609ab82ae 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -259,13 +259,13 @@ function project_timesheet_prepare_head($mode, $fuser = null)
$h = 0;
- $param='';
- $param.=($mode?'&mode='.$mode:'');
- if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id;
+ $param = '';
+ $param .= ($mode ? '&mode='.$mode : '');
+ if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param .= '&search_usertoprocessid='.$fuser->id;
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK))
{
- $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param?'?'.$param:'');
+ $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param ? '?'.$param : '');
$head[$h][1] = $langs->trans("InputPerWeek");
$head[$h][2] = 'inputperweek';
$h++;
@@ -273,7 +273,7 @@ function project_timesheet_prepare_head($mode, $fuser = null)
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME))
{
- $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param?'?'.$param:'');
+ $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param ? '?'.$param : '');
$head[$h][1] = $langs->trans("InputPerDay");
$head[$h][2] = 'inputperday';
$h++;
@@ -353,10 +353,10 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
global $user, $bc, $langs, $conf, $db;
global $projectstatic, $taskstatic;
- $lastprojectid=0;
+ $lastprojectid = 0;
- $projectsArrayId=explode(',', $projectsListId);
- if ($filterprogresscalc!=='') {
+ $projectsArrayId = explode(',', $projectsListId);
+ if ($filterprogresscalc !== '') {
foreach ($lines as $key=>$line) {
if (!empty($line->planned_workload) && !empty($line->duration)) {
$filterprogresscalc = str_replace(' = ', ' == ', $filterprogresscalc);
@@ -365,27 +365,27 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
}
- $lines=array_values($lines);
+ $lines = array_values($lines);
}
- $numlines=count($lines);
+ $numlines = count($lines);
// We declare counter as global because we want to edit them into recursive call
global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed;
if ($level == 0)
{
- $total_projectlinesa_spent=0;
- $total_projectlinesa_planned=0;
- $total_projectlinesa_spent_if_planned=0;
- $total_projectlinesa_declared_if_planned=0;
- $total_projectlinesa_tobill=0;
- $total_projectlinesa_billed=0;
+ $total_projectlinesa_spent = 0;
+ $total_projectlinesa_planned = 0;
+ $total_projectlinesa_spent_if_planned = 0;
+ $total_projectlinesa_declared_if_planned = 0;
+ $total_projectlinesa_tobill = 0;
+ $total_projectlinesa_billed = 0;
}
- for ($i = 0 ; $i < $numlines ; $i++)
+ for ($i = 0; $i < $numlines; $i++)
{
- if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines
+ if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines
// Process line
// print "i:".$i."-".$lines[$i]->fk_project.' ';
@@ -393,26 +393,26 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($lines[$i]->fk_parent == $parent || $level < 0) // if $level = -1, we dont' use sublevel recursion, we show all lines
{
// Show task line.
- $showline=1;
- $showlineingray=0;
+ $showline = 1;
+ $showlineingray = 0;
// If there is filters to use
if (is_array($taskrole))
{
// If task not legitimate to show, search if a legitimate task exists later in tree
- if (! isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent)
+ if (!isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent)
{
// So search if task has a subtask legitimate to show
- $foundtaskforuserdeeper=0;
+ $foundtaskforuserdeeper = 0;
searchTaskInChild($foundtaskforuserdeeper, $lines[$i]->id, $lines, $taskrole);
//print '$foundtaskforuserpeeper='.$foundtaskforuserdeeper.' ';
if ($foundtaskforuserdeeper > 0)
{
- $showlineingray=1; // We will show line but in gray
+ $showlineingray = 1; // We will show line but in gray
}
else
{
- $showline=0; // No reason to show line
+ $showline = 0; // No reason to show line
}
}
}
@@ -423,12 +423,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if (empty($user->rights->projet->all->lire))
{
// User is not allowed on this project and project is not public, so we hide line
- if (! in_array($lines[$i]->fk_project, $projectsArrayId))
+ if (!in_array($lines[$i]->fk_project, $projectsArrayId))
{
// Note that having a user assigned to a task into a project user has no permission on, should not be possible
// because assignement on task can be done only on contact of project.
// If assignement was done and after, was removed from contact of project, then we can hide the line.
- $showline=0;
+ $showline = 0;
}
}
}
@@ -439,26 +439,26 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{
$var = !$var;
- $lastprojectid=$lines[$i]->fk_project;
+ $lastprojectid = $lines[$i]->fk_project;
}
print ' | '."\n";
- $projectstatic->id=$lines[$i]->fk_project;
- $projectstatic->ref=$lines[$i]->projectref;
- $projectstatic->public=$lines[$i]->public;
- $projectstatic->title=$lines[$i]->projectlabel;
- $projectstatic->usage_bill_time=$lines[$i]->usage_bill_time;
+ $projectstatic->id = $lines[$i]->fk_project;
+ $projectstatic->ref = $lines[$i]->projectref;
+ $projectstatic->public = $lines[$i]->public;
+ $projectstatic->title = $lines[$i]->projectlabel;
+ $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
- $taskstatic->id=$lines[$i]->id;
- $taskstatic->ref=$lines[$i]->ref;
- $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:'');
+ $taskstatic->id = $lines[$i]->id;
+ $taskstatic->ref = $lines[$i]->ref;
+ $taskstatic->label = ($taskrole[$lines[$i]->id] ? $langs->trans("YourRole").': '.$taskrole[$lines[$i]->id] : '');
$taskstatic->projectstatus = $lines[$i]->projectstatus;
$taskstatic->progress = $lines[$i]->progress;
$taskstatic->fk_statut = $lines[$i]->status;
$taskstatic->datee = $lines[$i]->date_end;
- $taskstatic->planned_workload= $lines[$i]->planned_workload;
- $taskstatic->duration_effective= $lines[$i]->duration;
+ $taskstatic->planned_workload = $lines[$i]->planned_workload;
+ $taskstatic->duration_effective = $lines[$i]->duration;
if ($showproject)
@@ -466,14 +466,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Project ref
print "| ";
//if ($showlineingray) print '';
- if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
+ if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId) || !empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
else print $projectstatic->getNomUrl(1, 'nolink');
//if ($showlineingray) print '';
print " | ";
// Project status
print '';
- $projectstatic->statut=$lines[$i]->projectstatus;
+ $projectstatic->statut = $lines[$i]->projectstatus;
print $projectstatic->getLibStatut(2);
print " | ";
}
@@ -494,12 +494,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print "";
if ($showlineingray) print '';
//else print '';
- for ($k = 0 ; $k < $level ; $k++)
+ for ($k = 0; $k < $level; $k++)
{
print ' ';
}
print $lines[$i]->label;
- for ($k = 0 ; $k < $level ; $k++)
+ for ($k = 0; $k < $level; $k++)
{
print ' ';
}
@@ -518,15 +518,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
print ' | ';
- $plannedworkloadoutputformat='allhourmin';
- $timespentoutputformat='allhourmin';
- if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
- if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT;
+ $plannedworkloadoutputformat = 'allhourmin';
+ $timespentoutputformat = 'allhourmin';
+ if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
+ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
// Planned Workload (in working hours)
print '';
- $fullhour=convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
- $workingdelay=convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
+ $fullhour = convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
+ $workingdelay = convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
if ($lines[$i]->planned_workload != '')
{
print $fullhour;
@@ -539,7 +539,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Time spent
print ' | ';
if ($showlineingray) print '';
- else print '';
+ else print '';
if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration, $timespentoutputformat);
else print '--:--';
if ($showlineingray) print '';
@@ -600,20 +600,20 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
// Contacts of task
- if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
+ if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
{
print ' | ';
- foreach(array('internal','external') as $source)
+ foreach (array('internal', 'external') as $source)
{
$tab = $lines[$i]->liste_contact(-1, $source);
- $num=count($tab);
- if (!empty($num)){
- foreach ($tab as $contacttask){
+ $num = count($tab);
+ if (!empty($num)) {
+ foreach ($tab as $contacttask) {
//var_dump($contacttask);
if ($source == 'internal') $c = new User($db);
else $c = new Contact($db);
$c->fetch($contacttask['id']);
- print $c->getNomUrl(1) . ' (' . $contacttask['libelle'] . ')' . ' ';
+ print $c->getNomUrl(1).' ('.$contacttask['libelle'].')'.' ';
}
}
}
@@ -628,7 +628,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print " | \n";
- if (! $showlineingray) $inc++;
+ if (!$showlineingray) $inc++;
if ($level >= 0) // Call sublevels
{
@@ -662,7 +662,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
print '';
print '';
- if ($projectidfortotallink > 0) print '';
+ if ($projectidfortotallink > 0) print '';
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
if ($projectidfortotallink > 0) print '';
print ' | ';
@@ -680,13 +680,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
$progressBarClass = 'progress-bar-danger';
- $badgeClass.= 'badge-danger';
+ $badgeClass .= 'badge-danger';
} elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) { // warning if close at 1%
$progressBarClass = 'progress-bar-warning';
- $badgeClass.= 'badge-warning';
+ $badgeClass .= 'badge-warning';
} else {
$progressBarClass = 'progress-bar-success';
- $badgeClass.= 'badge-success';
+ $badgeClass .= 'badge-success';
}
}
@@ -719,7 +719,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '';
}
// Contacts of task
- if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
+ if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
{
print ' | ';
}
@@ -1169,11 +1169,11 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
// Ref
print '';
print '';
- for ($k = 0 ; $k < $level ; $k++) print " ";
+ for ($k = 0; $k < $level; $k++) print " ";
print $taskstatic->getNomUrl(1, 'withproject', 'time');
// Label task
print ' ';
- for ($k = 0 ; $k < $level ; $k++) print " ";
+ for ($k = 0; $k < $level; $k++) print " ";
print $taskstatic->label;
//print " ";
//for ($k = 0 ; $k < $level ; $k++) print " ";
@@ -1221,20 +1221,20 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
else print '--:--';
print " | \n";
- $disabledproject=1;$disabledtask=1;
+ $disabledproject = 1; $disabledtask = 1;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
- if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
+ if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
{
- $disabledproject=0;
- $disabledtask=0;
+ $disabledproject = 0;
+ $disabledtask = 0;
}
// If $restricteditformytask is on and I have no role on task, i disable edit
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
{
- $disabledtask=1;
+ $disabledtask = 1;
}
// Form to add new time
@@ -1392,7 +1392,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$obj = &$lines[$i]; // To display extrafields
// If we want all or we have a role on task, we show it
- if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
+ if (empty($mine) || !empty($tasksrole[$lines[$i]->id]))
{
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
@@ -1530,7 +1530,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
*/
// Project
- if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
+ if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
print '';
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
@@ -1538,7 +1538,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
}
// Thirdparty
- if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
+ if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
print ' | ';
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
@@ -1596,25 +1596,25 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
// Time spent by user
print ' | ';
- $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id);
+ $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
else print '--:--';
print " | \n";
- $disabledproject=1;$disabledtask=1;
+ $disabledproject = 1; $disabledtask = 1;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
- if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
+ if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
{
- $disabledproject=0;
- $disabledtask=0;
+ $disabledproject = 0;
+ $disabledtask = 0;
}
// If $restricteditformytask is on and I have no role on task, i disable edit
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
{
- $disabledtask=1;
+ $disabledtask = 1;
}
//var_dump($projectstatic->weekWorkLoadPerTask);
@@ -1686,9 +1686,9 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
//var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
//var_dump($ret);
- foreach($ret as $key => $val)
+ foreach ($ret as $key => $val)
{
- $totalforeachday[$key]+=$val;
+ $totalforeachday[$key] += $val;
}
//var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
//var_dump($totalforeachday);
@@ -1717,8 +1717,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
{
//print 'Search in line with parent id = '.$parent.' ';
- $numlines=count($lines);
- for ($i = 0 ; $i < $numlines ; $i++)
+ $numlines = count($lines);
+ for ($i = 0; $i < $numlines; $i++)
{
// Process line $lines[$i]
if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent)
@@ -1811,40 +1811,40 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
{
$project_year_filter = date("Y");
}
- $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")";
- $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")";
+ $sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")";
+ $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")";
}
}
// Get id of project we must show tasks
- $arrayidofprojects=array();
+ $arrayidofprojects = array();
$sql1 = "SELECT p.rowid as projectid";
- $sql1.= $sql;
+ $sql1 .= $sql;
$resql = $db->query($sql1);
if ($resql)
{
- $i=0;
+ $i = 0;
$num = $db->num_rows($resql);
while ($i < $num)
{
$objp = $db->fetch_object($resql);
- $arrayidofprojects[$objp->projectid]=$objp->projectid;
+ $arrayidofprojects[$objp->projectid] = $objp->projectid;
$i++;
}
}
else dol_print_error($db);
- if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1;
+ if (empty($arrayidofprojects)) $arrayidofprojects[0] = -1;
// Get list of project with calculation on tasks
$sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
- $sql2.= " p.dateo, p.datee,";
- $sql2.= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
- $sql2.= " FROM ".MAIN_DB_PREFIX."projet as p";
- $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
- $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
- $sql2.= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")";
- $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee";
- $sql2.= " ORDER BY p.title, p.ref";
+ $sql2 .= " p.dateo, p.datee,";
+ $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
+ $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
+ $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
+ $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
+ $sql2 .= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")";
+ $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee";
+ $sql2 .= " ORDER BY p.title, p.ref";
$resql = $db->query($sql2);
if ($resql)
@@ -1859,7 +1859,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print '';
print_liste_field_titre($title.''.$num.'', $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("OpportunityStatus", "", "", "", "", 'align="right"', $sortfield, $sortorder);
@@ -1867,14 +1867,14 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder);
- if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder);
- if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder);
+ if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder);
+ if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder);
}
print_liste_field_titre("Status", "", "", "", "", 'align="right"', $sortfield, $sortorder);
print " \n";
- $total_plannedworkload=0;
- $total_declaredprogressworkload=0;
+ $total_plannedworkload = 0;
+ $total_declaredprogressworkload = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
@@ -1887,7 +1887,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$userAccess = $projectstatic->restrictedProjectArea($user);
if ($userAccess >= 0)
{
- $projectstatic->ref=$objp->ref;
+ $projectstatic->ref = $objp->ref;
$projectstatic->statut = $objp->status;
$projectstatic->title = $objp->title;
$projectstatic->datee = $db->jdate($objp->datee);
@@ -1897,18 +1897,18 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print '';
print '';
print $projectstatic->getNomUrl(1);
- if (! in_array('projectlabel', $hiddenfields)) print ' '.dol_trunc($objp->title, 24);
+ if (!in_array('projectlabel', $hiddenfields)) print ' '.dol_trunc($objp->title, 24);
print ' | ';
print '';
if ($objp->fk_soc > 0)
{
- $thirdpartystatic->id=$objp->fk_soc;
- $thirdpartystatic->ref=$objp->socname;
- $thirdpartystatic->name=$objp->socname;
+ $thirdpartystatic->id = $objp->fk_soc;
+ $thirdpartystatic->ref = $objp->socname;
+ $thirdpartystatic->name = $objp->socname;
print $thirdpartystatic->getNomUrl(1);
}
print ' | ';
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '';
if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
@@ -1922,19 +1922,19 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
{
print ' | '.$objp->nb.' | ';
- $plannedworkload=$objp->planned_workload;
- $total_plannedworkload+=$plannedworkload;
- if (! in_array('plannedworkload', $hiddenfields))
+ $plannedworkload = $objp->planned_workload;
+ $total_plannedworkload += $plannedworkload;
+ if (!in_array('plannedworkload', $hiddenfields))
{
- print ''.($plannedworkload?convertSecondToTime($plannedworkload):'').' | ';
+ print ''.($plannedworkload ?convertSecondToTime($plannedworkload) : '').' | ';
}
- if (! in_array('declaredprogress', $hiddenfields))
+ if (!in_array('declaredprogress', $hiddenfields))
{
- $declaredprogressworkload=$objp->declared_progess_workload;
- $total_declaredprogressworkload+=$declaredprogressworkload;
+ $declaredprogressworkload = $objp->declared_progess_workload;
+ $total_declaredprogressworkload += $declaredprogressworkload;
print '';
//print $objp->planned_workload.'-'.$objp->declared_progess_workload." ";
- print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload, 0).'%':'');
+ print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : '');
print ' | ';
}
}
@@ -1952,7 +1952,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print ' ';
print '| '.$langs->trans("Total")." | ";
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print ''.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).' | ';
print ''.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).' | ';
@@ -1960,8 +1960,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print ''.$total_task.' | ';
- if (! in_array('plannedworkload', $hiddenfields)) print ''.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').' | ';
- if (! in_array('declaredprogress', $hiddenfields)) print ''.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload, 0).'%':'').' | ';
+ if (!in_array('plannedworkload', $hiddenfields)) print ''.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').' | ';
+ if (!in_array('declaredprogress', $hiddenfields)) print ''.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').' | ';
}
print ' | ';
print ' ';
diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php
index c9527c54840..837f505c132 100644
--- a/htdocs/core/lib/signature.lib.php
+++ b/htdocs/core/lib/signature.lib.php
@@ -29,14 +29,14 @@ function showOnlineSignatureUrl($type, $ref)
global $conf, $langs;
// Load translation files required by the page
- $langs->loadLangs(array("payment","paybox"));
+ $langs->loadLangs(array("payment", "paybox"));
- $servicename='Online';
+ $servicename = 'Online';
$out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlineSignature", $servicename).' ';
$url = getOnlineSignatureUrl(0, $type, $ref);
- $out.= '';
- $out.= ajax_autoselect("onlinesignatureurl", 0);
+ $out .= '';
+ $out .= ajax_autoselect("onlinesignatureurl", 0);
return $out;
}
@@ -53,29 +53,29 @@ function getOnlineSignatureUrl($mode, $type, $ref = '')
{
global $conf, $db, $langs;
- $ref=str_replace(' ', '', $ref);
- $out='';
+ $ref = str_replace(' ', '', $ref);
+ $out = '';
if ($type == 'proposal')
{
- $out=DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode?'':'');
- if ($mode == 1) $out.='proposal_ref';
- if ($mode == 0) $out.=urlencode($ref);
- $out.=($mode?'':'');
- if ($mode == 1) $out.='&hashp=hash_of_file';
+ $out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '' : '');
+ if ($mode == 1) $out .= 'proposal_ref';
+ if ($mode == 0) $out .= urlencode($ref);
+ $out .= ($mode ? '' : '');
+ if ($mode == 1) $out .= '&hashp=hash_of_file';
else
{
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
- $propaltmp=new Propal($db);
+ $propaltmp = new Propal($db);
$res = $propaltmp->fetch(0, $ref);
if ($res <= 0) return 'FailedToGetProposal';
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
- $ecmfile=new EcmFiles($db);
+ $ecmfile = new EcmFiles($db);
$ecmfile->fetch(0, '', $propaltmp->last_main_doc);
- $hashp=$ecmfile->share;
+ $hashp = $ecmfile->share;
if (empty($hashp))
{
$out = $langs->trans("FeatureOnlineSignDisabled");
@@ -83,13 +83,13 @@ function getOnlineSignatureUrl($mode, $type, $ref = '')
}
else
{
- $out.='&hashp='.$hashp;
+ $out .= '&hashp='.$hashp;
}
}
}
// For multicompany
- if (! empty($out)) $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
+ if (!empty($out)) $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
return $out;
}
diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index 609dbd9926d..fd2d56c946b 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -77,7 +77,7 @@ function ticket_prepare_head($object)
$h = 0;
$head = array();
- $head[$h][0] = DOL_URL_ROOT.'/ticket/card.php?action=view&track_id=' . $object->track_id;
+ $head[$h][0] = DOL_URL_ROOT.'/ticket/card.php?action=view&track_id='.$object->track_id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'tabTicket';
$h++;
@@ -110,25 +110,25 @@ function ticket_prepare_head($object)
// History
$ticketViewType = "messaging";
- if(empty($_SESSION['ticket-view-type'])){
+ if (empty($_SESSION['ticket-view-type'])) {
$_SESSION['ticket-view-type'] = $ticketViewType;
}
- else{
+ else {
$ticketViewType = $_SESSION['ticket-view-type'];
}
- if($ticketViewType == "messaging"){
- $head[$h][0] = DOL_URL_ROOT.'/ticket/messaging.php?track_id=' . $object->track_id;
+ if ($ticketViewType == "messaging") {
+ $head[$h][0] = DOL_URL_ROOT.'/ticket/messaging.php?track_id='.$object->track_id;
}
- else{
+ else {
// $ticketViewType == "list"
- $head[$h][0] = DOL_URL_ROOT.'/ticket/agenda.php?track_id=' . $object->track_id;
+ $head[$h][0] = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id;
}
$head[$h][1] = $langs->trans('Events');
- if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
+ if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
{
- $head[$h][1].= '/';
- $head[$h][1].= $langs->trans("Agenda");
+ $head[$h][1] .= '/';
+ $head[$h][1] .= $langs->trans("Agenda");
}
$head[$h][2] = 'tabTicketLogs';
$h++;
@@ -158,22 +158,22 @@ function showDirectPublicLink($object)
$url = dol_buildpath('/public/ticket/view.php', 3).'?track_id='.$object->track_id.'&email='.$email;
}
- $out='';
+ $out = '';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
- $out.= ''.$langs->trans("PublicInterfaceNotEnabled").'';
+ $out .= ''.$langs->trans("PublicInterfaceNotEnabled").'';
}
else
{
- $out.= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").': ';
+ $out .= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").': ';
if ($url)
{
- $out.= '';
- $out.= ajax_autoselect("directpubliclink", 0);
+ $out .= '';
+ $out .= ajax_autoselect("directpubliclink", 0);
}
else
{
- $out.= ''.$langs->trans("TicketNotCreatedFromPublicInterface").'';
+ $out .= ''.$langs->trans("TicketNotCreatedFromPublicInterface").'';
}
}
@@ -272,12 +272,12 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
dol_include_once('/comm/action/class/actioncomm.class.php');
// Check parameters
- if (! is_object($filterobj) && ! is_object($objcon)) dol_print_error('', 'BadParameter');
+ if (!is_object($filterobj) && !is_object($objcon)) dol_print_error('', 'BadParameter');
- $out='';
- $histo=array();
- $numaction = 0 ;
- $now=dol_now('tzuser');
+ $out = '';
+ $histo = array();
+ $numaction = 0;
+ $now = dol_now('tzuser');
// Open DSI -- Fix order by -- Begin
$sortfield_list = explode(',', $sortfield);
@@ -288,7 +288,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
}
$sortfield_new = implode(',', $sortfield_new_list);
- if (! empty($conf->agenda->enabled))
+ if (!empty($conf->agenda->enabled))
{
// Recherche histo sur actioncomm
if (is_object($objcon) && $objcon->id > 0) {
@@ -298,142 +298,142 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
{
$sql = "SELECT a.id, a.label as label,";
}
- $sql.= " a.datep as dp,";
- $sql.= " a.note as message,";
- $sql.= " a.datep2 as dp2,";
- $sql.= " a.percent as percent, 'action' as type,";
- $sql.= " a.fk_element, a.elementtype,";
- $sql.= " a.fk_contact,";
- $sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
- $sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
- if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
- elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql.= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql.= ", o.ref";
- $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
+ $sql .= " a.datep as dp,";
+ $sql .= " a.note as message,";
+ $sql .= " a.datep2 as dp2,";
+ $sql .= " a.percent as percent, 'action' as type,";
+ $sql .= " a.fk_element, a.elementtype,";
+ $sql .= " a.fk_contact,";
+ $sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
+ $sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
+ if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql .= ", sp.lastname, sp.firstname";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", m.lastname, m.firstname";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", o.ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", o.ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql .= ", o.ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql .= ", o.ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql .= ", o.ref";
+ $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
$force_filter_contact = false;
if (is_object($objcon) && $objcon->id > 0) {
$force_filter_contact = true;
- $sql.= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
- $sql.= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . $objcon->id;
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
+ $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".$objcon->id;
}
- if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
+ if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
- $sql.= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
- $sql.= " ON er.resource_type = 'dolresource'";
- $sql.= " AND er.element_id = a.id";
- $sql.= " AND er.resource_id = ".$filterobj->id;
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
+ $sql .= " ON er.resource_type = 'dolresource'";
+ $sql .= " AND er.element_id = a.id";
+ $sql .= " AND er.resource_id = ".$filterobj->id;
}
- elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
- elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o";
- elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql.= ", ".MAIN_DB_PREFIX."bom_bom as o";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql.= ", ".MAIN_DB_PREFIX."contrat as o";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", ".MAIN_DB_PREFIX."adherent as m";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", ".MAIN_DB_PREFIX."product as o";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql .= ", ".MAIN_DB_PREFIX."ticket as o";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql .= ", ".MAIN_DB_PREFIX."contrat as o";
- $sql.= " WHERE a.entity IN (".getEntity('agenda').")";
+ $sql .= " WHERE a.entity IN (".getEntity('agenda').")";
if ($force_filter_contact === false) {
- if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
- elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
+ if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql .= " AND a.fk_soc = ".$filterobj->id;
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql .= " AND a.fk_project = ".$filterobj->id;
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
{
- $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
- if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
+ if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
}
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
{
- $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
- if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
+ if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
}
elseif (is_object($filterobj) && get_class($filterobj) == 'Product')
{
- $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
- if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
+ if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
}
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket')
{
- $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
- if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
+ if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
}
elseif (is_object($filterobj) && get_class($filterobj) == 'BOM')
{
- $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
- if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
+ if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
}
elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat')
{
- $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
- if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
+ if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
}
}
// Condition on actioncode
- if (! empty($actioncode))
+ if (!empty($actioncode))
{
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
- if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
- elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
+ if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'";
+ elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'";
else
{
- if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
- elseif ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
+ if ($actioncode == 'AC_OTH') $sql .= " AND c.type != 'systemauto'";
+ elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " AND c.type = 'systemauto'";
}
}
else
{
- if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
- elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
- else $sql.= " AND c.code = '".$db->escape($actioncode)."'";
+ if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'";
+ elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'";
+ else $sql .= " AND c.code = '".$db->escape($actioncode)."'";
}
}
- if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
- elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
- if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
+ if ($donetodo == 'todo') $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
+ elseif ($donetodo == 'done') $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
+ if (is_array($filters) && $filters['search_agenda_label']) $sql .= natural_search('a.label', $filters['search_agenda_label']);
}
// Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
- if (! empty($conf->mailing->enabled) && ! empty($objcon->email)
+ if (!empty($conf->mailing->enabled) && !empty($objcon->email)
&& (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING'))
{
$langs->load("mails");
$sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type";
- $sql2.= ", '' as fk_element, '' as elementtype, '' as contact_id";
- $sql2.= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
- $sql2.= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action
- if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2.= ", '' as lastname, '' as firstname";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2.= ", '' as lastname, '' as firstname";
- elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2.= ", '' as ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql2.= ", '' as ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2.= ", '' as ref";
- $sql2.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
- $sql2.= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
- $sql2.= " AND mc.statut = 1";
- $sql2.= " AND u.rowid = m.fk_user_valid";
- $sql2.= " AND mc.fk_mailing=m.rowid";
+ $sql2 .= ", '' as fk_element, '' as elementtype, '' as contact_id";
+ $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
+ $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action
+ if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref";
+ $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
+ $sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
+ $sql2 .= " AND mc.statut = 1";
+ $sql2 .= " AND u.rowid = m.fk_user_valid";
+ $sql2 .= " AND mc.fk_mailing=m.rowid";
}
if (!empty($sql) && !empty($sql2)) {
- $sql = $sql . " UNION " . $sql2;
+ $sql = $sql." UNION ".$sql2;
} elseif (empty($sql) && !empty($sql2)) {
$sql = $sql2;
}
//TODO Add limit in nb of results
- $sql.= $db->order($sortfield_new, $sortorder);
+ $sql .= $db->order($sortfield_new, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
- $i = 0 ;
+ $i = 0;
$num = $db->num_rows($resql);
while ($i < $num)
@@ -442,19 +442,19 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
if ($obj->type == 'action') {
$contactaction = new ActionComm($db);
- $contactaction->id=$obj->id;
+ $contactaction->id = $obj->id;
$result = $contactaction->fetchResources();
- if ($result<0) {
+ if ($result < 0) {
dol_print_error($db);
setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors');
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
- $tododone='';
- if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone='todo';
+ $tododone = '';
+ if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone = 'todo';
- $histo[$numaction]=array(
+ $histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>$tododone,
'id'=>$obj->id,
@@ -479,11 +479,11 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
// Type of event
'acode'=>$obj->acode,
'alabel'=>$obj->alabel,
- 'libelle'=>$obj->alabel, // deprecated
+ 'libelle'=>$obj->alabel, // deprecated
'apicto'=>$obj->apicto
);
} else {
- $histo[$numaction]=array(
+ $histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>'done',
'id'=>$obj->id,
@@ -511,85 +511,85 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
dol_print_error($db);
}
- if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email)))
+ if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email)))
{
- $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
+ $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
- $formactions=new FormActions($db);
+ $formactions = new FormActions($db);
- $actionstatic=new ActionComm($db);
- $userstatic=new User($db);
+ $actionstatic = new ActionComm($db);
+ $userstatic = new User($db);
$contactstatic = new Contact($db);
$userGetNomUrlCache = array();
- $out.='';
- $out.=' ';
+ $out .= '';
+ $out .= ' ';
if ($objcon && get_class($objcon) == 'Contact' &&
(is_null($filterobj) || get_class($filterobj) == 'Societe'))
{
- $out.='';
+ $out .= '';
}
else
{
- $out.='';
+ $out .= '';
}
- if ($filterobj && get_class($filterobj) == 'Societe') $out.='';
+ if ($filterobj && get_class($filterobj) == 'Societe') $out .= '';
- $out.="\n";
+ $out .= "\n";
- $out.='';
- $out.=' ';
+ $out .= '';
+ $out .= ' ';
- $out.='';
+ $out .= ' ';
//$out.='| ';
$out .= getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', '', $param, '', $sortfield, $sortorder, '')."\n";
//$out.=' | ';
- $out.=''.$langs->trans("Search").' : | ';
+ $out .= ''.$langs->trans("Search").' : | ';
if ($donetodo)
{
- $out.=' | ';
+ $out .= ' | ';
}
- $out.=''.$langs->trans("Type").' ';
- $out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1);
- $out.=' | ';
- $out.='';
- $out.=$langs->trans("Label").' ';
- $out.='';
- $out.=' | ';
+ $out .= ''.$langs->trans("Type").' ';
+ $out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, 0, 1);
+ $out .= ' | ';
+ $out .= '';
+ $out .= $langs->trans("Label").' ';
+ $out .= '';
+ $out .= ' | ';
- $out.='';
- $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
- $out.=$searchpicto;
- $out.=' | ';
- $out.=' ';
+ $out .= '';
+ $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
+ $out .= $searchpicto;
+ $out .= ' | ';
+ $out .= '';
- $out.=' ';
+ $out .= ' ';
- $out.='';
- $out.=' ';
+ $out .= '';
+ $out .= ' ';
- $out.="\n";
+ $out .= "\n";
- $out.='';
+ $out .= '';
if ($donetodo)
{
- $tmp='';
- if (get_class($filterobj) == 'Societe') $tmp.='';
- $tmp.=($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
- $tmp.=($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '');
- $tmp.=($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : '');
+ $tmp = '';
+ if (get_class($filterobj) == 'Societe') $tmp .= '';
+ $tmp .= ($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
+ $tmp .= ($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '');
+ $tmp .= ($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : '');
//$out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort");
- if (get_class($filterobj) == 'Societe') $tmp.='';
- $out.=getTitleFieldOfList($tmp);
+ if (get_class($filterobj) == 'Societe') $tmp .= '';
+ $out .= getTitleFieldOfList($tmp);
}
@@ -601,69 +601,69 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
foreach ($histo as $key=>$value)
{
- $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
+ $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
- $actionstatic->type_picto=$histo[$key]['apicto'];
- $actionstatic->type_code=$histo[$key]['acode'];
+ $actionstatic->type_picto = $histo[$key]['apicto'];
+ $actionstatic->type_code = $histo[$key]['acode'];
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$histo[$key]['id'];
- $tmpa=dol_getdate($histo[$key]['datestart'], false);
- if($actualCycleDate !== $tmpa['year'].'-'.$tmpa['yday']){
+ $tmpa = dol_getdate($histo[$key]['datestart'], false);
+ if ($actualCycleDate !== $tmpa['year'].'-'.$tmpa['yday']) {
$actualCycleDate = $tmpa['year'].'-'.$tmpa['yday'];
- $out.='';
- $out.='- ';
- $out.='';
- $out.= dol_print_date($histo[$key]['datestart'], 'daytext', 'tzserver', $langs);
- $out.='';
- $out.='
';
- $out.='';
+ $out .= '';
+ $out .= '- ';
+ $out .= '';
+ $out .= dol_print_date($histo[$key]['datestart'], 'daytext', 'tzserver', $langs);
+ $out .= '';
+ $out .= '
';
+ $out .= '';
}
- $out.=''."\n";
- $out.='- ';
+ $out .= ''."\n";
+ $out .= '
- ';
- $out.=''."\n";
+ $out .= ''."\n";
$iconClass = 'fa fa-comments';
$img_picto = '';
$colorClass = '';
$pictoTitle = '';
- if ($histo[$key]['percent']==-1) {
+ if ($histo[$key]['percent'] == -1) {
$colorClass = 'timeline-icon-not-applicble';
$pictoTitle = $langs->trans('StatusNotApplicable');
}
- elseif ($histo[$key]['percent']==0) {
+ elseif ($histo[$key]['percent'] == 0) {
$colorClass = 'timeline-icon-todo';
- $pictoTitle = $langs->trans('StatusActionToDo') . ' (0%)';
+ $pictoTitle = $langs->trans('StatusActionToDo').' (0%)';
}
- elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100){
+ elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100) {
$colorClass = 'timeline-icon-in-progress';
$pictoTitle = $langs->trans('StatusActionInProcess').' ('.$histo[$key]['percent'].'%)';
}
- elseif ($histo[$key]['percent'] >= 100){
+ elseif ($histo[$key]['percent'] >= 100) {
$colorClass = 'timeline-icon-done';
- $pictoTitle = $langs->trans('StatusActionDone').' (100%)';
+ $pictoTitle = $langs->trans('StatusActionDone').' (100%)';
}
- if($actionstatic->code == 'AC_TICKET_CREATE'){
+ if ($actionstatic->code == 'AC_TICKET_CREATE') {
$iconClass = 'fa fa-ticket';
}
- elseif($actionstatic->code == 'AC_TICKET_MODIFY'){
+ elseif ($actionstatic->code == 'AC_TICKET_MODIFY') {
$iconClass = 'fa fa-pencil';
}
- elseif($actionstatic->code == 'TICKET_MSG'){
+ elseif ($actionstatic->code == 'TICKET_MSG') {
$iconClass = 'fa fa-comments';
}
- elseif($actionstatic->code == 'TICKET_MSG_PRIVATE'){
+ elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
$iconClass = 'fa fa-mask';
}
elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
- if ($actionstatic->type_picto) $img_picto = img_picto('', $actionstatic->type_picto);
+ if ($actionstatic->type_picto) $img_picto = img_picto('', $actionstatic->type_picto);
else {
if ($actionstatic->type_code == 'AC_RDV') $iconClass = 'fa fa-handshake';
elseif ($actionstatic->type_code == 'AC_TEL') $iconClass = 'fa fa-phone';
@@ -671,24 +671,24 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
elseif ($actionstatic->type_code == 'AC_EMAIL') $iconClass = 'fa fa-envelope';
elseif ($actionstatic->type_code == 'AC_INT') $iconClass = 'fa fa-shipping-fast';
elseif ($actionstatic->type_code == 'AC_OTH_AUTO') $iconClass = 'fa fa-robot';
- elseif (! preg_match('/_AUTO/', $actionstatic->type_code)) $iconClass = 'fa fa-robot';
+ elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) $iconClass = 'fa fa-robot';
}
}
- $out.=''.$img_picto.''."\n";
+ $out .= ''.$img_picto.''."\n";
- $out.='
'."\n";
+ $out .= ' '."\n";
- $out.=' trans('PriceUHTCurrency'); ?> |
-
+
trans('PriceUTTC'); ?> |
trans('Qty'); ?> |
global->PRODUCT_USE_UNITS)
+ if ($conf->global->PRODUCT_USE_UNITS)
{
print ' ';
print '';
@@ -466,20 +466,20 @@ $coldisplay+=$colspan;
showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
+ print $objectline->showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1);
}
-if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
+if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
{
?>
>
- global->MAIN_VIEW_LINE_NUMBER)) { print ' | '; } ?>
-
+ global->MAIN_VIEW_LINE_NUMBER)) { print ' | | '; } ?>
+
element) && $object->element == 'contrat')
+ $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
+ $date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
+ if (!empty($object->element) && $object->element == 'contrat')
{
print $langs->trans("DateStartPlanned").' ';
print $form->selectDate($date_start, "date_start", $usehm, $usehm, 1, "addproduct");
@@ -489,9 +489,9 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da
else
{
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
- print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0);
+ print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0);
echo ' '.$langs->trans('to').' ';
- print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1, 1, "addproduct", 1, 0);
+ print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0);
};
print '';
// Loan card
- $linkback = '' . $langs->trans("BackToList") . '';
+ $linkback = ''.$langs->trans("BackToList").'';
- $morehtmlref='';
+ $morehtmlref = ' ';
// Ref loan
- $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
+ $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
+ $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
// Project
- if (! empty($conf->projet->enabled))
+ if (!empty($conf->projet->enabled))
{
$langs->loadLangs(array("projects"));
- $morehtmlref.=' '.$langs->trans('Project') . ' ';
+ $morehtmlref .= ' '.$langs->trans('Project').' ';
if ($user->rights->loan->write)
{
if ($action != 'classify')
- $morehtmlref.=' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ $morehtmlref .= ' '.img_edit($langs->transnoentitiesnoconv('SetProject')).' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.=' ';
- $morehtmlref.='';
- $morehtmlref.='';
- $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
- $morehtmlref.='';
- $morehtmlref.='';
+ $morehtmlref .= ' ';
+ $morehtmlref .= '';
+ $morehtmlref .= '';
+ $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
+ $morehtmlref .= '';
+ $morehtmlref .= '';
} else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
- if (! empty($object->fk_project)) {
+ if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref.=' ';
- $morehtmlref.=$proj->ref;
- $morehtmlref.='';
+ $morehtmlref .= ' ';
+ $morehtmlref .= $proj->ref;
+ $morehtmlref .= '';
} else {
- $morehtmlref.='';
+ $morehtmlref .= '';
}
}
}
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
- $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@@ -493,7 +493,7 @@ if ($id > 0)
if ($action == 'edit')
{
print ' | | '.$langs->trans("LoanCapital").' | ';
- print ' | ';
+ print ' | ';
print '';
}
else
@@ -505,7 +505,7 @@ if ($id > 0)
if ($action == 'edit')
{
print ' | '.$langs->trans("Insurance").' | ';
- print ' | ';
+ print ' ';
print '';
}
else
@@ -544,7 +544,7 @@ if ($id > 0)
print ' ';
if ($action == 'edit')
{
- print '';
+ print '';
}
else
{
@@ -557,11 +557,11 @@ if ($id > 0)
print ' | ';
if ($action == 'edit')
{
- print '%';
+ print '%';
}
else
{
- print $object->rate . '%';
+ print $object->rate.'%';
}
print ' | ';
@@ -573,7 +573,7 @@ if ($id > 0)
print $langs->trans("LoanAccountancyCapitalCode");
print ' ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 1, 1);
}
@@ -589,7 +589,7 @@ if ($id > 0)
print $langs->trans("LoanAccountancyCapitalCode");
print ' | ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_capital, 1);
@@ -611,7 +611,7 @@ if ($id > 0)
print $langs->trans("LoanAccountancyInsuranceCode");
print ' | ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 1, 1);
}
@@ -627,7 +627,7 @@ if ($id > 0)
print $langs->trans("LoanAccountancyCapitalCode");
print ' | ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_insurance, 1);
@@ -649,7 +649,7 @@ if ($id > 0)
print $langs->trans("LoanAccountancyInterestCode");
print ' | ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 1, 1);
}
@@ -665,7 +665,7 @@ if ($id > 0)
print $langs->trans("LoanAccountancyInterestCode");
print ' | ';
- if (! empty($conf->accounting->enabled))
+ if (!empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_interest, 1);
@@ -689,15 +689,15 @@ if ($id > 0)
* Payments
*/
$sql = "SELECT p.rowid, p.num_payment, datep as dp,";
- $sql.= " p.amount_capital, p.amount_insurance, p.amount_interest,";
- $sql.= " c.libelle as paiement_type";
- $sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as p";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id";
- $sql.= ", ".MAIN_DB_PREFIX."loan as l";
- $sql.= " WHERE p.fk_loan = ".$id;
- $sql.= " AND p.fk_loan = l.rowid";
- $sql.= " AND l.entity IN ( ".getEntity('loan').")";
- $sql.= " ORDER BY dp DESC";
+ $sql .= " p.amount_capital, p.amount_insurance, p.amount_interest,";
+ $sql .= " c.libelle as paiement_type";
+ $sql .= " FROM ".MAIN_DB_PREFIX."payment_loan as p";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id";
+ $sql .= ", ".MAIN_DB_PREFIX."loan as l";
+ $sql .= " WHERE p.fk_loan = ".$id;
+ $sql .= " AND p.fk_loan = l.rowid";
+ $sql .= " AND l.entity IN ( ".getEntity('loan').")";
+ $sql .= " ORDER BY dp DESC";
//print $sql;
$resql = $db->query($sql);
@@ -709,7 +709,7 @@ if ($id > 0)
$total_interest = 0;
$total_capital = 0;
- print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
+ print ' '; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print ' ';
print '';
print '| '.$langs->trans("RefPayment").' | ';
@@ -746,7 +746,7 @@ if ($id > 0)
$staytopay = $object->capital - $totalpaid;
print ' | '.$langs->trans("RemainderToPay").' : | ';
- print '';
+ print ' | ';
print price($staytopay, 0, $langs, 0, 0, -1, $conf->currency);
print ' | ';
}
@@ -804,7 +804,7 @@ if ($id > 0)
}
// Classify 'paid'
- if ($object->paid == 0 && round($staytopay) <=0 && $user->rights->loan->write)
+ if ($object->paid == 0 && round($staytopay) <= 0 && $user->rights->loan->write)
{
print '';
}
diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php
index a4bed07949e..a4328bec863 100644
--- a/htdocs/loan/document.php
+++ b/htdocs/loan/document.php
@@ -53,21 +53,21 @@ if (empty($page) || $page == -1) {
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="ASC";
-if (! $sortfield) $sortfield="name";
+if (!$sortorder) $sortorder = "ASC";
+if (!$sortfield) $sortfield = "name";
$object = new Loan($db);
if ($id > 0) $object->fetch($id);
$upload_dir = $conf->loan->dir_output.'/'.dol_sanitizeFileName($object->ref);
-$modulepart='loan';
+$modulepart = 'loan';
/*
* Actions
*/
-include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
+include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
@@ -76,45 +76,45 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
$form = new Form($db);
-$title = $langs->trans("Loan") . ' - ' . $langs->trans("Documents");
+$title = $langs->trans("Loan").' - '.$langs->trans("Documents");
$help_url = 'EN:Module_Loan|FR:Module_Emprunt';
llxHeader("", $title, $help_url);
if ($object->id)
{
- $totalpaid=$object->getSumPayment();
+ $totalpaid = $object->getSumPayment();
$head = loan_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("Loan"), -1, 'bill');
- $morehtmlref='';
+ $morehtmlref = ' ';
// Ref loan
- $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
+ $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
+ $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project
- if (! empty($conf->projet->enabled)) {
+ if (!empty($conf->projet->enabled)) {
$langs->load("projects");
- $morehtmlref .= ' ' . $langs->trans('Project') . ' : ';
+ $morehtmlref .= ' '.$langs->trans('Project').' : ';
if ($user->rights->loan->write) {
//if ($action != 'classify')
// $morehtmlref .= ' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref .= ' ';
+ $morehtmlref .= '';
$morehtmlref .= '';
- $morehtmlref .= '';
+ $morehtmlref .= '';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
- $morehtmlref .= '';
+ $morehtmlref .= '';
$morehtmlref .= '';
} else {
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
- if (! empty($object->fk_project)) {
+ if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= ' ';
+ $morehtmlref .= '';
$morehtmlref .= $proj->ref;
$morehtmlref .= '';
} else {
@@ -122,11 +122,11 @@ if ($object->id)
}
}
}
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
- $linkback = '' . $langs->trans("BackToList") . '';
+ $linkback = ''.$langs->trans("BackToList").'';
- $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@@ -135,11 +135,11 @@ if ($object->id)
// Build file list
- $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
- $totalsize=0;
- foreach($filearray as $key => $file)
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file)
{
- $totalsize+=$file['size'];
+ $totalsize += $file['size'];
}
@@ -155,8 +155,8 @@ if ($object->id)
$modulepart = 'loan';
$permission = $user->rights->loan->write;
$permtoedit = $user->rights->loan->write;
- $param = '&id=' . $object->id;
- include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
+ $param = '&id='.$object->id;
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php
index 618345518ed..1a26a8a12da 100644
--- a/htdocs/loan/info.php
+++ b/htdocs/loan/info.php
@@ -48,7 +48,7 @@ $result = restrictedArea($user, 'loan', $id, '', '');
$form = new Form($db);
-$title = $langs->trans("Loan") . ' - ' . $langs->trans("Info");
+$title = $langs->trans("Loan").' - '.$langs->trans("Info");
$help_url = 'EN:Module_Loan|FR:Module_Emprunt';
llxHeader("", $title, $help_url);
@@ -60,33 +60,33 @@ $head = loan_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Loan"), -1, 'bill');
-$morehtmlref='';
+$morehtmlref = ' ';
// Ref loan
-$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
-$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
+$morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
+$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project
-if (! empty($conf->projet->enabled)) {
+if (!empty($conf->projet->enabled)) {
$langs->load("projects");
- $morehtmlref .= ' ' . $langs->trans('Project') . ' : ';
+ $morehtmlref .= ' '.$langs->trans('Project').' : ';
if ($user->rights->loan->write) {
//if ($action != 'classify')
// $morehtmlref .= ' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref .= ' ';
+ $morehtmlref .= '';
$morehtmlref .= '';
- $morehtmlref .= '';
+ $morehtmlref .= '';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
- $morehtmlref .= '';
+ $morehtmlref .= '';
$morehtmlref .= '';
} else {
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
- if (! empty($object->fk_project)) {
+ if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= ' ';
+ $morehtmlref .= '';
$morehtmlref .= $proj->ref;
$morehtmlref .= '';
} else {
@@ -94,11 +94,11 @@ if (! empty($conf->projet->enabled)) {
}
}
}
-$morehtmlref.=' ';
+$morehtmlref .= ' ';
-$linkback = '' . $langs->trans("BackToList") . '';
+$linkback = ''.$langs->trans("BackToList").'';
-$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
diff --git a/htdocs/loan/note.php b/htdocs/loan/note.php
index 4ddd7bdccee..ebe0b9d876c 100644
--- a/htdocs/loan/note.php
+++ b/htdocs/loan/note.php
@@ -30,8 +30,8 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
-if (! empty($conf->projet->enabled)) {
- require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
+if (!empty($conf->projet->enabled)) {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
$action = GETPOST('action', 'aZ09');
@@ -46,7 +46,7 @@ $result = restrictedArea($user, 'loan', $id, '&loan');
$object = new Loan($db);
if ($id > 0) $object->fetch($id);
-$permissionnote=$user->rights->loan->write; // Used by the include of actions_setnotes.inc.php
+$permissionnote = $user->rights->loan->write; // Used by the include of actions_setnotes.inc.php
/*
@@ -62,7 +62,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
$form = new Form($db);
-$title = $langs->trans("Loan") . ' - ' . $langs->trans("Notes");
+$title = $langs->trans("Loan").' - '.$langs->trans("Notes");
$help_url = 'EN:Module_Loan|FR:Module_Emprunt';
llxHeader("", $title, $help_url);
@@ -71,39 +71,39 @@ if ($id > 0)
/*
* Affichage onglets
*/
- $totalpaid=$object->getSumPayment();
+ $totalpaid = $object->getSumPayment();
$head = loan_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Loan"), -1, 'bill');
- $morehtmlref='';
+ $morehtmlref = ' ';
// Ref loan
- $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
- $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
+ $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
+ $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project
- if (! empty($conf->projet->enabled)) {
+ if (!empty($conf->projet->enabled)) {
$langs->loadLangs(array("projects"));
- $morehtmlref .= ' ' . $langs->trans('Project') . ' : ';
+ $morehtmlref .= ' '.$langs->trans('Project').' : ';
if ($user->rights->loan->write) {
//if ($action != 'classify')
// $morehtmlref .= ' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
if ($action == 'classify') {
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref .= ' ';
+ $morehtmlref .= '';
$morehtmlref .= '';
- $morehtmlref .= '';
+ $morehtmlref .= '';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
- $morehtmlref .= '';
+ $morehtmlref .= '';
$morehtmlref .= '';
} else {
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
- if (! empty($object->fk_project)) {
+ if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= ' ';
+ $morehtmlref .= '';
$morehtmlref .= $proj->ref;
$morehtmlref .= '';
} else {
@@ -111,19 +111,19 @@ if ($id > 0)
}
}
}
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
- $linkback = '' . $langs->trans("BackToList") . '';
+ $linkback = ''.$langs->trans("BackToList").'';
- $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '';
print ' ';
- $cssclass='titlefield';
- $permission = $user->rights->loan->write; // Used by the include of notes.tpl.php
+ $cssclass = 'titlefield';
+ $permission = $user->rights->loan->write; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end();
diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php
index cdd8db1a0bd..302ecf5f1ff 100644
--- a/htdocs/opensurvey/card.php
+++ b/htdocs/opensurvey/card.php
@@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php";
if (!$user->rights->opensurvey->read) accessforbidden();
// Initialisation des variables
-$action=GETPOST('action', 'aZ09');
-$cancel=GETPOST('cancel', 'alpha');
+$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'alpha');
$numsondage = '';
@@ -44,16 +44,16 @@ if (GETPOST('id')) {
$numsondage = GETPOST('id', 'alpha');
}
-$object=new Opensurveysondage($db);
+$object = new Opensurveysondage($db);
-$result=$object->fetch(0, $numsondage);
+$result = $object->fetch(0, $numsondage);
if ($result <= 0)
{
dol_print_error($db, $object->error);
exit;
}
-$expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
+$expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
@@ -67,7 +67,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
- if ($cancel) $action='';
+ if ($cancel) $action = '';
// Delete
if ($action == 'delete_confirm')
@@ -75,7 +75,7 @@ if (empty($reshook))
// Security check
if (!$user->rights->opensurvey->write) accessforbidden();
- $result=$object->delete($user, '', $numsondage);
+ $result = $object->delete($user, '', $numsondage);
header('Location: '.dol_buildpath('/opensurvey/list.php', 1));
exit();
@@ -101,16 +101,16 @@ if (empty($reshook))
// Security check
if (!$user->rights->opensurvey->write) accessforbidden();
- $error=0;
+ $error = 0;
- if (! GETPOST('nouveautitre'))
+ if (!GETPOST('nouveautitre'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
$error++;
$action = 'edit';
}
- if (! $error)
+ if (!$error)
{
$object->titre = GETPOST('nouveautitre', 'nohtml');
$object->commentaires = GETPOST('nouveauxcommentaires', 'nohtml');
@@ -121,11 +121,11 @@ if (empty($reshook))
$object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? true : false;
$object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false;
- $res=$object->update($user);
+ $res = $object->update($user);
if ($res < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
- $action='edit';
+ $action = 'edit';
}
}
}
@@ -133,27 +133,27 @@ if (empty($reshook))
// Add comment
if (GETPOST('ajoutcomment'))
{
- $error=0;
+ $error = 0;
- if (! GETPOST('comment'))
+ if (!GETPOST('comment'))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors');
}
- if (! GETPOST('commentuser'))
+ if (!GETPOST('commentuser'))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors');
}
- if (! $error)
+ if (!$error)
{
$comment = GETPOST("comment");
$comment_user = GETPOST('commentuser');
$resql = $object->addComment($comment, $comment_user);
- if (! $resql)
+ if (!$resql)
{
setEventMessages($langs->trans('ErrorInsertingComment'), null, 'errors');
}
@@ -161,7 +161,7 @@ if (empty($reshook))
}
// Delete comment
- $idcomment=GETPOST('deletecomment', 'int');
+ $idcomment = GETPOST('deletecomment', 'int');
if ($idcomment)
{
// Security check
@@ -181,7 +181,7 @@ if (empty($reshook))
* View
*/
-$form=new Form($db);
+$form = new Form($db);
if ($object->fk_user_creat)
{
@@ -191,21 +191,21 @@ if ($object->fk_user_creat)
$title = $object->titre." - ".$langs->trans('Card');
$helpurl = '';
-$arrayofjs=array();
-$arrayofcss=array('/opensurvey/css/style.css');
+$arrayofjs = array();
+$arrayofcss = array('/opensurvey/css/style.css');
llxHeader('', $title, $helpurl, 0, 0, 0, $arrayofjs, $arrayofcss);
// Define format of choices
-$toutsujet=explode(",", $object->sujet);
-$listofanswers=array();
+$toutsujet = explode(",", $object->sujet);
+$listofanswers = array();
foreach ($toutsujet as $value)
{
- $tmp=explode('@', $value);
- $listofanswers[]=array('label'=>$tmp[0],'format'=>($tmp[1]?$tmp[1]:'checkbox'));
+ $tmp = explode('@', $value);
+ $listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox'));
}
-$toutsujet=str_replace("@", " ", $toutsujet);
-$toutsujet=str_replace("°", "'", $toutsujet);
+$toutsujet = str_replace("@", " ", $toutsujet);
+$toutsujet = str_replace("°", "'", $toutsujet);
print ' '."\n";
print '';
@@ -228,15 +228,15 @@ print '';
print '';
// Type
-$type=($object->format=="A")?'classic':'date';
+$type = ($object->format == "A") ? 'classic' : 'date';
print '| '.$langs->trans("Type").' | ';
-print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'), 1), 'width="16"', 1);
-print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate").' | ';
+print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1);
+print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'';
// Title
print '| ';
-$adresseadmin=$object->mail_admin;
-print $langs->trans("Title") .' | ';
+$adresseadmin = $object->mail_admin;
+print $langs->trans("Title").' | ';
if ($action == 'edit')
{
print '';
@@ -245,22 +245,22 @@ else print dol_htmlentities($object->titre);
print ' | ';
// Description
-print '| '.$langs->trans("Description") .' | ';
+print ' | | '.$langs->trans("Description").' | ';
if ($action == 'edit')
{
- $doleditor=new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires), '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%');
+ $doleditor = new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires), '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%');
$doleditor->Create(0, '');
}
else
{
- print (dol_textishtml($object->commentaires)?$object->commentaires:dol_nl2br($object->commentaires, 1, true));
+ print (dol_textishtml($object->commentaires) ? $object->commentaires : dol_nl2br($object->commentaires, 1, true));
}
print ' | ';
// EMail
//If linked user, then emails are going to be sent to users' email
if (!$object->fk_user_creat) {
- print '| '.$langs->trans("EMail") .' | ';
+ print ' | | '.$langs->trans("EMail").' | ';
if ($action == 'edit')
{
print '';
@@ -273,7 +273,7 @@ if (!$object->fk_user_creat) {
print ' | | '.$langs->trans('ToReceiveEMailForEachVote').' | ';
if ($action == 'edit')
{
- print 'mailsonde?'checked="checked"':'').'">';
+ print 'mailsonde ? 'checked="checked"' : '').'">';
}
else {
print yn($object->mailsonde);
@@ -291,7 +291,7 @@ print ' | ';
print '| '.$langs->trans('CanComment').' | ';
if ($action == 'edit')
{
- print 'allow_comments?'checked="checked"':'').'">';
+ print 'allow_comments ? 'checked="checked"' : '').'">';
}
else print yn($object->allow_comments);
print ' | ';
@@ -300,14 +300,14 @@ print '';
print '| '.$langs->trans('CanSeeOthersVote').' | ';
if ($action == 'edit')
{
- print 'allow_spy?'checked="checked"':'').'">';
+ print 'allow_spy ? 'checked="checked"' : '').'">';
}
else print yn($object->allow_spy);
print ' | ';
// Expire date
print '| '.$langs->trans('ExpireDate').' | ';
-if ($action == 'edit') print $form->selectDate($expiredate?$expiredate:$object->date_fin, 'expire', 0, 0, 0, '', 1, 0);
+if ($action == 'edit') print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0);
else
{
print dol_print_date($object->date_fin, 'day');
@@ -317,7 +317,7 @@ print ' | ';
// Author
print '| ';
-print $langs->trans("Author") .' | ';
+print $langs->trans("Author").' | ';
if ($object->fk_user_creat) {
print $userstatic->getLoginUrl(1);
} else {
@@ -329,11 +329,11 @@ print ' | ';
print '| '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').' | ';
// Define $urlwithroot
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
-$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
-$url=$urlwithroot.'/public/opensurvey/studs.php?sondage='.$object->id_sondage;
+$url = $urlwithroot.'/public/opensurvey/studs.php?sondage='.$object->id_sondage;
print '';
if ($action != 'edit') print ajax_autoselect("opensurveyurl", $url);
@@ -365,17 +365,17 @@ print '';
if ($action != 'edit' && $user->rights->opensurvey->write) {
//Modify button
- print ' '.$langs->trans("Modify") . '';
+ print ' '.$langs->trans("Modify").'';
if ($object->status == Opensurveysondage::STATUS_VALIDATED)
{
//Close button
- print ' '.$langs->trans("Close") . '';
+ print ' '.$langs->trans("Close").'';
}
if ($object->status == Opensurveysondage::STATUS_CLOSED)
{
//Opened button
- print ' '.$langs->trans("ReOpen") . '';
+ print ' '.$langs->trans("ReOpen").'';
}
//Delete button
@@ -419,12 +419,12 @@ print ' ';
// Add comment
if ($object->allow_comments) {
- print $langs->trans("AddACommentForPoll") . ' ';
+ print $langs->trans("AddACommentForPoll").' ';
print ' '."\n";
- print $langs->trans("Name") .': '."\n";
+ print $langs->trans("Name").': '."\n";
print ' '."\n";
- if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide=="yes") {
- print " " . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")) . "";
+ if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide == "yes") {
+ print " ".$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."";
}
}
diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php
index 017779b74f7..7bb775e790e 100644
--- a/htdocs/opensurvey/results.php
+++ b/htdocs/opensurvey/results.php
@@ -35,14 +35,14 @@ if (!$user->rights->opensurvey->read) accessforbidden();
// Init vars
-$action=GETPOST('action', 'aZ09');
-$numsondage= GETPOST("id");
+$action = GETPOST('action', 'aZ09');
+$numsondage = GETPOST("id");
-$object=new Opensurveysondage($db);
-$result=$object->fetch(0, $numsondage);
+$object = new Opensurveysondage($db);
+$result = $object->fetch(0, $numsondage);
if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage);
-$nblines=$object->fetch_lines();
+$nblines = $object->fetch_lines();
/*
@@ -65,28 +65,28 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
$erreur_prenom = false;
$nouveauchoix = '';
- for ($i=0;$i<$nbcolonnes;$i++)
+ for ($i = 0; $i < $nbcolonnes; $i++)
{
if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1')
{
- $nouveauchoix.="1";
+ $nouveauchoix .= "1";
}
elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
{
- $nouveauchoix.="2";
+ $nouveauchoix .= "2";
}
else { // sinon c'est 0
- $nouveauchoix.="0";
+ $nouveauchoix .= "0";
}
}
- $nom=substr(GETPOST("nom", 'nohtml'), 0, 64);
+ $nom = substr(GETPOST("nom", 'nohtml'), 0, 64);
// Check if vote already exists
$sql = 'SELECT id_users, nom as name';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
- $sql.= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."'";
- $sql.= ' ORDER BY id_users';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
+ $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."'";
+ $sql .= ' ORDER BY id_users';
$resql = $db->query($sql);
$num_rows = $db->num_rows($resql);
if ($num_rows > 0)
@@ -97,9 +97,9 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
else
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)';
- $sql.= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')";
- $resql=$db->query($sql);
- if (! $resql) dol_print_error($db);
+ $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')";
+ $resql = $db->query($sql);
+ if (!$resql) dol_print_error($db);
}
}
}
@@ -108,19 +108,19 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
$testmodifier = false;
$testligneamodifier = false;
$ligneamodifier = -1;
-for ($i=0; $i<$nblines; $i++)
+for ($i = 0; $i < $nblines; $i++)
{
if (isset($_POST['modifierligne'.$i]))
{
- $ligneamodifier=$i;
- $testligneamodifier=true;
+ $ligneamodifier = $i;
+ $testligneamodifier = true;
}
//test pour voir si une ligne est a modifier
if (isset($_POST['validermodifier'.$i]))
{
- $modifier=$i;
- $testmodifier=true;
+ $modifier = $i;
+ $testmodifier = true;
}
}
if ($testmodifier)
@@ -134,24 +134,24 @@ if ($testmodifier)
//var_dump($_POST["choix$i"]);
if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1')
{
- $nouveauchoix.="1";
+ $nouveauchoix .= "1";
}
elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
{
- $nouveauchoix.="2";
+ $nouveauchoix .= "2";
}
else { // sinon c'est 0
- $nouveauchoix.="0";
+ $nouveauchoix .= "0";
}
}
- $idtomodify=$_POST["idtomodify".$modifier];
+ $idtomodify = $_POST["idtomodify".$modifier];
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs";
- $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'";
- $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'";
+ $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'";
+ $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'";
$resql = $db->query($sql);
- if (! $resql) dol_print_error($db);
+ if (!$resql) dol_print_error($db);
}
// Add column (not for date)
@@ -160,18 +160,18 @@ if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format =
// Security check
if (!$user->rights->opensurvey->write) accessforbidden();
- $nouveauxsujets=$object->sujet;
+ $nouveauxsujets = $object->sujet;
//on rajoute la valeur a la fin de tous les sujets deja entrés
- $nouveauxsujets.=',';
- $nouveauxsujets.=str_replace(array(",","@"), " ", $_POST["nouvellecolonne"]).(empty($_POST["typecolonne"])?'':'@'.$_POST["typecolonne"]);
+ $nouveauxsujets .= ',';
+ $nouveauxsujets .= str_replace(array(",", "@"), " ", $_POST["nouvellecolonne"]).(empty($_POST["typecolonne"]) ? '' : '@'.$_POST["typecolonne"]);
//mise a jour avec les nouveaux sujets dans la base
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
- $sql.= " SET sujet = '".$db->escape($nouveauxsujets)."'";
- $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'";
+ $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."'";
+ $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
$resql = $db->query($sql);
- if (! $resql) dol_print_error($db);
+ if (!$resql) dol_print_error($db);
else {
header('Location: results.php?id='.$object->id_sondage);
}
@@ -223,10 +223,10 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
//recherche de l'endroit de l'insertion de la nouvelle date dans les dates deja entrées dans le tableau
if ($nouvelledate < $datesbase[0]) {
$cleinsertion = 0;
- } elseif ($nouvelledate > $datesbase[$taillebase-1]) {
+ } elseif ($nouvelledate > $datesbase[$taillebase - 1]) {
$cleinsertion = count($datesbase);
} else {
- $nbdatesbase=count($datesbase);
+ $nbdatesbase = count($datesbase);
for ($i = 0; $i < $nbdatesbase; $i++)
{
$j = $i + 1;
@@ -239,10 +239,10 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
$cle = array_search($nouvelledate, $datesbase);
$dateinsertion = '';
- $nbofdates=count($datesbase);
+ $nbofdates = count($datesbase);
for ($i = 0; $i < $nbofdates; $i++) {
- $dateinsertion.=",";
- $dateinsertion.=$datesbase[$i];
+ $dateinsertion .= ",";
+ $dateinsertion .= $datesbase[$i];
}
$dateinsertion = substr("$dateinsertion", 1);
@@ -251,10 +251,10 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
if (isset($erreur_ajout_date) && empty($erreur_ajout_date))
{
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
- $sql.= " SET sujet = '".$db->escape($dateinsertion)."'";
- $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'";
+ $sql .= " SET sujet = '".$db->escape($dateinsertion)."'";
+ $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
$resql = $db->query($sql);
- if (! $resql) dol_print_error($db);
+ if (!$resql) dol_print_error($db);
else {
header('Location: results.php?id='.$object->id_sondage);
}
@@ -264,7 +264,7 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
}
else
{
- $erreur_ajout_date="yes";
+ $erreur_ajout_date = "yes";
}
}
@@ -276,24 +276,24 @@ for ($i = 0; $i < $nblines; $i++)
// Security check
if (!$user->rights->opensurvey->write) accessforbidden();
- $compteur=0;
+ $compteur = 0;
// Loop on each answer
$compteur = 0;
- $sql ="SELECT id_users, nom as name, id_sondage, reponses";
- $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
- $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'";
- $resql=$db->query($sql);
- if (! $resql) dol_print_error($db);
- $num=$db->num_rows($resql);
+ $sql = "SELECT id_users, nom as name, id_sondage, reponses";
+ $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
+ $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
+ $resql = $db->query($sql);
+ if (!$resql) dol_print_error($db);
+ $num = $db->num_rows($resql);
while ($compteur < $num)
{
- $obj=$db->fetch_object($resql);
+ $obj = $db->fetch_object($resql);
- if ($compteur==$i)
+ if ($compteur == $i)
{
$sql2 = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
- $sql2.= ' WHERE id_users = '.$db->escape($obj->id_users);
+ $sql2 .= ' WHERE id_users = '.$db->escape($obj->id_users);
$resql2 = $db->query($sql2);
}
@@ -323,7 +323,7 @@ for ($i = 0; $i < $nbcolonnes; $i++)
//si le sujet n'est pas celui qui a été effacé alors on concatene
if ($i != $j)
{
- if (! empty($nouveauxsujets)) $nouveauxsujets .= ',';
+ if (!empty($nouveauxsujets)) $nouveauxsujets .= ',';
$nouveauxsujets .= $toutsujet[$j];
}
@@ -332,26 +332,26 @@ for ($i = 0; $i < $nbcolonnes; $i++)
// Mise a jour des sujets dans la base
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
- $sql.= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'";
+ $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'";
$resql = $db->query($sql);
- if (! $resql) dol_print_error($db);
+ if (!$resql) dol_print_error($db);
// Clean current answer to remove deleted columns
$compteur = 0;
- $sql ="SELECT id_users, nom as name, id_sondage, reponses";
- $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
- $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'";
+ $sql = "SELECT id_users, nom as name, id_sondage, reponses";
+ $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
+ $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
dol_syslog('sql='.$sql);
- $resql=$db->query($sql);
- if (! $resql)
+ $resql = $db->query($sql);
+ if (!$resql)
{
dol_print_error($db);
exit;
}
- $num=$db->num_rows($resql);
+ $num = $db->num_rows($resql);
while ($compteur < $num)
{
- $obj=$db->fetch_object($resql);
+ $obj = $db->fetch_object($resql);
$newcar = '';
$ensemblereponses = $obj->reponses;
@@ -359,7 +359,7 @@ for ($i = 0; $i < $nbcolonnes; $i++)
// parcours de toutes les réponses actuelles
for ($j = 0; $j < $nbcolonnes; $j++)
{
- $car=substr($ensemblereponses, $j, 1);
+ $car = substr($ensemblereponses, $j, 1);
//si les reponses ne concerne pas la colonne effacée, on concatene
if ($i != $j) {
$newcar .= $car;
@@ -368,8 +368,8 @@ for ($i = 0; $i < $nbcolonnes; $i++)
// mise a jour des reponses utilisateurs dans la base
$sql2 = 'UPDATE '.MAIN_DB_PREFIX.'opensurvey_user_studs';
- $sql2.= " SET reponses = '".$db->escape($newcar)."'";
- $sql2.= " WHERE id_users = '".$db->escape($obj->id_users)."'";
+ $sql2 .= " SET reponses = '".$db->escape($newcar)."'";
+ $sql2 .= " WHERE id_users = '".$db->escape($obj->id_users)."'";
//print $sql2;
dol_syslog('sql='.$sql2);
$resql2 = $db->query($sql2);
@@ -387,14 +387,14 @@ for ($i = 0; $i < $nbcolonnes; $i++)
* View
*/
-$form=new Form($db);
+$form = new Form($db);
if ($object->fk_user_creat) {
$userstatic = new User($db);
$userstatic->fetch($object->fk_user_creat);
}
-$result=$object->fetch(0, $numsondage);
+$result = $object->fetch(0, $numsondage);
if ($result <= 0)
{
dol_print_error($db, $object->error);
@@ -403,21 +403,21 @@ if ($result <= 0)
$title = $object->titre." - ".$langs->trans('Card');
$helpurl = '';
-$arrayofjs=array();
-$arrayofcss=array('/opensurvey/css/style.css');
+$arrayofjs = array();
+$arrayofcss = array('/opensurvey/css/style.css');
llxHeader('', $title, $helpurl, 0, 0, 0, $arrayofjs, $arrayofcss);
// Define format of choices
-$toutsujet=explode(",", $object->sujet);
-$listofanswers=array();
+$toutsujet = explode(",", $object->sujet);
+$listofanswers = array();
foreach ($toutsujet as $value)
{
- $tmp=explode('@', $value);
- $listofanswers[]=array('label'=>$tmp[0],'format'=>($tmp[1]?$tmp[1]:'checkbox'));
+ $tmp = explode('@', $value);
+ $listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox'));
}
-$toutsujet=str_replace("@", " ", $toutsujet);
-$toutsujet=str_replace("°", "'", $toutsujet);
+$toutsujet = str_replace("@", " ", $toutsujet);
+$toutsujet = str_replace("°", "'", $toutsujet);
print ' '."\n";
@@ -439,15 +439,15 @@ print '';
print '';
// Type
-$type=($object->format=="A")?'classic':'date';
+$type = ($object->format == "A") ? 'classic' : 'date';
print '| '.$langs->trans("Type").' | ';
-print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'), 1), 'width="16"', 1);
-print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate").' | ';
+print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1);
+print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'';
// Title
print '| ';
-$adresseadmin=$object->mail_admin;
-print $langs->trans("Title") .' | ';
+$adresseadmin = $object->mail_admin;
+print $langs->trans("Title").' | ';
if ($action == 'edit')
{
print '';
@@ -457,13 +457,13 @@ print ' | ';
// Expire date
print '| '.$langs->trans('ExpireDate').' | ';
-if ($action == 'edit') print $form->selectDate($expiredate?$expiredate:$object->date_fin, 'expire', 0, 0, 0, '', 1, 0);
+if ($action == 'edit') print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0);
else print dol_print_date($object->date_fin, 'day');
print ' | ';
// Author
print '| ';
-print $langs->trans("Author") .' | ';
+print $langs->trans("Author").' | ';
if ($object->fk_user_creat) {
print $userstatic->getLoginUrl(1);
} else {
@@ -475,12 +475,12 @@ print ' | ';
print '| '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').' | ';
// Define $urlwithroot
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
-$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
-$url=$urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php', 1).'?sondage='.$object->id_sondage;
-$urllink='';
+$url = $urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php', 1).'?sondage='.$object->id_sondage;
+$urllink = '';
print $urllink;
if ($action != 'edit')
{
@@ -505,7 +505,7 @@ print ''."\n";
print '';
@@ -523,11 +523,11 @@ if (GETPOST('ajoutsujet'))
print "
"."\n";
// Add new column
- if ($object->format=="A")
+ if ($object->format == "A")
{
- print $langs->trans("AddNewColumn") .':
';
+ print $langs->trans("AddNewColumn").':
';
print $langs->trans("Title").' ';
- $tmparray=array('checkbox'=>$langs->trans("CheckBox"),'yesno'=>$langs->trans("YesNoList"),'foragainst'=>$langs->trans("PourContreList"));
+ $tmparray = array('checkbox'=>$langs->trans("CheckBox"), 'yesno'=>$langs->trans("YesNoList"), 'foragainst'=>$langs->trans("PourContreList"));
print $langs->trans("Type").' '.$form->selectarray("typecolonne", $tmparray, GETPOST('typecolonne')).'
';
print '';
print ' ';
@@ -538,12 +538,12 @@ if (GETPOST('ajoutsujet'))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
- $formother=new FormOther($db);
+ $formother = new FormOther($db);
//ajout d'une date avec creneau horaire
- print $langs->trans("AddADate") .':
'."\n";
+ print $langs->trans("AddADate").':
'."\n";
print ' '."\n";
print ' '."\n";
- for ($i=1;$i<32;$i++){
+ for ($i = 1; $i < 32; $i++) {
print ''.$i.''."\n";
}
print ''."\n";
@@ -554,7 +554,7 @@ if (GETPOST('ajoutsujet'))
print $formother->select_year('', 'nouvelleannee', 1, 0, 5, 0, 1);
- print '
'. $langs->trans("AddStartHour") .':
'."\n";
+ print '
'.$langs->trans("AddStartHour").':
'."\n";
print ' '."\n";
print ' '."\n";
for ($i = 0; $i < 24; $i++) {
@@ -568,7 +568,7 @@ if (GETPOST('ajoutsujet'))
print '30'."\n";
print '45'."\n";
print ''."\n";
- print '
'. $langs->trans("AddEndHour") .':
'."\n";
+ print '
'.$langs->trans("AddEndHour").':
'."\n";
print ' '."\n";
print ' '."\n";
for ($i = 0; $i < 24; $i++) {
@@ -600,7 +600,7 @@ if ($user->rights->opensurvey->write) {
print ' '.$langs->trans("PollAdminDesc", img_picto('', 'delete'), $langs->trans("Add")).' ';
}
-$nbcolonnes=substr_count($object->sujet, ',')+1;
+$nbcolonnes = substr_count($object->sujet, ',') + 1;
print ''."\n";
@@ -610,8 +610,8 @@ print ' '."\n";
print ' '."\n";
//reformatage des données des sujets du sondage
-$toutsujet=explode(",", $object->sujet);
-$toutsujet=str_replace("°", "'", $toutsujet);
+$toutsujet = explode(",", $object->sujet);
+$toutsujet = str_replace("°", "'", $toutsujet);
print ''."\n";
print ' | '."\n";
@@ -628,7 +628,7 @@ print ' '."\n";
// Show choice titles
-if ($object->format=="D")
+if ($object->format == "D")
{
//affichage des sujets du sondage
print ''."\n";
@@ -636,9 +636,9 @@ if ($object->format=="D")
print ' | '."\n";
//affichage des années
- $colspan=1;
- $nbofsujet=count($toutsujet);
- for ($i=0;$i<$nbofsujet;$i++)
+ $colspan = 1;
+ $nbofsujet = count($toutsujet);
+ for ($i = 0; $i < $nbofsujet; $i++)
{
$current = $toutsujet[$i];
@@ -646,24 +646,24 @@ if ($object->format=="D")
$current = substr($toutsujet[$i], 0, strpos($toutsujet[$i], '@'));
}
- if (isset($toutsujet[$i+1]) && strpos($toutsujet[$i+1], '@') !== false) {
- $next = substr($toutsujet[$i+1], 0, strpos($toutsujet[$i+1], '@'));
- } elseif (isset($toutsujet[$i+1])) {
- $next = $toutsujet[$i+1];
+ if (isset($toutsujet[$i + 1]) && strpos($toutsujet[$i + 1], '@') !== false) {
+ $next = substr($toutsujet[$i + 1], 0, strpos($toutsujet[$i + 1], '@'));
+ } elseif (isset($toutsujet[$i + 1])) {
+ $next = $toutsujet[$i + 1];
}
$currenty = 0;
- if ($current) $currenty=strftime("%Y", $current);
+ if ($current) $currenty = strftime("%Y", $current);
$next = 0;
- if ($next) $nexty=strftime("%Y", $next);
- if (isset($toutsujet[$i+1]) && ($currenty == $nexty))
+ if ($next) $nexty = strftime("%Y", $next);
+ if (isset($toutsujet[$i + 1]) && ($currenty == $nexty))
{
$colspan++;
} else {
print '';
if ($current) print strftime("%Y", $current);
print ' | '."\n";
- $colspan=1;
+ $colspan = 1;
}
}
@@ -680,20 +680,20 @@ if ($object->format=="D")
//affichage des mois
$colspan = 1;
for ($i = 0; $i < $nbofsujet; $i++) {
- $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime()
+ $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime()
- if (isset($toutsujet[$i+1]) === false) {
+ if (isset($toutsujet[$i + 1]) === false) {
$next = false;
} else {
- $next = intval($toutsujet[$i+1]);
+ $next = intval($toutsujet[$i + 1]);
}
- if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")){
+ if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")) {
$colspan++;
} else {
print ''.dol_print_date($cur, "%B").' | '."\n";
- $colspan=1;
+ $colspan = 1;
}
}
@@ -710,17 +710,17 @@ if ($object->format=="D")
$colspan = 1;
for ($i = 0; $i < $nbofsujet; $i++) {
$cur = intval($toutsujet[$i]);
- if (isset($toutsujet[$i+1]) === false) {
+ if (isset($toutsujet[$i + 1]) === false) {
$next = false;
} else {
- $next = intval($toutsujet[$i+1]);
+ $next = intval($toutsujet[$i + 1]);
}
if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) {
$colspan++;
} else {
print ''.dol_print_date($cur, "%a %e").' | '."\n";
- $colspan=1;
+ $colspan = 1;
}
}
@@ -736,7 +736,7 @@ if ($object->format=="D")
print ' | '."\n";
for ($i = 0; isset($toutsujet[$i]); $i++) {
- $heures=explode('@', $toutsujet[$i]);
+ $heures = explode('@', $toutsujet[$i]);
if (isset($heures[1])) {
print ''.dol_htmlentities($heures[1]).' | '."\n";
} else {
@@ -760,7 +760,7 @@ else
for ($i = 0; isset($toutsujet[$i]); $i++)
{
- $tmp=explode('@', $toutsujet[$i]);
+ $tmp = explode('@', $toutsujet[$i]);
print ''.dol_htmlentities($tmp[0]).' | '."\n";
}
@@ -773,20 +773,20 @@ else
$sumfor = array();
$sumagainst = array();
$compteur = 0;
-$sql ="SELECT id_users, nom as name, id_sondage, reponses";
-$sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
-$sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'";
+$sql = "SELECT id_users, nom as name, id_sondage, reponses";
+$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
+$sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
dol_syslog('sql='.$sql);
-$resql=$db->query($sql);
-if (! $resql)
+$resql = $db->query($sql);
+if (!$resql)
{
dol_print_error($db);
exit;
}
-$num=$db->num_rows($resql);
+$num = $db->num_rows($resql);
while ($compteur < $num)
{
- $obj=$db->fetch_object($resql);
+ $obj = $db->fetch_object($resql);
$ensemblereponses = $obj->reponses;
@@ -800,40 +800,40 @@ while ($compteur < $num)
print ''.dol_htmlentities($obj->name).' | '."\n";
// si la ligne n'est pas a changer, on affiche les données
- if (! $testligneamodifier)
+ if (!$testligneamodifier)
{
for ($i = 0; $i < $nbcolonnes; $i++)
{
$car = substr($ensemblereponses, $i, 1);
//print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz';
- if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'], array('yesno','foragainst')))
+ if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
{
if (((string) $car) == "1") print 'OK | '."\n";
else print 'KO | '."\n";
// Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (!isset($sumfor[$i])) $sumfor[$i] = 0;
if (((string) $car) == "1") $sumfor[$i]++;
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
{
if (((string) $car) == "1") print ''.$langs->trans("Yes").' | '."\n";
elseif (((string) $car) == "0") print ''.$langs->trans("No").' | '."\n";
else print ' | '."\n";
// Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
- if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
+ if (!isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
if (((string) $car) == "1") $sumfor[$i]++;
if (((string) $car) == "0") $sumagainst[$i]++;
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
{
if (((string) $car) == "1") print ''.$langs->trans("For").' | '."\n";
elseif (((string) $car) == "0") print ''.$langs->trans("Against").' | '."\n";
else print ' | '."\n";
// Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
- if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
+ if (!isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
if (((string) $car) == "1") $sumfor[$i]++;
if (((string) $car) == "0") $sumagainst[$i]++;
}
@@ -848,20 +848,20 @@ while ($compteur < $num)
{
$car = substr($ensemblereponses, $i, 1);
print '';
- if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'], array('yesno','foragainst')))
+ if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
{
print '';
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
{
- $arraychoice=array('2'=>' ','0'=>$langs->trans("No"),'1'=>$langs->trans("Yes"));
+ $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"));
print $form->selectarray("choix".$i, $arraychoice, $car);
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
{
- $arraychoice=array('2'=>' ','0'=>$langs->trans("Against"),'1'=>$langs->trans("For"));
+ $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For"));
print $form->selectarray("choix".$i, $arraychoice, $car);
}
print ' | '."\n";
@@ -872,33 +872,33 @@ while ($compteur < $num)
for ($i = 0; $i < $nbcolonnes; $i++)
{
$car = substr($ensemblereponses, $i, 1);
- if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'], array('yesno','foragainst')))
+ if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
{
if (((string) $car) == "1") print 'OK | '."\n";
else print 'KO | '."\n";
// Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (!isset($sumfor[$i])) $sumfor[$i] = 0;
if (((string) $car) == "1") $sumfor[$i]++;
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
{
if (((string) $car) == "1") print ''.$langs->trans("For").' | '."\n";
elseif (((string) $car) == "0") print ''.$langs->trans("Against").' | '."\n";
else print ' | '."\n";
// Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
- if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
+ if (!isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
if (((string) $car) == "1") $sumfor[$i]++;
if (((string) $car) == "0") $sumagainst[$i]++;
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
{
if (((string) $car) == "1") print ''.$langs->trans("For").' | '."\n";
elseif (((string) $car) == "0") print ''.$langs->trans("Against").' | '."\n";
else print ' | '."\n";
// Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
- if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
+ if (!isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
if (((string) $car) == "1") $sumfor[$i]++;
if (((string) $car) == "0") $sumagainst[$i]++;
}
@@ -913,7 +913,7 @@ while ($compteur < $num)
}
//demande de confirmation pour modification de ligne
- for ($i=0; $i<$nblines; $i++)
+ for ($i = 0; $i < $nblines; $i++)
{
if (isset($_POST["modifierligne".$i]))
{
@@ -943,23 +943,23 @@ if (empty($testligneamodifier))
for ($i = 0; $i < $nbcolonnes; $i++)
{
print '';
- if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'], array('yesno','foragainst')))
+ if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
{
print '';
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
{
- $arraychoice=array('2'=>' ','0'=>$langs->trans("No"),'1'=>$langs->trans("Yes"));
+ $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"));
print $form->selectarray("choix".$i, $arraychoice);
}
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
{
- $arraychoice=array('2'=>' ','0'=>$langs->trans("Against"),'1'=>$langs->trans("For"));
+ $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For"));
print $form->selectarray("choix".$i, $arraychoice);
}
print ' | '."\n";
@@ -971,10 +971,10 @@ if (empty($testligneamodifier))
}
// Select value of best choice (for checkbox columns only)
-$nbofcheckbox=0;
-for ($i=0; $i < $nbcolonnes + 1; $i++)
+$nbofcheckbox = 0;
+for ($i = 0; $i < $nbcolonnes + 1; $i++)
{
- if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'], array('yesno','foragainst')))
+ if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
$nbofcheckbox++;
if (isset($sumfor[$i]))
{
@@ -993,18 +993,18 @@ for ($i=0; $i < $nbcolonnes + 1; $i++)
// Show line total
print ' '."\n";
print ' | '."\n";
-print ''. $langs->trans("Total") .' | '."\n";
+print ''.$langs->trans("Total").' | '."\n";
for ($i = 0; $i < $nbcolonnes; $i++)
{
- $showsumfor = isset($sumfor[$i])?$sumfor[$i]:'';
- $showsumagainst = isset($sumagainst[$i])?$sumagainst[$i]:'';
+ $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : '';
+ $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : '';
if (empty($showsumfor)) $showsumfor = 0;
if (empty($showsumagainst)) $showsumagainst = 0;
print '';
- if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'], array('yesno','foragainst'))) print $showsumfor;
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.' '.$langs->trans("No").': '.$showsumagainst;
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.' '.$langs->trans("Against").': '.$showsumagainst;
+ if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor;
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.' '.$langs->trans("No").': '.$showsumagainst;
+ if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.' '.$langs->trans("Against").': '.$showsumagainst;
print ' | '."\n";
}
print ' ';
@@ -1015,7 +1015,7 @@ if ($nbofcheckbox >= 2)
print ' | '."\n";
print ' | '."\n";
for ($i = 0; $i < $nbcolonnes; $i++) {
- if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'], array('yesno','foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne)
+ if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne)
{
print '.') | '."\n";
} else {
@@ -1043,7 +1043,7 @@ print ' '."\n";
print ' '."\n";
-$toutsujet = explode(",", $object->sujet); // With old versions, this field was not set
+$toutsujet = explode(",", $object->sujet); // With old versions, this field was not set
$compteursujet = 0;
$meilleursujet = '';
@@ -1051,21 +1051,21 @@ for ($i = 0; $i < $nbcolonnes; $i++)
{
if (isset($sumfor[$i]) === true && isset($meilleurecolonne) === true && $sumfor[$i] == $meilleurecolonne)
{
- $meilleursujet.=", ";
+ $meilleursujet .= ", ";
if ($object->format == "D") {
$meilleursujetexport = $toutsujet[$i];
//var_dump($toutsujet);
if (strpos($toutsujet[$i], '@') !== false) {
$toutsujetdate = explode("@", $toutsujet[$i]);
- $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext'). ($toutsujetdate[0] ? ' ('.dol_print_date($toutsujetdate[0], '%A').')' : '') . ' - ' . $toutsujetdate[1];
+ $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').($toutsujetdate[0] ? ' ('.dol_print_date($toutsujetdate[0], '%A').')' : '').' - '.$toutsujetdate[1];
} else {
- $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext'). ($toutsujet[$i] ? ' ('.dol_print_date($toutsujet[$i], '%A').')' : '');
+ $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').($toutsujet[$i] ? ' ('.dol_print_date($toutsujet[$i], '%A').')' : '');
}
}
else
{
- $tmps=explode('@', $toutsujet[$i]);
+ $tmps = explode('@', $toutsujet[$i]);
$meilleursujet .= dol_htmlentities($tmps[0]);
}
@@ -1082,9 +1082,9 @@ if ($nbofcheckbox >= 2)
print ''."\n";
if (isset($meilleurecolonne) && $compteursujet == "1") {
- print " " . $langs->trans('TheBestChoice') . ": ".$meilleursujet." " . $langs->trans("with") . " ".$meilleurecolonne." " . $vote_str . ".\n";
+ print " ".$langs->trans('TheBestChoice').": ".$meilleursujet." ".$langs->trans("with")." ".$meilleurecolonne." ".$vote_str.".\n";
} elseif (isset($meilleurecolonne)) {
- print " " . $langs->trans('TheBestChoices') . ": ".$meilleursujet." " . $langs->trans("with") . " ".$meilleurecolonne." " . $vote_str . ".\n";
+ print " ".$langs->trans('TheBestChoices').": ".$meilleursujet." ".$langs->trans("with")." ".$meilleurecolonne." ".$vote_str.".\n";
}
print '
'."\n";
}
diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php
index 22356994008..ab9ba921e16 100644
--- a/htdocs/paypal/lib/paypal.lib.php
+++ b/htdocs/paypal/lib/paypal.lib.php
@@ -40,7 +40,7 @@ function paypaladmin_prepare_head()
$head[$h][2] = 'paypalaccount';
$h++;
- $object=new stdClass();
+ $object = new stdClass();
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
@@ -68,12 +68,12 @@ function showPaypalPaymentUrl($type, $ref)
$langs->load("paypal");
$langs->load("paybox");
- $servicename='PayPal';
- $out='
';
- $out.=img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).' ';
- $url=getPaypalPaymentUrl(0, $type, $ref);
- $out.='';
- $out.=ajax_autoselect("paypalurl", 0);
+ $servicename = 'PayPal';
+ $out = '
';
+ $out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).' ';
+ $url = getPaypalPaymentUrl(0, $type, $ref);
+ $out .= '';
+ $out .= ajax_autoselect("paypalurl", 0);
return $out;
}
@@ -92,92 +92,92 @@ function getPaypalPaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
{
global $conf;
- $ref=str_replace(' ', '', $ref);
+ $ref = str_replace(' ', '', $ref);
if ($type == 'free')
{
- $out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode?'':'').$amount.($mode?'':'').'&tag='.($mode?'':'').$freetag.($mode?'':'');
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
+ $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : '');
+ if (!empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
- else $out.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
+ else $out .= '&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
}
}
if ($type == 'order')
{
- $out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=order&ref='.($mode?'':'');
- if ($mode == 1) $out.='order_ref';
- if ($mode == 0) $out.=urlencode($ref);
- $out.=($mode?'':'');
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
+ $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=order&ref='.($mode ? '' : '');
+ if ($mode == 1) $out .= 'order_ref';
+ if ($mode == 0) $out .= urlencode($ref);
+ $out .= ($mode ? '' : '');
+ if (!empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
else
{
- $out.='&securekey='.($mode?'':'');
- if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + order_ref)";
- if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
- $out.=($mode?'':'');
+ $out .= '&securekey='.($mode ? '' : '');
+ if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + order_ref)";
+ if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2);
+ $out .= ($mode ? '' : '');
}
}
}
if ($type == 'invoice')
{
- $out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=invoice&ref='.($mode?'':'');
- if ($mode == 1) $out.='invoice_ref';
- if ($mode == 0) $out.=urlencode($ref);
- $out.=($mode?'':'');
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
+ $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=invoice&ref='.($mode ? '' : '');
+ if ($mode == 1) $out .= 'invoice_ref';
+ if ($mode == 0) $out .= urlencode($ref);
+ $out .= ($mode ? '' : '');
+ if (!empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
else
{
- $out.='&securekey='.($mode?'':'');
- if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
- if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
- $out.=($mode?'':'');
+ $out .= '&securekey='.($mode ? '' : '');
+ if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
+ if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2);
+ $out .= ($mode ? '' : '');
}
}
}
if ($type == 'contractline')
{
- $out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=contractline&ref='.($mode?'':'');
- if ($mode == 1) $out.='contractline_ref';
- if ($mode == 0) $out.=urlencode($ref);
- $out.=($mode?'':'');
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
+ $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=contractline&ref='.($mode ? '' : '');
+ if ($mode == 1) $out .= 'contractline_ref';
+ if ($mode == 0) $out .= urlencode($ref);
+ $out .= ($mode ? '' : '');
+ if (!empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
else
{
- $out.='&securekey='.($mode?'':'');
- if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
- if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
- $out.=($mode?'':'');
+ $out .= '&securekey='.($mode ? '' : '');
+ if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
+ if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2);
+ $out .= ($mode ? '' : '');
}
}
}
if ($type == 'membersubscription')
{
- $out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.($mode?'':'');
- if ($mode == 1) $out.='member_ref';
- if ($mode == 0) $out.=urlencode($ref);
- $out.=($mode?'':'');
- if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
+ $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.($mode ? '' : '');
+ if ($mode == 1) $out .= 'member_ref';
+ if ($mode == 0) $out .= urlencode($ref);
+ $out .= ($mode ? '' : '');
+ if (!empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
- if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
+ if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
else
{
- $out.='&securekey='.($mode?'':'');
- if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + member_ref)";
- if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
- $out.=($mode?'':'');
+ $out .= '&securekey='.($mode ? '' : '');
+ if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + member_ref)";
+ if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2);
+ $out .= ($mode ? '' : '');
}
}
}
// For multicompany
- $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
+ $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
return $out;
}
@@ -209,27 +209,27 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType,
//'
//'-------------------------------------------------
- if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral';
+ if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral';
- $solutionType='Sole';
- $landingPage='Billing';
+ $solutionType = 'Sole';
+ $landingPage = 'Billing';
// For payment with Paypal only
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
{
- $solutionType='Mark';
- $landingPage='Login';
+ $solutionType = 'Mark';
+ $landingPage = 'Login';
}
// For payment with Credit card or Paypal
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
{
- $solutionType='Sole';
- $landingPage='Billing';
+ $solutionType = 'Sole';
+ $landingPage = 'Billing';
}
// For payment with Credit card
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'cconly')
{
- $solutionType='Sole';
- $landingPage='Billing';
+ $solutionType = 'Sole';
+ $landingPage = 'Billing';
}
dol_syslog("expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum");
@@ -255,12 +255,12 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType,
);
$ack = strtoupper($resArray["ACK"]);
- if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
+ if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING")
{
- $token=$resArray["TOKEN"];
+ $token = $resArray["TOKEN"];
// Redirect to paypal.com here
- $payPalURL = $API_Url . $token;
+ $payPalURL = $API_Url.$token;
header("Location: ".$payPalURL);
exit;
}
@@ -274,15 +274,15 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType,
if ($ErrorCode == 10729)
{
- $mesg.= "PayPal can't accept payments for this thirdparty. An address is defined but is not complete (missing State). Ask system administrator to fix address or to setup Paypal module to accept payments even on not complete addresses (remove option PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS). \n";
+ $mesg .= "PayPal can't accept payments for this thirdparty. An address is defined but is not complete (missing State). Ask system administrator to fix address or to setup Paypal module to accept payments even on not complete addresses (remove option PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS). \n";
}
else
{
- $mesg = $langs->trans('SetExpressCheckoutAPICallFailed') . " \n";
- $mesg.= $langs->trans('DetailedErrorMessage') . ": " . $ErrorLongMsg." \n";
- $mesg.= $langs->trans('ShortErrorMessage') . ": " . $ErrorShortMsg." \n";
- $mesg.= $langs->trans('ErrorCode') . ": " . $ErrorCode." \n";
- $mesg.= $langs->trans('ErrorSeverityCode') . ": " . $ErrorSeverityCode." \n";
+ $mesg = $langs->trans('SetExpressCheckoutAPICallFailed')." \n";
+ $mesg .= $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg." \n";
+ $mesg .= $langs->trans('ShortErrorMessage').": ".$ErrorShortMsg." \n";
+ $mesg .= $langs->trans('ErrorCode').": ".$ErrorCode." \n";
+ $mesg .= $langs->trans('ErrorSeverityCode').": ".$ErrorSeverityCode." \n";
}
return $mesg;
@@ -342,92 +342,92 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
$nvpstr = '';
//$nvpstr = $nvpstr . "&VERSION=".$API_version; // Already added by hash_call
- $nvpstr = $nvpstr . "&RETURNURL=" . urlencode($returnURL);
- $nvpstr = $nvpstr . "&CANCELURL=" . urlencode($cancelURL);
- if (! empty($conf->global->PAYPAL_ALLOW_NOTES))
+ $nvpstr = $nvpstr."&RETURNURL=".urlencode($returnURL);
+ $nvpstr = $nvpstr."&CANCELURL=".urlencode($cancelURL);
+ if (!empty($conf->global->PAYPAL_ALLOW_NOTES))
{
- $nvpstr = $nvpstr . "&ALLOWNOTE=0";
+ $nvpstr = $nvpstr."&ALLOWNOTE=0";
}
if (empty($conf->global->PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS))
{
- $nvpstr = $nvpstr . "&NOSHIPPING=1"; // An empty or not complete shipping address will be accepted
+ $nvpstr = $nvpstr."&NOSHIPPING=1"; // An empty or not complete shipping address will be accepted
}
else
{
- $nvpstr = $nvpstr . "&NOSHIPPING=0"; // A valid shipping address is required (full required fields mandatory)
+ $nvpstr = $nvpstr."&NOSHIPPING=0"; // A valid shipping address is required (full required fields mandatory)
}
- $nvpstr = $nvpstr . "&SOLUTIONTYPE=" . urlencode($solutionType);
- $nvpstr = $nvpstr . "&LANDINGPAGE=" . urlencode($landingPage);
- if (! empty($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER))
+ $nvpstr = $nvpstr."&SOLUTIONTYPE=".urlencode($solutionType);
+ $nvpstr = $nvpstr."&LANDINGPAGE=".urlencode($landingPage);
+ if (!empty($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER))
{
- $nvpstr = $nvpstr . "&CUSTOMERSERVICENUMBER=" . urlencode($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER); // Hotline phone number
+ $nvpstr = $nvpstr."&CUSTOMERSERVICENUMBER=".urlencode($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER); // Hotline phone number
}
$paypalprefix = 'PAYMENTREQUEST_0_';
//$paypalprefix = '';
- if (! empty($paypalprefix) && $paymentType == 'Sole') $paymentType='Sale';
+ if (!empty($paypalprefix) && $paymentType == 'Sole') $paymentType = 'Sale';
- $nvpstr = $nvpstr . "&AMT=". urlencode($paymentAmount); // Total for all elements
+ $nvpstr = $nvpstr."&AMT=".urlencode($paymentAmount); // Total for all elements
- $nvpstr = $nvpstr . "&".$paypalprefix."INVNUM=" . urlencode($tag);
- $nvpstr = $nvpstr . "&".$paypalprefix."AMT=". urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT
- $nvpstr = $nvpstr . "&".$paypalprefix."ITEMAMT=". urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT
- $nvpstr = $nvpstr . "&".$paypalprefix."PAYMENTACTION=" . urlencode($paymentType); // PAYMENTACTION deprecated by paypal -> PAYMENTREQUEST_n_PAYMENTACTION
- $nvpstr = $nvpstr . "&".$paypalprefix."CURRENCYCODE=" . urlencode($currencyCodeType); // CURRENCYCODE deprecated by paypal -> PAYMENTREQUEST_n_CURRENCYCODE
+ $nvpstr = $nvpstr."&".$paypalprefix."INVNUM=".urlencode($tag);
+ $nvpstr = $nvpstr."&".$paypalprefix."AMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT
+ $nvpstr = $nvpstr."&".$paypalprefix."ITEMAMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT
+ $nvpstr = $nvpstr."&".$paypalprefix."PAYMENTACTION=".urlencode($paymentType); // PAYMENTACTION deprecated by paypal -> PAYMENTREQUEST_n_PAYMENTACTION
+ $nvpstr = $nvpstr."&".$paypalprefix."CURRENCYCODE=".urlencode($currencyCodeType); // CURRENCYCODE deprecated by paypal -> PAYMENTREQUEST_n_CURRENCYCODE
- $nvpstr = $nvpstr . "&".$paypalprefix."L_PAYMENTREQUEST_0_QTY0=1";
- $nvpstr = $nvpstr . "&".$paypalprefix."L_PAYMENTREQUEST_0_AMT0=".urlencode($paymentAmount);
- $nvpstr = $nvpstr . "&".$paypalprefix."L_PAYMENTREQUEST_0_NAME0=".urlencode($desc);
- $nvpstr = $nvpstr . "&".$paypalprefix."L_PAYMENTREQUEST_0_NUMBER0=0";
+ $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_QTY0=1";
+ $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_AMT0=".urlencode($paymentAmount);
+ $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NAME0=".urlencode($desc);
+ $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NUMBER0=0";
- $nvpstr = $nvpstr . "&".$paypalprefix."SHIPTONAME=" . urlencode($shipToName); // SHIPTONAME deprecated by paypal -> PAYMENTREQUEST_n_SHIPTONAME
- $nvpstr = $nvpstr . "&".$paypalprefix."SHIPTOSTREET=" . urlencode($shipToStreet); //
- $nvpstr = $nvpstr . "&".$paypalprefix."SHIPTOSTREET2=" . urlencode($shipToStreet2);
- $nvpstr = $nvpstr . "&".$paypalprefix."SHIPTOCITY=" . urlencode($shipToCity);
- $nvpstr = $nvpstr . "&".$paypalprefix."SHIPTOSTATE=" . urlencode($shipToState);
- $nvpstr = $nvpstr . "&".$paypalprefix."SHIPTOCOUNTRYCODE=" . urlencode($shipToCountryCode);
- $nvpstr = $nvpstr . "&".$paypalprefix."SHIPTOZIP=" . urlencode($shipToZip);
- $nvpstr = $nvpstr . "&".$paypalprefix."PHONENUM=" . urlencode($phoneNum);
- if (! empty($email)) $nvpstr = $nvpstr . "&".$paypalprefix."EMAIL=" . urlencode($email); // EMAIL deprecated by paypal -> PAYMENTREQUEST_n_EMAIL
- if (! empty($desc)) $nvpstr = $nvpstr . "&".$paypalprefix."DESC=" . urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC
+ $nvpstr = $nvpstr."&".$paypalprefix."SHIPTONAME=".urlencode($shipToName); // SHIPTONAME deprecated by paypal -> PAYMENTREQUEST_n_SHIPTONAME
+ $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTREET=".urlencode($shipToStreet); //
+ $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTREET2=".urlencode($shipToStreet2);
+ $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOCITY=".urlencode($shipToCity);
+ $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTATE=".urlencode($shipToState);
+ $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOCOUNTRYCODE=".urlencode($shipToCountryCode);
+ $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOZIP=".urlencode($shipToZip);
+ $nvpstr = $nvpstr."&".$paypalprefix."PHONENUM=".urlencode($phoneNum);
+ if (!empty($email)) $nvpstr = $nvpstr."&".$paypalprefix."EMAIL=".urlencode($email); // EMAIL deprecated by paypal -> PAYMENTREQUEST_n_EMAIL
+ if (!empty($desc)) $nvpstr = $nvpstr."&".$paypalprefix."DESC=".urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC
- if (! empty($conf->global->PAYPAL_LOGOIMG) && $mysoc->logo)
+ if (!empty($conf->global->PAYPAL_LOGOIMG) && $mysoc->logo)
{
global $dolibarr_main_url_root;
// Define $urlwithroot
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
- $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
- $urllogo=$urlwithroot."/viewimage.php?modulepart=mycompany&file=".urlencode('logos/'.$mysoc->logo);
- $nvpstr = $nvpstr . "&LOGOIMG=" . urlencode($urllogo);
+ $urllogo = $urlwithroot."/viewimage.php?modulepart=mycompany&file=".urlencode('logos/'.$mysoc->logo);
+ $nvpstr = $nvpstr."&LOGOIMG=".urlencode($urllogo);
}
- if (! empty($conf->global->PAYPAL_BRANDNAME))
+ if (!empty($conf->global->PAYPAL_BRANDNAME))
{
- $nvpstr = $nvpstr . "&BRANDNAME=" . urlencode($conf->global->PAYPAL_BRANDNAME); // BRANDNAME
+ $nvpstr = $nvpstr."&BRANDNAME=".urlencode($conf->global->PAYPAL_BRANDNAME); // BRANDNAME
}
- if (! empty($conf->global->PAYPAL_NOTETOBUYER))
+ if (!empty($conf->global->PAYPAL_NOTETOBUYER))
{
- $nvpstr = $nvpstr . "&NOTETOBUYER=" . urlencode($conf->global->PAYPAL_NOTETOBUYER); // PAYPAL_NOTETOBUYER
+ $nvpstr = $nvpstr."&NOTETOBUYER=".urlencode($conf->global->PAYPAL_NOTETOBUYER); // PAYPAL_NOTETOBUYER
}
$_SESSION["FinalPaymentAmt"] = $paymentAmount;
$_SESSION["currencyCodeType"] = $currencyCodeType;
- $_SESSION["PaymentType"] = $paymentType; // 'Mark', 'Sole'
- $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
+ $_SESSION["PaymentType"] = $paymentType; // 'Mark', 'Sole'
+ $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
//'---------------------------------------------------------------------------------------------------------------
//' Make the API call to PayPal
//' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment.
//' If an error occured, show the resulting errors
//'---------------------------------------------------------------------------------------------------------------
- $resArray=hash_call("SetExpressCheckout", $nvpstr);
+ $resArray = hash_call("SetExpressCheckout", $nvpstr);
$ack = strtoupper($resArray["ACK"]);
- if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
+ if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING")
{
$token = urldecode($resArray["TOKEN"]);
- $_SESSION['TOKEN']=$token;
+ $_SESSION['TOKEN'] = $token;
}
return $resArray;
@@ -459,7 +459,7 @@ function getDetails($token)
//' Build a second API request to PayPal, using the token as the
//' ID to get the details on the payment authorization
//'---------------------------------------------------------------------------
- $nvpstr="&TOKEN=" . $token;
+ $nvpstr = "&TOKEN=".$token;
//'---------------------------------------------------------------------------
//' Make the API call and store the results in an array.
@@ -467,9 +467,9 @@ function getDetails($token)
//' an action to complete the payment.
//' If failed, show the error
//'---------------------------------------------------------------------------
- $resArray=hash_call("GetExpressCheckoutDetails", $nvpstr);
+ $resArray = hash_call("GetExpressCheckoutDetails", $nvpstr);
$ack = strtoupper($resArray["ACK"]);
- if($ack == "SUCCESS" || $ack=="SUCCESSWITHWARNING")
+ if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING")
{
$_SESSION['payer_id'] = $resArray['PAYERID'];
}
@@ -502,18 +502,18 @@ function confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipad
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
$nvpstr = '';
- $nvpstr .= '&TOKEN=' . urlencode($token);
- $nvpstr .= '&PAYERID=' . urlencode($payerID);
- $nvpstr .= '&PAYMENTACTION=' . urlencode($paymentType);
- $nvpstr .= '&AMT=' . urlencode($FinalPaymentAmt);
- $nvpstr .= '&CURRENCYCODE=' . urlencode($currencyCodeType);
- $nvpstr .= '&IPADDRESS=' . urlencode($ipaddress);
- $nvpstr .= '&INVNUM=' . urlencode($tag);
+ $nvpstr .= '&TOKEN='.urlencode($token);
+ $nvpstr .= '&PAYERID='.urlencode($payerID);
+ $nvpstr .= '&PAYMENTACTION='.urlencode($paymentType);
+ $nvpstr .= '&AMT='.urlencode($FinalPaymentAmt);
+ $nvpstr .= '&CURRENCYCODE='.urlencode($currencyCodeType);
+ $nvpstr .= '&IPADDRESS='.urlencode($ipaddress);
+ $nvpstr .= '&INVNUM='.urlencode($tag);
/* Make the call to PayPal to finalize payment
If an error occured, show the resulting errors
*/
- $resArray=hash_call("DoExpressCheckoutPayment", $nvpstr);
+ $resArray = hash_call("DoExpressCheckoutPayment", $nvpstr);
/* Display the API response back to the browser.
If the response from PayPal was a success, display the response parameters'
@@ -591,8 +591,8 @@ function hash_call($methodName, $nvpStr)
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
// TODO problem with triggers
- $API_version="98.0";
- if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) // We can force sand box with param 'forcesandbox'
+ $API_version = "98.0";
+ if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) // We can force sand box with param 'forcesandbox'
{
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
$API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
@@ -604,14 +604,14 @@ function hash_call($methodName, $nvpStr)
}
// Clean parameters
- $PAYPAL_API_USER="";
- if (! empty($conf->global->PAYPAL_API_USER)) $PAYPAL_API_USER=$conf->global->PAYPAL_API_USER;
- $PAYPAL_API_PASSWORD="";
- if (! empty($conf->global->PAYPAL_API_PASSWORD)) $PAYPAL_API_PASSWORD=$conf->global->PAYPAL_API_PASSWORD;
- $PAYPAL_API_SIGNATURE="";
- if (! empty($conf->global->PAYPAL_API_SIGNATURE)) $PAYPAL_API_SIGNATURE=$conf->global->PAYPAL_API_SIGNATURE;
- $PAYPAL_API_SANDBOX="";
- if (! empty($conf->global->PAYPAL_API_SANDBOX)) $PAYPAL_API_SANDBOX=$conf->global->PAYPAL_API_SANDBOX;
+ $PAYPAL_API_USER = "";
+ if (!empty($conf->global->PAYPAL_API_USER)) $PAYPAL_API_USER = $conf->global->PAYPAL_API_USER;
+ $PAYPAL_API_PASSWORD = "";
+ if (!empty($conf->global->PAYPAL_API_PASSWORD)) $PAYPAL_API_PASSWORD = $conf->global->PAYPAL_API_PASSWORD;
+ $PAYPAL_API_SIGNATURE = "";
+ if (!empty($conf->global->PAYPAL_API_SIGNATURE)) $PAYPAL_API_SIGNATURE = $conf->global->PAYPAL_API_SIGNATURE;
+ $PAYPAL_API_SANDBOX = "";
+ if (!empty($conf->global->PAYPAL_API_SANDBOX)) $PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX;
// TODO END problem with triggers
dol_syslog("Paypal API endpoint ".$API_Endpoint);
@@ -626,14 +626,14 @@ function hash_call($methodName, $nvpStr)
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
// TLSv1 by default or change to TLSv1.2 in module configuration
- curl_setopt($ch, CURLOPT_SSLVERSION, (empty($conf->global->PAYPAL_SSLVERSION)?1:$conf->global->PAYPAL_SSLVERSION));
+ curl_setopt($ch, CURLOPT_SSLVERSION, (empty($conf->global->PAYPAL_SSLVERSION) ? 1 : $conf->global->PAYPAL_SSLVERSION));
//turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT);
- curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT);
+ curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
@@ -641,15 +641,15 @@ function hash_call($methodName, $nvpStr)
//if USE_PROXY constant set to true in Constants.php, then only proxy will be enabled.
if ($USE_PROXY)
{
- dol_syslog("Paypal API hash_call set proxy to ".$PROXY_HOST. ":" . $PROXY_PORT." - ".$PROXY_USER. ":" . $PROXY_PASS);
+ dol_syslog("Paypal API hash_call set proxy to ".$PROXY_HOST.":".$PROXY_PORT." - ".$PROXY_USER.":".$PROXY_PASS);
//curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // Curl 7.10
- curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT);
- if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER. ":" . $PROXY_PASS);
+ curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT);
+ if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER.":".$PROXY_PASS);
}
//NVPRequest for submitting to server
- $nvpreq ="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($API_version) . "&PWD=" . urlencode($PAYPAL_API_PASSWORD) . "&USER=" . urlencode($PAYPAL_API_USER) . "&SIGNATURE=" . urlencode($PAYPAL_API_SIGNATURE) . $nvpStr;
- $nvpreq.="&LOCALECODE=".strtoupper($langs->getDefaultLang(1));
+ $nvpreq = "METHOD=".urlencode($methodName)."&VERSION=".urlencode($API_version)."&PWD=".urlencode($PAYPAL_API_PASSWORD)."&USER=".urlencode($PAYPAL_API_USER)."&SIGNATURE=".urlencode($PAYPAL_API_SIGNATURE).$nvpStr;
+ $nvpreq .= "&LOCALECODE=".strtoupper($langs->getDefaultLang(1));
//$nvpreq.="&BRANDNAME=".urlencode(); // Override merchant name
//$nvpreq.="&NOTIFYURL=".urlencode(); // For Instant Payment Notification url
@@ -662,18 +662,18 @@ function hash_call($methodName, $nvpStr)
//getting response from server
$response = curl_exec($ch);
- $nvpReqArray=deformatNVP($nvpreq);
- $_SESSION['nvpReqArray']=$nvpReqArray;
+ $nvpReqArray = deformatNVP($nvpreq);
+ $_SESSION['nvpReqArray'] = $nvpReqArray;
//convrting NVPResponse to an Associative Array
dol_syslog("Paypal API hash_call Response nvpresp=".$response);
- $nvpResArray=deformatNVP($response);
+ $nvpResArray = deformatNVP($response);
if (curl_errno($ch))
{
// moving to display page to display curl errors
- $_SESSION['curl_error_no']=curl_errno($ch);
- $_SESSION['curl_error_msg']=curl_error($ch);
+ $_SESSION['curl_error_no'] = curl_errno($ch);
+ $_SESSION['curl_error_msg'] = curl_error($ch);
//Execute the Error handling module to display errors.
}
@@ -696,22 +696,22 @@ function hash_call($methodName, $nvpStr)
*/
function deformatNVP($nvpstr)
{
- $intial=0;
+ $intial = 0;
$nvpArray = array();
- while(strlen($nvpstr))
+ while (strlen($nvpstr))
{
//postion of Key
- $keypos= strpos($nvpstr, '=');
+ $keypos = strpos($nvpstr, '=');
//position of value
- $valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&'): strlen($nvpstr);
+ $valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&') : strlen($nvpstr);
/*getting the Key and Value values and storing in a Associative Array*/
- $keyval=substr($nvpstr, $intial, $keypos);
- $valval=substr($nvpstr, $keypos+1, $valuepos-$keypos-1);
+ $keyval = substr($nvpstr, $intial, $keypos);
+ $valval = substr($nvpstr, $keypos + 1, $valuepos - $keypos - 1);
//decoding the respose
- $nvpArray[urldecode($keyval)] =urldecode($valval);
- $nvpstr=substr($nvpstr, $valuepos+1, strlen($nvpstr));
+ $nvpArray[urldecode($keyval)] = urldecode($valval);
+ $nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr));
}
return $nvpArray;
}
@@ -723,16 +723,16 @@ function deformatNVP($nvpstr)
*/
function getApiError()
{
- $errors=array();
+ $errors = array();
- $resArray=$_SESSION['reshash'];
+ $resArray = $_SESSION['reshash'];
- if(isset($_SESSION['curl_error_no']))
+ if (isset($_SESSION['curl_error_no']))
{
$errors[] = $_SESSION['curl_error_no'].'-'.$_SESSION['curl_error_msg'];
}
- foreach($resArray as $key => $value)
+ foreach ($resArray as $key => $value)
{
$errors[] = $key.'-'.$value;
}
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index 51deaf8c73b..f9a4a12b0df 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -673,18 +673,18 @@ class Products extends DolibarrApi
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
}
- $id = (empty($id)?0:$id);
+ $id = (empty($id) ? 0 : $id);
- if(! DolibarrApiAccess::$user->rights->produit->lire) {
+ if (!DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(403);
}
$result = $this->product->fetch($id, $ref, $ref_ext, $barcode);
- if(! $result ) {
+ if (!$result) {
throw new RestException(404, 'Product not found');
}
- if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
+ if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -765,18 +765,18 @@ class Products extends DolibarrApi
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
}
- $id = (empty($id)?0:$id);
+ $id = (empty($id) ? 0 : $id);
- if(! DolibarrApiAccess::$user->rights->produit->lire) {
+ if (!DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(403);
}
$result = $this->product->fetch($id, $ref, $ref_ext, $barcode);
- if(! $result ) {
+ if (!$result) {
throw new RestException(404, 'Product not found');
}
- if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
+ if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 72fd475e6ae..3c05b4e1ad1 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -37,11 +37,11 @@ class FormProduct
/**
* @var string Error code (or message)
*/
- public $error='';
+ public $error = '';
// Cache arrays
- public $cache_warehouses=array();
- public $cache_lot=array();
+ public $cache_warehouses = array();
+ public $cache_lot = array();
/**
@@ -76,7 +76,7 @@ class FormProduct
{
global $conf, $langs;
- if (empty($fk_product) && count($this->cache_warehouses)) return 0; // Cache already loaded and we do not want a list with information specific to a product
+ if (empty($fk_product) && count($this->cache_warehouses)) return 0; // Cache already loaded and we do not want a list with information specific to a product
if (is_array($exclude)) $excludeGroups = implode("','", $exclude);
@@ -100,59 +100,59 @@ class FormProduct
{
if (!empty($batch))
{
- $sql.= ", pb.qty as stock";
+ $sql .= ", pb.qty as stock";
}
else
{
- $sql.= ", ps.reel as stock";
+ $sql .= ", ps.reel as stock";
}
}
elseif ($sumStock)
{
- $sql.= ", sum(ps.reel) as stock";
+ $sql .= ", sum(ps.reel) as stock";
}
- $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_entrepot = e.rowid";
+ $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_entrepot = e.rowid";
if (!empty($fk_product))
{
- $sql.= " AND ps.fk_product = '".$fk_product."'";
+ $sql .= " AND ps.fk_product = '".$fk_product."'";
if (!empty($batch))
{
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb on pb.fk_product_stock = ps.rowid AND pb.batch = '".$batch."'";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb on pb.fk_product_stock = ps.rowid AND pb.batch = '".$batch."'";
}
}
- $sql.= " WHERE e.entity IN (".getEntity('stock').")";
+ $sql .= " WHERE e.entity IN (".getEntity('stock').")";
if (count($warehouseStatus))
{
- $sql.= " AND e.statut IN (".$this->db->escape(implode(',', $warehouseStatus)).")";
+ $sql .= " AND e.statut IN (".$this->db->escape(implode(',', $warehouseStatus)).")";
}
else
{
- $sql.= " AND e.statut = 1";
+ $sql .= " AND e.statut = 1";
}
- if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.$this->db->escape(implode(',', $exclude)).')';
+ if (!empty($exclude)) $sql .= ' AND e.rowid NOT IN('.$this->db->escape(implode(',', $exclude)).')';
// minimum stock
if ($stockMin !== false) {
if (!empty($fk_product)) {
if (!empty($batch)) {
- $sql .= " AND pb.qty > " . $this->db->escape($stockMin);
+ $sql .= " AND pb.qty > ".$this->db->escape($stockMin);
} else {
- $sql .= " AND ps.reel > " . $this->db->escape($stockMin);
+ $sql .= " AND ps.reel > ".$this->db->escape($stockMin);
}
}
}
if ($sumStock && empty($fk_product)) {
- $sql.= " GROUP BY e.rowid, e.ref, e.description, e.fk_parent";
+ $sql .= " GROUP BY e.rowid, e.ref, e.description, e.fk_parent";
// minimum stock
if ($stockMin !== false) {
- $sql .= " HAVING sum(ps.reel) > " . $this->db->escape($stockMin);
+ $sql .= " HAVING sum(ps.reel) > ".$this->db->escape($stockMin);
}
}
- $sql.= " ORDER BY " . $orderBy;
+ $sql .= " ORDER BY ".$orderBy;
dol_syslog(get_class($this).'::loadWarehouses', LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -164,16 +164,16 @@ class FormProduct
{
$obj = $this->db->fetch_object($resql);
if ($sumStock) $obj->stock = price2num($obj->stock, 5);
- $this->cache_warehouses[$obj->rowid]['id'] =$obj->rowid;
- $this->cache_warehouses[$obj->rowid]['label']=$obj->label;
- $this->cache_warehouses[$obj->rowid]['parent_id']=$obj->fk_parent;
+ $this->cache_warehouses[$obj->rowid]['id'] = $obj->rowid;
+ $this->cache_warehouses[$obj->rowid]['label'] = $obj->label;
+ $this->cache_warehouses[$obj->rowid]['parent_id'] = $obj->fk_parent;
$this->cache_warehouses[$obj->rowid]['description'] = $obj->description;
$this->cache_warehouses[$obj->rowid]['stock'] = $obj->stock;
$i++;
}
// Full label init
- foreach($this->cache_warehouses as $obj_rowid=>$tab) {
+ foreach ($this->cache_warehouses as $obj_rowid=>$tab) {
$this->cache_warehouses[$obj_rowid]['full_label'] = $this->get_parent_path($tab);
}
@@ -197,11 +197,11 @@ class FormProduct
private function get_parent_path($tab, $final_label = '')
{
//phpcs:enable
- if(empty($final_label)) $final_label = $tab['label'];
+ if (empty($final_label)) $final_label = $tab['label'];
- if(empty($tab['parent_id'])) return $final_label;
+ if (empty($tab['parent_id'])) return $final_label;
else {
- if(!empty($this->cache_warehouses[$tab['parent_id']])) {
+ if (!empty($this->cache_warehouses[$tab['parent_id']])) {
$final_label = $this->cache_warehouses[$tab['parent_id']]['label'].' >> '.$final_label;
return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label);
}
@@ -309,8 +309,8 @@ class FormProduct
print ' | ';
} else {
if ($selected) {
- require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php';
- $warehousestatic=new Entrepot($this->db);
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
+ $warehousestatic = new Entrepot($this->db);
$warehousestatic->fetch($selected);
print $warehousestatic->getNomUrl();
} else {
@@ -357,7 +357,7 @@ class FormProduct
$return = '';
// TODO Use a cache
- require_once DOL_DOCUMENT_ROOT . '/core/class/cunits.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
$measuringUnits = new CUnits($db);
$filter = array();
@@ -392,7 +392,7 @@ class FormProduct
elseif ($mode == 2 && $lines->scale == $default) $return .= ' selected';
elseif ($mode == 0 && $lines->id == $default) $return .= ' selected';
$return .= '>';
- if ($measuring_style == 'time') $return.= $langs->trans(ucfirst($lines->label));
+ if ($measuring_style == 'time') $return .= $langs->trans(ucfirst($lines->label));
else $return .= $langs->trans($lines->label);
$return .= '';
}
@@ -426,11 +426,11 @@ class FormProduct
dol_syslog(get_class($this)."::selectLot $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $fk_entrepot, $empty_label, $forcecombo, $morecss", LOG_DEBUG);
- $out='';
+ $out = '';
$productIdArray = array();
- if (! is_array($objectLines) || ! count($objectLines))
+ if (!is_array($objectLines) || !count($objectLines))
{
- if (! empty($fk_product)) $productIdArray[] = $fk_product;
+ if (!empty($fk_product)) $productIdArray[] = $fk_product;
}
else
{
@@ -515,7 +515,7 @@ class FormProduct
// check cache already loaded for product id's
foreach ($productIdArray as $productId)
{
- $cacheLoaded = ! empty($this->cache_lot[$productId]) ? true : false;
+ $cacheLoaded = !empty($this->cache_lot[$productId]) ? true : false;
}
}
if ($cacheLoaded)
@@ -528,14 +528,14 @@ class FormProduct
$this->cache_lot = array();
$productIdList = implode(',', $productIdArray);
$sql = "SELECT pb.batch, pb.rowid, ps.fk_entrepot, pb.qty, e.ref as label, ps.fk_product";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.rowid = pb.fk_product_stock";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (".getEntity('stock').")";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product_batch as pb";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.rowid = pb.fk_product_stock";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (".getEntity('stock').")";
if (!empty($productIdList))
{
- $sql.= " WHERE ps.fk_product IN (".$productIdList.")";
+ $sql .= " WHERE ps.fk_product IN (".$productIdList.")";
}
- $sql.= " ORDER BY e.ref, pb.batch";
+ $sql .= " ORDER BY e.ref, pb.batch";
dol_syslog(get_class($this).'::loadLotStock', LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -546,10 +546,10 @@ class FormProduct
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
- $this->cache_lot[$obj->fk_product][$obj->rowid]['id'] =$obj->rowid;
- $this->cache_lot[$obj->fk_product][$obj->rowid]['batch']=$obj->batch;
- $this->cache_lot[$obj->fk_product][$obj->rowid]['entrepot_id']=$obj->fk_entrepot;
- $this->cache_lot[$obj->fk_product][$obj->rowid]['entrepot_label']=$obj->label;
+ $this->cache_lot[$obj->fk_product][$obj->rowid]['id'] = $obj->rowid;
+ $this->cache_lot[$obj->fk_product][$obj->rowid]['batch'] = $obj->batch;
+ $this->cache_lot[$obj->fk_product][$obj->rowid]['entrepot_id'] = $obj->fk_entrepot;
+ $this->cache_lot[$obj->fk_product][$obj->rowid]['entrepot_label'] = $obj->label;
$this->cache_lot[$obj->fk_product][$obj->rowid]['qty'] = $obj->qty;
$i++;
}
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index 2659d325676..43821b99b31 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -27,15 +27,15 @@ include_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/inventory/lib/inventory.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("stocks","other"));
+$langs->loadLangs(array("stocks", "other"));
// Get parameters
-$id = GETPOST('id', 'int');
+$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$action = GETPOST('action', 'aZ09');
+$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
-$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectcard'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
@@ -48,28 +48,28 @@ else
}
// Initialize technical objects
-$object=new Inventory($db);
+$object = new Inventory($db);
$extrafields = new ExtraFields($db);
-$diroutputmassaction=$conf->stock->dir_output . '/temp/massgeneration/'.$user->id;
-$hookmanager->initHooks(array('inventorycard')); // Note that conf->hooks_modules contains array
+$diroutputmassaction = $conf->stock->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('inventorycard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
-$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
-$search_all=trim(GETPOST("search_all", 'alpha'));
-$search=array();
-foreach($object->fields as $key => $val)
+$search_all = trim(GETPOST("search_all", 'alpha'));
+$search = array();
+foreach ($object->fields as $key => $val)
{
- if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
+ if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
}
-if (empty($action) && empty($id) && empty($ref)) $action='view';
+if (empty($action) && empty($id) && empty($ref)) $action = 'view';
// Load object
-include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
@@ -92,13 +92,13 @@ else
* Actions
*/
-$parameters=array();
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
- $error=0;
+ $error = 0;
$backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php';
@@ -125,7 +125,7 @@ if (empty($reshook))
* View
*/
-$form=new Form($db);
+$form = new Form($db);
llxHeader('', $langs->trans('Inventory'), '');
@@ -160,10 +160,10 @@ if ($action == 'create')
print ' '."\n";
// Common attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
// Other attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print ' '."\n";
@@ -172,7 +172,7 @@ if ($action == 'create')
print ' ';
print '';
print ' ';
- print ''; // Cancel for create does not post form if we don't know the backtopage
+ print ''; // Cancel for create does not post form if we don't know the backtopage
print ' ';
print '';
@@ -196,10 +196,10 @@ if (($id || $ref) && $action == 'edit')
print ' '."\n";
// Common attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
// Other attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
print ' ';
@@ -224,7 +224,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete') {
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline')
@@ -236,14 +236,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'clone') {
// Create an array for form
$formquestion = array();
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Call Hook formConfirm
$parameters = array('lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
- elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
+ if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
+ elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
// Print form confirm
print $formconfirm;
@@ -251,9 +251,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Object card
// ------------------------------------------------------------
- $linkback = ' ' . $langs->trans("BackToList") . '';
+ $linkback = ' '.$langs->trans("BackToList").'';
- $morehtmlref=' ';
+ $morehtmlref = ' ';
/*
// Ref bis
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', 0, 1);
@@ -293,7 +293,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
*/
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@@ -305,10 +305,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' '."\n";
// Common attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print ' ';
print ' ';
@@ -322,14 +322,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
print ''."\n";
- $parameters=array();
- $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Send
- print ' id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ''."\n";
+ print ' id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').''."\n";
if ($permissiontoadd)
{
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 41e91b04d0c..6f8c5648275 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -33,28 +33,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page
$langs->loadLangs(array('products', 'stocks', 'companies', 'categories'));
-$action=GETPOST('action', 'aZ09');
-$cancel=GETPOST('cancel', 'alpha');
-$confirm=GETPOST('confirm');
+$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'alpha');
+$confirm = GETPOST('confirm');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-if (! $sortfield) $sortfield="p.ref";
-if (! $sortorder) $sortorder="DESC";
+if (!$sortfield) $sortfield = "p.ref";
+if (!$sortorder) $sortorder = "DESC";
-$backtopage=GETPOST('backtopage', 'alpha');
+$backtopage = GETPOST('backtopage', 'alpha');
// Security check
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
-$result=restrictedArea($user, 'stock');
+$result = restrictedArea($user, 'stock');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('warehousecard', 'globalcard'));
@@ -66,7 +66,7 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
-if ($id > 0 || ! empty($ref)) {
+if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref);
// if ($ret > 0)
// $ret = $object->fetch_thirdparty();
@@ -87,8 +87,8 @@ $usercanread = (($user->rights->stock->lire));
$usercancreate = (($user->rights->stock->creer));
$usercandelete = (($user->rights->stock->supprimer));
-$parameters=array('id'=>$id, 'ref'=>$ref);
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array('id'=>$id, 'ref'=>$ref);
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
@@ -106,7 +106,7 @@ if (empty($reshook))
$object->town = GETPOST("town");
$object->country_id = GETPOST("country_id");
- if (! empty($object->libelle))
+ if (!empty($object->libelle))
{
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@@ -115,7 +115,7 @@ if (empty($reshook))
$action = 'create';
}
- if (! $error) {
+ if (!$error) {
$id = $object->create($user);
if ($id > 0) {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
@@ -123,10 +123,10 @@ if (empty($reshook))
$categories = GETPOST('categories', 'array');
$object->setCategories($categories);
if (!empty($backtopage)) {
- header("Location: " . $backtopage);
+ header("Location: ".$backtopage);
exit;
} else {
- header("Location: card.php?id=" . $id);
+ header("Location: card.php?id=".$id);
exit;
}
} else {
@@ -138,7 +138,7 @@ if (empty($reshook))
else
{
setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors');
- $action="create"; // Force retour sur page creation
+ $action = "create"; // Force retour sur page creation
}
}
@@ -146,7 +146,7 @@ if (empty($reshook))
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer)
{
$object->fetch(GETPOST('id', 'int'));
- $result=$object->delete($user);
+ $result = $object->delete($user);
if ($result > 0)
{
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
@@ -156,7 +156,7 @@ if (empty($reshook))
else
{
setEventMessages($object->error, $object->errors, 'errors');
- $action='';
+ $action = '';
}
}
@@ -179,7 +179,7 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++;
- if (! $error) {
+ if (!$error) {
$ret = $object->update($id, $user);
if ($ret < 0) $error++;
}
@@ -205,7 +205,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
if ($ret < 0) $error++;
- if (! $error) {
+ if (!$error) {
$result = $object->insertExtraFields();
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@@ -232,13 +232,13 @@ if (empty($reshook))
* View
*/
-$productstatic=new Product($db);
-$form=new Form($db);
-$formproduct=new FormProduct($db);
-$formcompany=new FormCompany($db);
+$productstatic = new Product($db);
+$form = new Form($db);
+$formproduct = new FormProduct($db);
+$formcompany = new FormCompany($db);
$formfile = new FormFile($db);
-$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
+$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
llxHeader("", $langs->trans("WarehouseCard"), $help_url);
@@ -260,7 +260,7 @@ if ($action == 'create')
// Ref
print ' | '.$langs->trans("Ref").' | | ';
- print ' | '.$langs->trans("LocationSummary").' | | ';
+ print ' | '.$langs->trans("LocationSummary").' | | ';
// Parent entrepot
print ' | '.$langs->trans("AddIn").' | ';
@@ -271,25 +271,25 @@ if ($action == 'create')
print ' | | '.$langs->trans("Description").' | ';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('desc', (!empty($object->description)?$object->description:''), '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%');
+ $doleditor = new DolEditor('desc', (!empty($object->description) ? $object->description : ''), '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
print ' | ';
print ' | '.$langs->trans('Address').' | | ';
// Zip / Town
print ' | '.$langs->trans('Zip').' | ';
- print $formcompany->select_ziptown((!empty($object->zip)?$object->zip:''), 'zipcode', array('town','selectcountry_id','state_id'), 6);
+ print $formcompany->select_ziptown((!empty($object->zip) ? $object->zip : ''), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print ' | ';
print ' | '.$langs->trans('Town').' | ';
- print $formcompany->select_ziptown((!empty($object->town)?$object->town:''), 'town', array('zipcode','selectcountry_id','state_id'));
+ print $formcompany->select_ziptown((!empty($object->town) ? $object->town : ''), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print ' | ';
// Country
print ' | '.$langs->trans('Country').' | ';
- print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code), 'country_id');
+ print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ' | ';
// Status
@@ -310,7 +310,7 @@ if ($action == 'create')
print ' | ';
// Other attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
if ($conf->categorie->enabled) {
// Categories
@@ -324,16 +324,16 @@ if ($action == 'create')
dol_fiche_end();
print '';
- print '';
+ print '';
print ' ';
- print '';
+ print '';
print ' ';
print '';
}
else
{
- $id=GETPOST("id", 'int');
+ $id = GETPOST("id", 'int');
if ($id > 0 || $ref)
{
$object = new Entrepot($db);
@@ -364,8 +364,8 @@ else
// Call Hook formConfirm
$parameters = array();
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
- elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
+ if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
+ elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
// Print form confirm
print $formconfirm;
@@ -399,18 +399,18 @@ else
// Description
print '| '.$langs->trans("Description").' | '.nl2br($object->description).' | ';
- $calcproductsunique=$object->nb_different_products();
- $calcproducts=$object->nb_products();
+ $calcproductsunique = $object->nb_different_products();
+ $calcproducts = $object->nb_products();
// Total nb of different products
print '| '.$langs->trans("NumberOfDifferentProducts").' | ';
- print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb'];
+ print empty($calcproductsunique['nb']) ? '0' : $calcproductsunique['nb'];
print " | ";
// Nb of products
print '| '.$langs->trans("NumberOfProducts").' | ';
- $valtoshow=price2num($calcproducts['nb'], 'MS');
- print empty($valtoshow)?'0':$valtoshow;
+ $valtoshow = price2num($calcproducts['nb'], 'MS');
+ print empty($valtoshow) ? '0' : $valtoshow;
print " | ";
print ' ';
@@ -424,7 +424,7 @@ else
// Value
print '| '.$langs->trans("EstimatedStockValueShort").' | ';
- print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
+ print price((empty($calcproducts['value']) ? '0' : price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
print " | ";
// Last movement
@@ -450,9 +450,9 @@ else
}
// Other attributes
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Categories
- if($conf->categorie->enabled) {
+ if ($conf->categorie->enabled) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, 'warehouse', 1);
print " | ";
@@ -476,8 +476,8 @@ else
print "\n";
- $parameters=array();
- $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
if (empty($action))
@@ -525,16 +525,16 @@ else
}
print "\n";
- $totalunit=0;
- $totalvalue=$totalvaluesell=0;
+ $totalunit = 0;
+ $totalvalue = $totalvaluesell = 0;
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,";
- $sql.= " ps.reel as value";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
- $sql.= " WHERE ps.fk_product = p.rowid";
- $sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
- $sql.= " AND ps.fk_entrepot = ".$object->id;
- $sql.= $db->order($sortfield, $sortorder);
+ $sql .= " ps.reel as value";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
+ $sql .= " WHERE ps.fk_product = p.rowid";
+ $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
+ $sql .= " AND ps.fk_entrepot = ".$object->id;
+ $sql .= $db->order($sortfield, $sortorder);
dol_syslog('List products', LOG_DEBUG);
$resql = $db->query($sql);
@@ -547,13 +547,13 @@ else
$objp = $db->fetch_object($resql);
// Multilangs
- if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
+ if (!empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
{
$sql = "SELECT label";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
- $sql.= " WHERE fk_product=".$objp->rowid;
- $sql.= " AND lang='". $langs->getDefaultLang() ."'";
- $sql.= " LIMIT 1";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
+ $sql .= " WHERE fk_product=".$objp->rowid;
+ $sql .= " AND lang='".$langs->getDefaultLang()."'";
+ $sql .= " LIMIT 1";
$result = $db->query($sql);
if ($result)
@@ -567,12 +567,12 @@ else
//print ' '.dol_print_date($objp->datem).' | ';
print '';
print "| ";
- $productstatic->id=$objp->rowid;
+ $productstatic->id = $objp->rowid;
$productstatic->ref = $objp->ref;
$productstatic->label = $objp->produit;
- $productstatic->type=$objp->type;
- $productstatic->entity=$objp->entity;
- $productstatic->status_batch=$objp->tobatch;
+ $productstatic->type = $objp->type;
+ $productstatic->entity = $objp->entity;
+ $productstatic->status_batch = $objp->tobatch;
print $productstatic->getNomUrl(1, 'stock', 16);
print ' | ';
@@ -580,31 +580,31 @@ else
print ''.$objp->produit.' | ';
print '';
- $valtoshow=price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function
- print empty($valtoshow)?'0':$valtoshow;
+ $valtoshow = price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function
+ print empty($valtoshow) ? '0' : $valtoshow;
print ' | ';
- $totalunit+=$objp->value;
+ $totalunit += $objp->value;
// Price buy PMP
print ''.price(price2num($objp->ppmp, 'MU')).' | ';
// Total PMP
- print ''.price(price2num($objp->ppmp*$objp->value, 'MT')).' | ';
- $totalvalue+=price2num($objp->ppmp*$objp->value, 'MT');
+ print ''.price(price2num($objp->ppmp * $objp->value, 'MT')).' | ';
+ $totalvalue += price2num($objp->ppmp * $objp->value, 'MT');
// Price sell min
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
- $pricemin=$objp->price;
+ $pricemin = $objp->price;
print '';
print price(price2num($pricemin, 'MU'), 1);
print ' | ';
// Total sell min
print '';
- print price(price2num($pricemin*$objp->value, 'MT'), 1);
+ print price(price2num($pricemin * $objp->value, 'MT'), 1);
print ' | ';
}
- $totalvaluesell+=price2num($pricemin*$objp->value, 'MT');
+ $totalvaluesell += price2num($pricemin * $objp->value, 'MT');
if ($user->rights->stock->mouvement->creer)
{
@@ -627,8 +627,8 @@ else
print ' | '.$langs->trans("Total").' | ';
print '';
- $valtoshow=price2num($totalunit, 'MS');
- print empty($valtoshow)?'0':$valtoshow;
+ $valtoshow = price2num($totalunit, 'MS');
+ print empty($valtoshow) ? '0' : $valtoshow;
print ' | ';
print ' | ';
print ''.price(price2num($totalvalue, 'MT')).' | ';
@@ -681,7 +681,7 @@ else
print ' | '.$langs->trans("Description").' | ';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('desc', $object->description, '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%');
+ $doleditor = new DolEditor('desc', $object->description, '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
print ' | ';
@@ -691,15 +691,15 @@ else
// Zip / Town
print '| '.$langs->trans('Zip').' | ';
- print $formcompany->select_ziptown($object->zip, 'zipcode', array('town','selectcountry_id','state_id'), 6);
+ print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print ' | ';
print '| '.$langs->trans('Town').' | ';
- print $formcompany->select_ziptown($object->town, 'town', array('zipcode','selectcountry_id','state_id'));
+ print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print ' | ';
// Country
print '| '.$langs->trans('Country').' | ';
- print $form->select_country($object->country_id?$object->country_id:$mysoc->country_code, 'country_id');
+ print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ' | ';
@@ -721,8 +721,8 @@ else
print '';
// Other attributes
- $parameters=array('colspan' => ' colspan="3"', 'cols'=>3);
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array('colspan' => ' colspan="3"', 'cols'=>3);
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -735,8 +735,8 @@ else
$cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_WAREHOUSE);
- $arrayselected=array();
- foreach($cats as $cat) {
+ $arrayselected = array();
+ foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
@@ -763,7 +763,7 @@ else
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
- $modulepart='stock';
+ $modulepart = 'stock';
if ($action != 'create' && $action != 'edit' && $action != 'delete')
{
@@ -773,28 +773,28 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
// Documents
$objectref = dol_sanitizeFileName($object->ref);
- $relativepath = $comref . '/' . $objectref . '.pdf';
- $filedir = $conf->stock->dir_output . '/' . $objectref;
- $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
- $genallowed=$usercanread;
- $delallowed=$usercancreate;
+ $relativepath = $comref.'/'.$objectref.'.pdf';
+ $filedir = $conf->stock->dir_output.'/'.$objectref;
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
+ $genallowed = $usercanread;
+ $delallowed = $usercancreate;
$modulepart = 'stock';
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
- $somethingshown=$formfile->numoffiles;
+ $somethingshown = $formfile->numoffiles;
print '';
$MAXEVENT = 10;
$morehtmlright = ' ';
- $morehtmlright.= $langs->trans("SeeAll");
- $morehtmlright.= '';
+ $morehtmlright .= $langs->trans("SeeAll");
+ $morehtmlright .= '';
// List of actions on element
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
- $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product
+ $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product
print ' ';
}
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index 60c98d81a60..09273ee947d 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -37,29 +37,29 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-if (! empty($conf->projet->enabled)) {
+if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array('products', 'stocks', 'orders'));
-if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
+if (!empty($conf->productbatch->enabled)) $langs->load("productbatch");
// Security check
-$result=restrictedArea($user, 'stock');
+$result = restrictedArea($user, 'stock');
-$id=GETPOST('id', 'int');
+$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$msid=GETPOST('msid', 'int');
-$product_id=GETPOST("product_id", 'int');
-$action=GETPOST('action', 'aZ09');
-$cancel=GETPOST('cancel', 'alpha');
-$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'movementlist';
+$msid = GETPOST('msid', 'int');
+$product_id = GETPOST("product_id", 'int');
+$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'alpha');
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist';
// Security check
//$result=restrictedArea($user, 'stock', $id, 'entrepot&stock');
-$result=restrictedArea($user, 'stock');
+$result = restrictedArea($user, 'stock');
$idproduct = GETPOST('idproduct', 'int');
$year = GETPOST("year");
@@ -73,18 +73,18 @@ $search_inventorycode = trim(GETPOST("search_inventorycode"));
$search_user = trim(GETPOST("search_user"));
$search_batch = trim(GETPOST("search_batch"));
$search_qty = trim(GETPOST("search_qty"));
-$search_type_mouvement=GETPOST('search_type_mouvement', 'int');
+$search_type_mouvement = GETPOST('search_type_mouvement', 'int');
-$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOST("page", 'int');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
-if (! $sortfield) $sortfield="m.datem";
-if (! $sortorder) $sortorder="DESC";
+if (!$sortfield) $sortfield = "m.datem";
+if (!$sortorder) $sortorder = "DESC";
-$pdluoid=GETPOST('pdluoid', 'int');
+$pdluoid = GETPOST('pdluoid', 'int');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new MouvementStock($db);
@@ -95,17 +95,17 @@ $formfile = new FormFile($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
-$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
-$arrayfields=array(
+$arrayfields = array(
'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100'),
'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1),
- 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))),
- 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))),
- 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(! empty($conf->productbatch->enabled))),
- 'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it
+ 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(!empty($conf->productbatch->enabled))),
+ 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled))),
+ 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))),
+ 'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(!$id > 0)), // If we are on specific warehouse, we hide it
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0),
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1),
@@ -132,11 +132,11 @@ $usercanread = (($user->rights->stock->mouvement->lire));
$usercancreate = (($user->rights->stock->mouvement->creer));
$usercandelete = (($user->rights->stock->mouvement->supprimer));
-if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
+if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
-$parameters=array();
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
@@ -144,45 +144,45 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Do we click on purge search criteria ?
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
{
- $year='';
- $month='';
- $search_ref='';
- $search_movement="";
- $search_type_mouvement="";
- $search_inventorycode="";
- $search_product_ref="";
- $search_product="";
- $search_warehouse="";
- $search_user="";
- $search_batch="";
- $search_qty='';
- $sall="";
- $toselect='';
- $search_array_options=array();
+ $year = '';
+ $month = '';
+ $search_ref = '';
+ $search_movement = "";
+ $search_type_mouvement = "";
+ $search_inventorycode = "";
+ $search_product_ref = "";
+ $search_product = "";
+ $search_warehouse = "";
+ $search_user = "";
+ $search_batch = "";
+ $search_qty = '';
+ $sall = "";
+ $toselect = '';
+ $search_array_options = array();
}
// Correct stock
if ($action == "correct_stock")
{
$product = new Product($db);
- if (! empty($product_id)) $result=$product->fetch($product_id);
+ if (!empty($product_id)) $result = $product->fetch($product_id);
- $error=0;
+ $error = 0;
if (empty($product_id))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors');
- $action='correction';
+ $action = 'correction';
}
- if (! is_numeric($_POST["nbpiece"]))
+ if (!is_numeric($_POST["nbpiece"]))
{
$error++;
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
- $action='correction';
+ $action = 'correction';
}
- if (! $error)
+ if (!$error)
{
$origin_element = '';
$origin_id = null;
@@ -227,7 +227,7 @@ if ($action == "correct_stock")
GETPOST('inventorycode'),
$origin_element,
$origin_id
- ); // We do not change value of stock for a correction
+ ); // We do not change value of stock for a correction
}
if ($result > 0)
@@ -239,72 +239,72 @@ if ($action == "correct_stock")
{
$error++;
setEventMessages($product->error, $product->errors, 'errors');
- $action='correction';
+ $action = 'correction';
}
}
- if (! $error) $action='';
+ if (!$error) $action = '';
}
// Transfer stock from a warehouse to another warehouse
-if ($action == "transfert_stock" && ! $cancel)
+if ($action == "transfert_stock" && !$cancel)
{
$product = new Product($db);
- if (! empty($product_id)) $result=$product->fetch($product_id);
+ if (!empty($product_id)) $result = $product->fetch($product_id);
- if (! (GETPOST("id_entrepot_destination", 'int') > 0))
+ if (!(GETPOST("id_entrepot_destination", 'int') > 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$error++;
- $action='transfert';
+ $action = 'transfert';
}
if (empty($product_id))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors');
- $action='transfert';
+ $action = 'transfert';
}
- if (! GETPOST("nbpiece", 'int'))
+ if (!GETPOST("nbpiece", 'int'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
$error++;
- $action='transfert';
+ $action = 'transfert';
}
if ($id == GETPOST("id_entrepot_destination", 'int'))
{
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
$error++;
- $action='transfert';
+ $action = 'transfert';
}
- if (! empty($conf->productbatch->enabled))
+ if (!empty($conf->productbatch->enabled))
{
$product = new Product($db);
- $result=$product->fetch($product_id);
+ $result = $product->fetch($product_id);
- if ($product->hasbatch() && ! GETPOST("batch_number"))
+ if ($product->hasbatch() && !GETPOST("batch_number"))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors');
$error++;
- $action='transfert';
+ $action = 'transfert';
}
}
- if (! $error)
+ if (!$error)
{
if ($id)
{
$object = new Entrepot($db);
- $result=$object->fetch($id);
+ $result = $object->fetch($id);
$db->begin();
- $product->load_stock('novirtual'); // Load array product->stock_warehouse
+ $product->load_stock('novirtual'); // Load array product->stock_warehouse
// Define value of products moved
- $pricesrc=0;
- if (isset($product->pmp)) $pricesrc=$product->pmp;
- $pricedest=$pricesrc;
+ $pricesrc = 0;
+ if (isset($product->pmp)) $pricesrc = $product->pmp;
+ $pricedest = $pricesrc;
if ($product->hasbatch())
{
@@ -312,13 +312,13 @@ if ($action == "transfert_stock" && ! $cancel)
if ($pdluoid > 0)
{
- $result=$pdluo->fetch($pdluoid);
+ $result = $pdluo->fetch($pdluoid);
if ($result)
{
- $srcwarehouseid=$pdluo->warehouseid;
- $batch=$pdluo->batch;
- $eatby=$pdluo->eatby;
- $sellby=$pdluo->sellby;
+ $srcwarehouseid = $pdluo->warehouseid;
+ $batch = $pdluo->batch;
+ $eatby = $pdluo->eatby;
+ $sellby = $pdluo->sellby;
}
else
{
@@ -328,16 +328,16 @@ if ($action == "transfert_stock" && ! $cancel)
}
else
{
- $srcwarehouseid=$id;
- $batch=GETPOST('batch_number');
- $eatby=$d_eatby;
- $sellby=$d_sellby;
+ $srcwarehouseid = $id;
+ $batch = GETPOST('batch_number');
+ $eatby = $d_eatby;
+ $sellby = $d_sellby;
}
- if (! $error)
+ if (!$error)
{
// Remove stock
- $result1=$product->correct_stock_batch(
+ $result1 = $product->correct_stock_batch(
$user,
$srcwarehouseid,
GETPOST("nbpiece", 'int'),
@@ -348,7 +348,7 @@ if ($action == "transfert_stock" && ! $cancel)
GETPOST('inventorycode')
);
// Add stock
- $result2=$product->correct_stock_batch(
+ $result2 = $product->correct_stock_batch(
$user,
GETPOST("id_entrepot_destination", 'int'),
GETPOST("nbpiece", 'int'),
@@ -363,7 +363,7 @@ if ($action == "transfert_stock" && ! $cancel)
else
{
// Remove stock
- $result1=$product->correct_stock(
+ $result1 = $product->correct_stock(
$user,
$id,
GETPOST("nbpiece"),
@@ -374,7 +374,7 @@ if ($action == "transfert_stock" && ! $cancel)
);
// Add stock
- $result2=$product->correct_stock(
+ $result2 = $product->correct_stock(
$user,
GETPOST("id_entrepot_destination"),
GETPOST("nbpiece"),
@@ -384,7 +384,7 @@ if ($action == "transfert_stock" && ! $cancel)
GETPOST('inventorycode')
);
}
- if (! $error && $result1 >= 0 && $result2 >= 0)
+ if (!$error && $result1 >= 0 && $result2 >= 0)
{
$db->commit();
@@ -403,7 +403,7 @@ if ($action == "transfert_stock" && ! $cancel)
{
setEventMessages($product->error, $product->errors, 'errors');
$db->rollback();
- $action='transfert';
+ $action = 'transfert';
}
}
}
@@ -484,9 +484,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
}
}
-if(empty($search_inventorycode))
+if (empty($search_inventorycode))
{
- $sql.= $db->plimit($limit+1, $offset);
+ $sql .= $db->plimit($limit + 1, $offset);
}
else
{
@@ -497,7 +497,7 @@ else
$resql = $db->query($sql);
-if(!empty($search_inventorycode)) $limit = $db->num_rows($resql);
+if (!empty($search_inventorycode)) $limit = $db->num_rows($resql);
if ($resql)
{
@@ -519,16 +519,16 @@ if ($resql)
$num = $db->num_rows($resql);
- $arrayofselected=is_array($toselect)?$toselect:array();
+ $arrayofselected = is_array($toselect) ? $toselect : array();
$i = 0;
- $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
+ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
if ($msid) $texte = $langs->trans('StockMovementForId', $msid);
else
{
$texte = $langs->trans("ListOfStockMovements");
- if ($id) $texte.=' ('.$langs->trans("ForThisWarehouse").')';
+ if ($id) $texte .= ' ('.$langs->trans("ForThisWarehouse").')';
}
llxHeader("", $texte, $help_url);
@@ -565,18 +565,18 @@ if ($resql)
// Description
print ''.$langs->trans("Description").' | '.dol_htmlentitiesbr($object->description).' | ';
- $calcproductsunique=$object->nb_different_products();
- $calcproducts=$object->nb_products();
+ $calcproductsunique = $object->nb_different_products();
+ $calcproducts = $object->nb_products();
// Total nb of different products
print '| '.$langs->trans("NumberOfDifferentProducts").' | ';
- print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb'];
+ print empty($calcproductsunique['nb']) ? '0' : $calcproductsunique['nb'];
print " | ";
// Nb of products
print '| '.$langs->trans("NumberOfProducts").' | ';
- $valtoshow=price2num($calcproducts['nb'], 'MS');
- print empty($valtoshow)?'0':$valtoshow;
+ $valtoshow = price2num($calcproducts['nb'], 'MS');
+ print empty($valtoshow) ? '0' : $valtoshow;
print " | ";
print ' ';
@@ -590,7 +590,7 @@ if ($resql)
// Value
print ' | '.$langs->trans("EstimatedStockValueShort").' | ';
- print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
+ print price((empty($calcproducts['value']) ? '0' : price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
print " | ";
// Last movement
@@ -601,7 +601,7 @@ if ($resql)
if ($resqlbis)
{
$obj = $db->fetch_object($resqlbis);
- $lastmovementdate=$db->jdate($obj->datem);
+ $lastmovementdate = $db->jdate($obj->datem);
}
else
{
@@ -673,32 +673,32 @@ if ($resql)
print ' ';
}
- $param='';
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
- if ($id > 0) $param.='&id='.$id;
- if ($search_movement) $param.='&search_movement='.urlencode($search_movement);
- if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode);
- if ($search_type_mouvement) $param.='&search_type_mouvement='.urlencode($search_type_mouvement);
- if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref);
- if ($search_product) $param.='&search_product='.urlencode($search_product);
- if ($search_batch) $param.='&search_batch='.urlencode($search_batch);
- if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse);
- if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined
- if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined
- if ($search_user) $param.='&search_user='.urlencode($search_user);
- if ($idproduct > 0) $param.='&idproduct='.$idproduct;
+ $param = '';
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
+ if ($id > 0) $param .= '&id='.$id;
+ if ($search_movement) $param .= '&search_movement='.urlencode($search_movement);
+ if ($search_inventorycode) $param .= '&search_inventorycode='.urlencode($search_inventorycode);
+ if ($search_type_mouvement) $param .= '&search_type_mouvement='.urlencode($search_type_mouvement);
+ if ($search_product_ref) $param .= '&search_product_ref='.urlencode($search_product_ref);
+ if ($search_product) $param .= '&search_product='.urlencode($search_product);
+ if ($search_batch) $param .= '&search_batch='.urlencode($search_batch);
+ if ($search_warehouse > 0) $param .= '&search_warehouse='.urlencode($search_warehouse);
+ if (!empty($sref)) $param .= '&sref='.urlencode($sref); // FIXME $sref is not defined
+ if (!empty($snom)) $param .= '&snom='.urlencode($snom); // FIXME $snom is not defined
+ if ($search_user) $param .= '&search_user='.urlencode($search_user);
+ if ($idproduct > 0) $param .= '&idproduct='.$idproduct;
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
- $arrayofmassactions = array(
+ $arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"),
);
//if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']=' '.$langs->trans("Delete");
- if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
- $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
+ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
+ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print ' ';
if ($optioncss != '') print '';
@@ -717,147 +717,147 @@ if ($resql)
if ($sall)
{
- foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
- print ''.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).' ';
+ foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
+ print ''.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).' ';
}
- $moreforfilter='';
+ $moreforfilter = '';
- $parameters=array();
- $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
- if (! empty($moreforfilter))
+ if (!empty($moreforfilter))
{
print '';
print $moreforfilter;
print ' ';
}
- $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
- $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '';
- print ' '."\n";
+ print ''."\n";
// Fields title search
print '';
- if (! empty($arrayfields['m.rowid']['checked']))
+ if (!empty($arrayfields['m.rowid']['checked']))
{
// Ref
print '| ';
print '';
print ' | ';
}
- if (! empty($arrayfields['m.datem']['checked']))
+ if (!empty($arrayfields['m.datem']['checked']))
{
print '';
print '';
if (empty($conf->productbatch->enabled)) print ' ';
//else print ' ';
- $syear = $year?$year:-1;
+ $syear = $year ? $year : -1;
print '';
//print $formother->selectyear($syear,'year',1, 20, 5);
print ' | ';
}
- if (! empty($arrayfields['p.ref']['checked']))
+ if (!empty($arrayfields['p.ref']['checked']))
{
// Product Ref
print '';
- print '';
+ print '';
print ' | ';
}
- if (! empty($arrayfields['p.label']['checked']))
+ if (!empty($arrayfields['p.label']['checked']))
{
// Product label
print '';
- print '';
+ print '';
print ' | ';
}
// Batch
- if (! empty($arrayfields['m.batch']['checked']))
+ if (!empty($arrayfields['m.batch']['checked']))
{
print ' | ';
}
- if (! empty($arrayfields['pl.eatby']['checked']))
+ if (!empty($arrayfields['pl.eatby']['checked']))
{
print '';
print ' | ';
}
- if (! empty($arrayfields['pl.sellby']['checked']))
+ if (!empty($arrayfields['pl.sellby']['checked']))
{
print '';
print ' | ';
}
// Warehouse
- if (! empty($arrayfields['e.ref']['checked']))
+ if (!empty($arrayfields['e.ref']['checked']))
{
print '';
//print '';
print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print ' | ';
}
- if (! empty($arrayfields['m.fk_user_author']['checked']))
+ if (!empty($arrayfields['m.fk_user_author']['checked']))
{
// Author
print '';
print '';
print ' | ';
}
- if (! empty($arrayfields['m.inventorycode']['checked']))
+ if (!empty($arrayfields['m.inventorycode']['checked']))
{
// Inventory code
print '';
print '';
print ' | ';
}
- if (! empty($arrayfields['m.label']['checked']))
+ if (!empty($arrayfields['m.label']['checked']))
{
// Label of movement
print '';
print '';
print ' | ';
}
- if (! empty($arrayfields['m.type_mouvement']['checked']))
+ if (!empty($arrayfields['m.type_mouvement']['checked']))
{
// Type of movement
print '';
//print '';
print '';
- print '';
- print ''.$langs->trans('StockIncreaseAfterCorrectTransfer').'';
- print ''.$langs->trans('StockDecreaseAfterCorrectTransfer').'';
- print ''.$langs->trans('StockDecrease').'';
- print ''.$langs->trans('StockIncrease').'';
+ print '';
+ print ''.$langs->trans('StockIncreaseAfterCorrectTransfer').'';
+ print ''.$langs->trans('StockDecreaseAfterCorrectTransfer').'';
+ print ''.$langs->trans('StockDecrease').'';
+ print ''.$langs->trans('StockIncrease').'';
print '';
print ajax_combobox('search_type_mouvement');
// TODO: add new function $formentrepot->selectTypeOfMovement(...) like
// print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print ' | ';
}
- if (! empty($arrayfields['origin']['checked']))
+ if (!empty($arrayfields['origin']['checked']))
{
// Origin of movement
print '';
print ' ';
print ' | ';
}
- if (! empty($arrayfields['m.value']['checked']))
+ if (!empty($arrayfields['m.value']['checked']))
{
// Qty
print '';
print '';
print ' | ';
}
- if (! empty($arrayfields['m.price']['checked']))
+ if (!empty($arrayfields['m.price']['checked']))
{
// Price
print '';
print ' ';
print ' | ';
}
- if (! empty($arrayfields['m.fk_projet']['checked']))
+ if (!empty($arrayfields['m.fk_projet']['checked']))
{
// fk_project
print '';
@@ -870,76 +870,76 @@ if ($resql)
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
- $parameters=array('arrayfields'=>$arrayfields);
- $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
+ $parameters = array('arrayfields'=>$arrayfields);
+ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
- if (! empty($arrayfields['m.datec']['checked']))
+ if (!empty($arrayfields['m.datec']['checked']))
{
print ' | ';
print ' | ';
}
// Date modification
- if (! empty($arrayfields['m.tms']['checked']))
+ if (!empty($arrayfields['m.tms']['checked']))
{
print '';
print ' | ';
}
// Actions
print '';
- $searchpicto=$form->showFilterAndCheckAddButtons(0);
+ $searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print ' | ';
print " \n";
print '';
- if (! empty($arrayfields['m.rowid']['checked'])) {
+ if (!empty($arrayfields['m.rowid']['checked'])) {
print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
}
- if (! empty($arrayfields['m.datem']['checked'])) {
+ if (!empty($arrayfields['m.datem']['checked'])) {
print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
}
- if (! empty($arrayfields['p.ref']['checked'])) {
+ if (!empty($arrayfields['p.ref']['checked'])) {
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
}
- if (! empty($arrayfields['p.label']['checked'])) {
+ if (!empty($arrayfields['p.label']['checked'])) {
print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
}
- if (! empty($arrayfields['m.batch']['checked'])) {
+ if (!empty($arrayfields['m.batch']['checked'])) {
print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center ');
}
- if (! empty($arrayfields['pl.eatby']['checked'])) {
+ if (!empty($arrayfields['pl.eatby']['checked'])) {
print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center ');
}
- if (! empty($arrayfields['pl.sellby']['checked'])) {
+ if (!empty($arrayfields['pl.sellby']['checked'])) {
print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center ');
}
- if (! empty($arrayfields['e.ref']['checked'])) {
+ if (!empty($arrayfields['e.ref']['checked'])) {
// We are on a specific warehouse card, no filter on other should be possible
print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder);
}
- if (! empty($arrayfields['m.fk_user_author']['checked'])) {
+ if (!empty($arrayfields['m.fk_user_author']['checked'])) {
print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
}
- if (! empty($arrayfields['m.inventorycode']['checked'])) {
+ if (!empty($arrayfields['m.inventorycode']['checked'])) {
print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
}
- if (! empty($arrayfields['m.label']['checked'])) {
+ if (!empty($arrayfields['m.label']['checked'])) {
print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
}
- if (! empty($arrayfields['m.type_mouvement']['checked'])) {
+ if (!empty($arrayfields['m.type_mouvement']['checked'])) {
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center ');
}
- if (! empty($arrayfields['origin']['checked'])) {
+ if (!empty($arrayfields['origin']['checked'])) {
print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
}
- if (! empty($arrayfields['m.value']['checked'])) {
+ if (!empty($arrayfields['m.value']['checked'])) {
print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right ');
}
- if (! empty($arrayfields['m.price']['checked'])) {
+ if (!empty($arrayfields['m.price']['checked'])) {
print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right ');
}
- if (! empty($arrayfields['m.fk_projet']['checked'])) {
+ if (!empty($arrayfields['m.fk_projet']['checked'])) {
print_liste_field_titre($arrayfields['m.fk_projet']['label'], $_SERVER["PHP_SELF"], "m.fk_projet", "", $param, 'align="right"', $sortfield, $sortorder);
}
@@ -1001,23 +1001,23 @@ if ($resql)
print ' ';
// Id movement
- if (! empty($arrayfields['m.rowid']['checked']))
+ if (!empty($arrayfields['m.rowid']['checked']))
{
- print '| '.$objp->mid.' | '; // This is primary not movement id
+ print ''.$objp->mid.' | '; // This is primary not movement id
}
- if (! empty($arrayfields['m.datem']['checked']))
+ if (!empty($arrayfields['m.datem']['checked']))
{
// Date
print ''.dol_print_date($db->jdate($objp->datem), 'dayhour').' | ';
}
- if (! empty($arrayfields['p.ref']['checked']))
+ if (!empty($arrayfields['p.ref']['checked']))
{
// Product ref
print '';
print $productstatic->getNomUrl(1, 'stock', 16);
print " | \n";
}
- if (! empty($arrayfields['p.label']['checked']))
+ if (!empty($arrayfields['p.label']['checked']))
{
// Product label
print '';
@@ -1028,36 +1028,36 @@ if ($resql)
print $productstatic->label;
print " | \n";
}
- if (! empty($arrayfields['m.batch']['checked']))
+ if (!empty($arrayfields['m.batch']['checked']))
{
print '';
if ($productlot->id > 0) print $productlot->getNomUrl(1);
- else print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
+ else print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
print ' | ';
}
- if (! empty($arrayfields['pl.eatby']['checked']))
+ if (!empty($arrayfields['pl.eatby']['checked']))
{
- print ''. dol_print_date($objp->eatby, 'day') .' | ';
+ print ''.dol_print_date($objp->eatby, 'day').' | ';
}
- if (! empty($arrayfields['pl.sellby']['checked']))
+ if (!empty($arrayfields['pl.sellby']['checked']))
{
- print ''. dol_print_date($objp->sellby, 'day') .' | ';
+ print ''.dol_print_date($objp->sellby, 'day').' | ';
}
// Warehouse
- if (! empty($arrayfields['e.ref']['checked']))
+ if (!empty($arrayfields['e.ref']['checked']))
{
print '';
print $warehousestatic->getNomUrl(1);
print " | \n";
}
// Author
- if (! empty($arrayfields['m.fk_user_author']['checked']))
+ if (!empty($arrayfields['m.fk_user_author']['checked']))
{
print '';
print $userstatic->getNomUrl(-1);
print " | \n";
}
- if (! empty($arrayfields['m.inventorycode']['checked']))
+ if (!empty($arrayfields['m.inventorycode']['checked']))
{
// Inventory code
print ''.''.$objp->label.' | ';
}
- if (! empty($arrayfields['m.type_mouvement']['checked']))
+ if (!empty($arrayfields['m.type_mouvement']['checked']))
{
// Type of movement
- switch($objp->type_mouvement){
+ switch ($objp->type_mouvement) {
case "0":
print ''.$langs->trans('StockIncreaseAfterCorrectTransfer').' | ';
break;
@@ -1093,12 +1093,12 @@ if ($resql)
break;
}
}
- if (! empty($arrayfields['origin']['checked']))
+ if (!empty($arrayfields['origin']['checked']))
{
// Origin of movement
print ''.$origin.' | ';
}
- if (! empty($arrayfields['m.value']['checked']))
+ if (!empty($arrayfields['m.value']['checked']))
{
// Qty
print '';
@@ -1106,14 +1106,14 @@ if ($resql)
print $objp->qty;
print ' | ';
}
- if (! empty($arrayfields['m.price']['checked']))
+ if (!empty($arrayfields['m.price']['checked']))
{
// Price
print '';
if ($objp->price != 0) print price($objp->price);
print ' | ';
}
- if (! empty($arrayfields['m.fk_projet']['checked']))
+ if (!empty($arrayfields['m.fk_projet']['checked']))
{
// fk_project
print '';
@@ -1124,12 +1124,12 @@ if ($resql)
print ' | ';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
- $selected=0;
- if (in_array($obj->rowid, $arrayofselected)) $selected=1;
- print '';
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
+ print '';
}
print ' | ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
print " \n";
$i++;
@@ -1145,16 +1145,16 @@ if ($resql)
{
print " ";
- $productidselected=0;
+ $productidselected = 0;
foreach ($arrayofuniqueproduct as $key => $val)
{
- $productidselected=$key;
- $productlabelselected=$val;
+ $productidselected = $key;
+ $productlabelselected = $val;
}
- $datebefore=dol_get_first_day($year?$year:strftime("%Y", time()), $month?$month:1, true);
- $dateafter=dol_get_last_day($year?$year:strftime("%Y", time()), $month?$month:12, true);
- $balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore);
- $balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter);
+ $datebefore = dol_get_first_day($year ? $year : strftime("%Y", time()), $month ? $month : 1, true);
+ $dateafter = dol_get_last_day($year ? $year : strftime("%Y", time()), $month ? $month : 12, true);
+ $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
+ $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
//print '';
print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt'));
diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php
index 77dcaa641d2..fffab036d2d 100644
--- a/htdocs/projet/activity/perday.php
+++ b/htdocs/projet/activity/perday.php
@@ -115,9 +115,9 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
// Definition of fields for list
-$arrayfields=array();
-$arrayfields['t.planned_workload']=array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0);
-$arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0);
+$arrayfields = array();
+$arrayfields['t.planned_workload'] = array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0);
+$arrayfields['t.progress'] = array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0);
/*$arrayfields=array(
// Project
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103),
@@ -130,17 +130,17 @@ $arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'ena
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
- foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
- if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
- $arrayfields["efpt.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
+ if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
+ $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$arrayfields = dol_sort_array($arrayfields, 'position');
-$search_array_options_project=$extrafields->getOptionalsFromPost($project->table_element, '', 'search_');
-$search_array_options_task=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_task_');
+$search_array_options_project = $extrafields->getOptionalsFromPost($project->table_element, '', 'search_');
+$search_array_options_task = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_task_');
/*
@@ -151,7 +151,7 @@ $search_array_options_task=$extrafields->getOptionalsFromPost($object->table_ele
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$action = '';
- $search_categ='';
+ $search_categ = '';
$search_usertoprocessid = $user->id;
$search_task_ref = '';
$search_task_label = '';
@@ -163,7 +163,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_array_options_task = array();
// We redefine $usertoprocess
- $usertoprocess=$user;
+ $usertoprocess = $user;
}
if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha'))
{
@@ -196,35 +196,35 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
$error++;
}
- if (! GETPOST('type'))
+ if (!GETPOST('type'))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
$error++;
}
- if (! $error)
+ if (!$error)
{
- $idfortaskuser=$usertoprocess->id;
+ $idfortaskuser = $usertoprocess->id;
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
{
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
- $sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
- $sql.=' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
- $resql=$db->query($sql);
+ $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
+ $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
+ $resql = $db->query($sql);
if ($resql)
{
- $obj=$db->fetch_object($resql);
- if (! $obj) // User is not already linked to project, so we will create link to first type
+ $obj = $db->fetch_object($resql);
+ if (!$obj) // User is not already linked to project, so we will create link to first type
{
$project = new Project($db);
$project->fetch($object->fk_project);
// Get type
- $listofprojcontact=$project->liste_type_contact('internal');
+ $listofprojcontact = $project->liste_type_contact('internal');
if (count($listofprojcontact))
{
- $typeforprojectcontact=reset(array_keys($listofprojcontact));
+ $typeforprojectcontact = reset(array_keys($listofprojcontact));
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
}
}
@@ -250,22 +250,22 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
}
}
- if (! $error)
+ if (!$error)
{
setEventMessages("TaskAssignedToEnterTime", null);
- $taskid=0;
+ $taskid = 0;
}
- $action='';
+ $action = '';
}
if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilteraction') != 'listafterchangingselectedfields')
{
- $timespent_duration=array();
+ $timespent_duration = array();
if (is_array($_POST))
{
- foreach($_POST as $key => $time)
+ foreach ($_POST as $key => $time)
{
if (intval($time) > 0)
{
@@ -276,10 +276,10 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
if ($id > 0)
{
// We store HOURS in seconds
- if($matches[2]=='hour') $timespent_duration[$id] += $time*60*60;
+ if ($matches[2] == 'hour') $timespent_duration[$id] += $time * 60 * 60;
// We store MINUTES in seconds
- if($matches[2]=='min') $timespent_duration[$id] += $time*60;
+ if ($matches[2] == 'min') $timespent_duration[$id] += $time * 60;
}
}
}
@@ -288,11 +288,11 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
if (count($timespent_duration) > 0)
{
- foreach($timespent_duration as $key => $val)
+ foreach ($timespent_duration as $key => $val)
{
$object->fetch($key);
- if (GETPOSTISSET($taskid . 'progress')) $object->progress = GETPOST($taskid . 'progress', 'int');
+ if (GETPOSTISSET($taskid.'progress')) $object->progress = GETPOST($taskid.'progress', 'int');
else unset($object->progress);
$object->timespent_duration = $val;
@@ -311,7 +311,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
if ($object->timespent_date > 0)
{
- $result=$object->addTimeSpent($user);
+ $result = $object->addTimeSpent($user);
}
else
{
@@ -328,12 +328,12 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
}
}
- if (! $error)
+ if (!$error)
{
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
// Redirect to avoid submit twice on back
- header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
+ header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid ? 'id='.$projectid : '').($search_usertoprocessid ? '&search_usertoprocessid='.$search_usertoprocessid : '').($mode ? '&mode='.$mode : '').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
exit;
}
}
@@ -349,11 +349,11 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
* View
*/
-$form=new Form($db);
+$form = new Form($db);
$formother = new FormOther($db);
-$formcompany=new FormCompany($db);
-$formproject=new FormProjets($db);
-$projectstatic=new Project($db);
+$formcompany = new FormCompany($db);
+$formproject = new FormProjets($db);
+$projectstatic = new Project($db);
$project = new Project($db);
$taskstatic = new Task($db);
$thirdpartystatic = new Societe($db);
@@ -369,9 +369,9 @@ $next_year = $next['year'];
$next_month = $next['mon'];
$next_day = $next['mday'];
-$title=$langs->trans("TimeSpent");
+$title = $langs->trans("TimeSpent");
-$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id)?2:0), 1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
+$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
if ($id)
{
@@ -379,14 +379,14 @@ if ($id)
$project->fetch_thirdparty();
}
-$onlyopenedproject=1; // or -1
-$morewherefilter='';
+$onlyopenedproject = 1; // or -1
+$morewherefilter = '';
-if ($search_project_ref) $morewherefilter.=natural_search(array("p.ref", "p.title"), $search_project_ref);
-if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
-if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label);
-if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
-if ($search_declared_progress) $morewherefilter.=natural_search("t.progress", $search_declared_progress, 1);
+if ($search_project_ref) $morewherefilter .= natural_search(array("p.ref", "p.title"), $search_project_ref);
+if ($search_task_ref) $morewherefilter .= natural_search("t.ref", $search_task_ref);
+if ($search_task_label) $morewherefilter .= natural_search(array("t.ref", "t.label"), $search_task_label);
+if ($search_thirdparty) $morewherefilter .= natural_search("s.nom", $search_thirdparty);
+if ($search_declared_progress) $morewherefilter .= natural_search("t.progress", $search_declared_progress, 1);
$sql = &$morewherefilter;
@@ -397,18 +397,18 @@ $extrafieldsobjectkey='projet';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
*/
$search_array_options = $search_array_options_task;
-$extrafieldsobjectprefix='efpt.';
-$search_options_pattern='search_task_options_';
-$extrafieldsobjectkey='projet_task';
+$extrafieldsobjectprefix = 'efpt.';
+$search_options_pattern = 'search_task_options_';
+$extrafieldsobjectkey = 'projet_task';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
-$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0), 0, $extrafields); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
+$tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
if ($morewherefilter) // Get all task without any filter, so we can show total of time spent for not visible tasks
{
- $tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
+ $tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid ? $search_usertoprocessid : 0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
}
-$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
-$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
+$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
+$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
//var_dump($usertoprocess);
//var_dump($projectsrole);
//var_dump($taskrole);
@@ -417,33 +417,33 @@ llxHeader("", $title, "", '', '', '', array('/core/js/timesheet.js'));
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'project');
-$param='';
-$param.=($mode?'&mode='.urlencode($mode):'');
-$param.=($search_project_ref?'&search_project_ref='.urlencode($search_project_ref):'');
-$param.=($search_usertoprocessid?'&search_usertoprocessid='.urlencode($search_usertoprocessid):'');
-$param.=($search_thirdparty?'&search_thirdparty='.urlencode($search_thirdparty):'');
-$param.=($search_task_ref?'&search_task_ref='.urlencode($search_task_ref):'');
-$param.=($search_task_label?'&search_task_label='.urlencode($search_task_label):'');
+$param = '';
+$param .= ($mode ? '&mode='.urlencode($mode) : '');
+$param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
+$param .= ($search_usertoprocessid ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : '');
+$param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
+$param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
+$param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
/*$search_array_options=$search_array_options_project;
$search_options_pattern='search_options_';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
*/
-$search_array_options=$search_array_options_task;
-$search_options_pattern='search_task_options_';
+$search_array_options = $search_array_options_task;
+$search_options_pattern = 'search_task_options_';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Show navigation bar
-$nav =''.img_previous($langs->trans("Previous"))."\n";
-$nav.=dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "%A").' ';
-$nav.=" ".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "day")." \n";
-$nav.=''.img_next($langs->trans("Next"))."\n";
-$nav.=" (".$langs->trans("Today").")";
-$nav.=' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 0).' ';
-$nav.=' ';
+$nav = ''.img_previous($langs->trans("Previous"))."\n";
+$nav .= dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "%A").' ';
+$nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "day")." \n";
+$nav .= ''.img_next($langs->trans("Next"))."\n";
+$nav .= " (".$langs->trans("Today").")";
+$nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 0).' ';
+$nav .= ' ';
-$picto='calendarweek';
+$picto = 'calendarweek';
print 'id > 0 ? '?id='.$project->id : '').'">';
print '';
@@ -456,18 +456,18 @@ print '';
print '';
print '';
-$head=project_timesheet_prepare_head($mode, $usertoprocess);
+$head = project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, 'task');
// Show description of content
print '';
-if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').' ';
+if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
else
{
if (empty($usertoprocess->id) || $usertoprocess->id < 0)
{
- if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').' ';
- else print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').' ';
+ if ($user->rights->projet->all->lire && !$socid) print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
+ else print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
}
}
if ($mine || ($usertoprocess->id == $user->id))
@@ -482,13 +482,13 @@ print ' ';
dol_fiche_end();
-print ''.$nav.' '; // We move this before the assign to components so, the default submit button is not the assign to.
+print ''.$nav.' '; // We move this before the assign to components so, the default submit button is not the assign to.
print '';
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
print ' ';
-$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1, 0, 0, '', '', 'all', $usertoprocess);
+$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, 1, 1, 0, 0, '', '', 'all', $usertoprocess);
print ' ';
print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
@@ -498,7 +498,7 @@ print ' ';
print '';
-$moreforfilter='';
+$moreforfilter = '';
// Filter on categories
/*if (! empty($conf->categorie->enabled))
@@ -511,66 +511,66 @@ $moreforfilter='';
}*/
// If the user can view user other than himself
-$moreforfilter.='';
-$moreforfilter.=' '.$langs->trans('User'). ' ';
-$includeonly='hierarchyme';
-if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
-$moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly');
-$moreforfilter.=' ';
+$moreforfilter .= '';
+$moreforfilter .= ' '.$langs->trans('User').' ';
+$includeonly = 'hierarchyme';
+if (empty($user->rights->user->user->lire)) $includeonly = array($user->id);
+$moreforfilter .= $form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly');
+$moreforfilter .= ' ';
if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
- $moreforfilter.='';
- $moreforfilter.=' '.$langs->trans('Project'). ' ';
- $moreforfilter.=' ';
- $moreforfilter.=' ';
+ $moreforfilter .= '';
+ $moreforfilter .= ' '.$langs->trans('Project').' ';
+ $moreforfilter .= ' ';
+ $moreforfilter .= ' ';
- $moreforfilter.='';
- $moreforfilter.=' '.$langs->trans('ThirdParty'). ' ';
- $moreforfilter.=' ';
- $moreforfilter.=' ';
+ $moreforfilter .= '';
+ $moreforfilter .= ' '.$langs->trans('ThirdParty').' ';
+ $moreforfilter .= ' ';
+ $moreforfilter .= ' ';
}
-if (! empty($moreforfilter))
+if (!empty($moreforfilter))
{
print '';
print $moreforfilter;
- $parameters=array();
- $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print ' ';
}
-$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
-$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
// This must be after the $selectedfields
-$addcolspan=0;
-if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++;
-if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++;
+$addcolspan = 0;
+if (!empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++;
+if (!empty($arrayfields['t.progress']['checked'])) $addcolspan++;
foreach ($arrayfields as $key => $val)
{
if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++;
}
print '';
-print ' '."\n";
+print ''."\n";
print '';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
print ' | ';
// TASK fields
-$search_options_pattern='search_task_options_';
-$extrafieldsobjectkey='projet_task';
-$extrafieldsobjectprefix='efpt.';
+$search_options_pattern = 'search_task_options_';
+$extrafieldsobjectkey = 'projet_task';
+$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
print ' | ';
-if (! empty($arrayfields['t.planned_workload']['checked']))
+if (!empty($arrayfields['t.planned_workload']['checked']))
{
print ' | ';
}
-if (! empty($arrayfields['t.progress']['checked']))
+if (!empty($arrayfields['t.progress']['checked']))
{
print ' | ';
}
@@ -580,24 +580,24 @@ print ' | ';
print ' | ';
// Action column
print '';
-$searchpicto=$form->showFilterAndCheckAddButtons(0);
+$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print ' | ';
print " \n";
print '';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print '| '.$langs->trans("Project").' | ';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''.$langs->trans("ThirdParty").' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''.$langs->trans("Project").' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''.$langs->trans("ThirdParty").' | ';
print ''.$langs->trans("Task").' | ';
// TASK fields
-$extrafieldsobjectkey='projet_task';
-$extrafieldsobjectprefix='efpt.';
+$extrafieldsobjectkey = 'projet_task';
+$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
-if (! empty($arrayfields['t.planned_workload']['checked']))
+if (!empty($arrayfields['t.planned_workload']['checked']))
{
print ''.$langs->trans("PlannedWorkload").' | ';
}
-if (! empty($arrayfields['t.progress']['checked']))
+if (!empty($arrayfields['t.progress']['checked']))
{
print ''.$langs->trans("ProgressDeclared").' | ';
}
@@ -605,17 +605,17 @@ if (! empty($arrayfields['t.progress']['checked']))
if ($usertoprocess->id == $user->id) print ''.$langs->trans("TimeSpentByYou").' | ';
else print ''.$langs->trans("TimeSpentByUser").' | ';*/
print ''.$langs->trans("TimeSpent").' ('.$langs->trans("Everybody").') | ';
-print ''.$langs->trans("TimeSpent").($usertoprocess->firstname?' ('.dol_trunc($usertoprocess->firstname, 10).')':'').' | ';
+print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? ' ('.dol_trunc($usertoprocess->firstname, 10).')' : '').' | ';
print ''.$langs->trans("HourStart").'';
// By default, we can edit only tasks we are assigned to
-$restrictviewformytask=((! isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
+$restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
// Get if user is available or not for each day
-$isavailable=array();
-if (! empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
+$isavailable = array();
+if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
{
- $tmparray=explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
+ $tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
if (count($tmparray) >= 2)
{
$numstartworkingday = $tmparray[0];
@@ -624,59 +624,59 @@ if (! empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
}
$statusofholidaytocheck = '3';
-$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0
-$isavailable[$daytoparse]=$isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
+$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0
+$isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
-$tmparray = dol_getdate($daytoparse, true); // detail of current day
+$tmparray = dol_getdate($daytoparse, true); // detail of current day
$idw = $tmparray['wday'];
-$cssweekend='';
+$cssweekend = '';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
- $cssweekend='weekend';
+ $cssweekend = 'weekend';
}
-$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
+$tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
-$cssonholiday='';
-if (! $isavailable[$daytoparse]['morning'] && ! $isavailable[$daytoparse]['afternoon']) $cssonholiday.='onholidayallday ';
-elseif (! $isavailable[$daytoparse]['morning']) $cssonholiday.='onholidaymorning ';
-elseif (! $isavailable[$daytoparse]['afternoon']) $cssonholiday.='onholidayafternoon ';
+$cssonholiday = '';
+if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayallday ';
+elseif (!$isavailable[$daytoparse]['morning']) $cssonholiday .= 'onholidaymorning ';
+elseif (!$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
-print ' | '.$langs->trans("Duration").' | ';
+print ''.$langs->trans("Duration").' | ';
print ''.$langs->trans("Note").' | ';
//print ' | ';
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print " \n";
-$colspan=4+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2);
+$colspan = 4 + (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : 2);
if ($conf->use_javascript_ajax)
{
print '';
- print '| ';
+ print ' | ';
print $langs->trans("Total");
print ' | ';
print '';
//print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'';
print ' | ';
- $tmparray = dol_getdate($daytoparse, true); // detail of current day
+ $tmparray = dol_getdate($daytoparse, true); // detail of current day
$idw = $tmparray['wday'];
- $cssweekend='';
+ $cssweekend = '';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
- $cssweekend='weekend';
+ $cssweekend = 'weekend';
}
- $cssonholiday='';
- if (! $isavailable[$daytoparse]['morning'] && ! $isavailable[$daytoparse]['afternoon']) $cssonholiday.='onholidayallday ';
- elseif (! $isavailable[$daytoparse]['morning']) $cssonholiday.='onholidaymorning ';
- elseif (! $isavailable[$daytoparse]['afternoon']) $cssonholiday.='onholidayafternoon ';
+ $cssonholiday = '';
+ if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayallday ';
+ elseif (!$isavailable[$daytoparse]['morning']) $cssonholiday .= 'onholidaymorning ';
+ elseif (!$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
- print ' | ';
+ print ' | ';
print ' | ';
print ' | ';
@@ -690,32 +690,32 @@ if (count($tasksarray) > 0)
//var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
//var_dump($tasksrole);
- $j=0;
- $level=0;
+ $j = 0;
+ $level = 0;
$totalforvisibletasks = projectLinesPerDay($j, 0, $usertoprocess, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse, $isavailable, 0, $arrayfields, $extrafields);
//var_dump($totalforvisibletasks);
// Show total for all other tasks
// Calculate total for all tasks
- $listofdistinctprojectid=array(); // List of all distinct projects
+ $listofdistinctprojectid = array(); // List of all distinct projects
if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter))
{
- foreach($tasksarraywithoutfilter as $tmptask)
+ foreach ($tasksarraywithoutfilter as $tmptask)
{
- $listofdistinctprojectid[$tmptask->fk_project]=$tmptask->fk_project;
+ $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
}
}
//var_dump($listofdistinctprojectid);
- $totalforeachday=array();
- foreach($listofdistinctprojectid as $tmpprojectid)
+ $totalforeachday = array();
+ foreach ($listofdistinctprojectid as $tmpprojectid)
{
- $projectstatic->id=$tmpprojectid;
- $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
+ $projectstatic->id = $tmpprojectid;
+ $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
for ($idw = 0; $idw < 7; $idw++)
{
- $tmpday=dol_time_plus_duree($daytoparse, $idw, 'd');
- $totalforeachday[$tmpday]+=$projectstatic->weekWorkLoad[$tmpday];
+ $tmpday = dol_time_plus_duree($daytoparse, $idw, 'd');
+ $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday];
}
}
//var_dump($totalforeachday);
@@ -724,10 +724,10 @@ if (count($tasksarray) > 0)
$isdiff = 0;
if (count($totalforeachday))
{
- $timeonothertasks=($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
+ $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
if ($timeonothertasks)
{
- $isdiff=1;
+ $isdiff = 1;
}
}
@@ -735,12 +735,12 @@ if (count($tasksarray) > 0)
if ($isdiff)
{
print ' ';
- print '| ';
+ print ' | ';
print $langs->trans("OtherFilteredTasks");
print ' | ';
print ' | ';
print '';
- $timeonothertasks=($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
+ $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
//if ($timeonothertasks)
//{
print '';
- print ' | ';
+ print ' | ';
print $langs->trans("Total");
print ' | ';
print '';
//print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'';
print ' | ';
- $tmparray = dol_getdate($daytoparse, true); // detail of current day
+ $tmparray = dol_getdate($daytoparse, true); // detail of current day
$idw = $tmparray['wday'];
- $cssweekend='';
+ $cssweekend = '';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
- $cssweekend='weekend';
+ $cssweekend = 'weekend';
}
- $cssonholiday='';
- if (! $isavailable[$daytoparse]['morning'] && ! $isavailable[$daytoparse]['afternoon']) $cssonholiday.='onholidayallday ';
- elseif (! $isavailable[$daytoparse]['morning']) $cssonholiday.='onholidaymorning ';
- elseif (! $isavailable[$daytoparse]['afternoon']) $cssonholiday.='onholidayafternoon ';
+ $cssonholiday = '';
+ if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayallday ';
+ elseif (!$isavailable[$daytoparse]['morning']) $cssonholiday .= 'onholidaymorning ';
+ elseif (!$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
- print ' | ';
+ print ' | ';
print ' |
|
@@ -794,12 +794,12 @@ print '';
print ''."\n";
print '';
-print '';
+print '';
print ' ';
print '';
-$modeinput='hours';
+$modeinput = 'hours';
if ($conf->use_javascript_ajax)
{
diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php
index 8af733394bf..535f8e17522 100644
--- a/htdocs/projet/activity/perweek.php
+++ b/htdocs/projet/activity/perweek.php
@@ -97,26 +97,26 @@ $next_month = $next['month'];
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
-$firstdaytoshow=dol_mktime(0, 0, 0, $first_month, $first_day, $first_year);
-$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
+$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year);
+$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
{
- $usertoprocess=$user;
- $search_usertoprocessid=$usertoprocess->id;
+ $usertoprocess = $user;
+ $search_usertoprocessid = $usertoprocess->id;
}
elseif ($search_usertoprocessid > 0)
{
- $usertoprocess=new User($db);
+ $usertoprocess = new User($db);
$usertoprocess->fetch($search_usertoprocessid);
- $search_usertoprocessid=$usertoprocess->id;
+ $search_usertoprocessid = $usertoprocess->id;
}
else
{
- $usertoprocess=new User($db);
+ $usertoprocess = new User($db);
}
-$object=new Task($db);
+$object = new Task($db);
// Extra fields
$extrafields = new ExtraFields($db);
@@ -125,7 +125,7 @@ $extrafields = new ExtraFields($db);
//$extrafields->fetch_name_optionals_label('projet');
$extrafields->fetch_name_optionals_label('projet_task');
-$arrayfields=array();
+$arrayfields = array();
/*$arrayfields=array(
// Project
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103),
@@ -134,8 +134,8 @@ $arrayfields=array();
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
);*/
-$arrayfields['t.planned_workload']=array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0);
-$arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0);
+$arrayfields['t.planned_workload'] = array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0);
+$arrayfields['t.progress'] = array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0);
/*foreach($object->fields as $key => $val)
{
// If $val['visible']==0, then we never show the field
@@ -145,17 +145,17 @@ $arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'ena
// Extra fields
if (is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0)
{
- foreach($extrafields->attributes['projet_task']['label'] as $key => $val)
+ foreach ($extrafields->attributes['projet_task']['label'] as $key => $val)
{
- if (! empty($extrafields->attributes['projet_task']['list'][$key]))
- $arrayfields["efpt.".$key]=array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key])!=3 && $extrafields->attributes['projet_task']['perms'][$key]));
+ if (!empty($extrafields->attributes['projet_task']['list'][$key]))
+ $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key]));
}
}
$arrayfields = dol_sort_array($arrayfields, 'position');
-$search_array_options=array();
-$search_array_options_project=$extrafields->getOptionalsFromPost('projet', '', 'search_');
-$search_array_options_task=$extrafields->getOptionalsFromPost('projet_task', '', 'search_task_');
+$search_array_options = array();
+$search_array_options_project = $extrafields->getOptionalsFromPost('projet', '', 'search_');
+$search_array_options_task = $extrafields->getOptionalsFromPost('projet_task', '', 'search_task_');
@@ -167,7 +167,7 @@ $search_array_options_task=$extrafields->getOptionalsFromPost('projet_task', '',
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$action = '';
- $search_categ='';
+ $search_categ = '';
$search_usertoprocessid = $user->id;
$search_task_ref = '';
$search_task_label = '';
@@ -179,7 +179,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_array_options_task = array();
// We redefine $usertoprocess
- $usertoprocess=$user;
+ $usertoprocess = $user;
}
if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha'))
{
@@ -209,36 +209,36 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
$error++;
}
- if (! GETPOST('type'))
+ if (!GETPOST('type'))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
$error++;
}
- if (! $error)
+ if (!$error)
{
- $idfortaskuser=$usertoprocess->id;
+ $idfortaskuser = $usertoprocess->id;
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
{
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
- $sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
- $sql.=' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
- $resql=$db->query($sql);
+ $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
+ $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
+ $resql = $db->query($sql);
if ($resql)
{
- $obj=$db->fetch_object($resql);
- if (! $obj) // User is not already linked to project, so we will create link to first type
+ $obj = $db->fetch_object($resql);
+ if (!$obj) // User is not already linked to project, so we will create link to first type
{
$project = new Project($db);
$project->fetch($object->fk_project);
// Get type
- $listofprojcontact=$project->liste_type_contact('internal');
+ $listofprojcontact = $project->liste_type_contact('internal');
if (count($listofprojcontact))
{
- $typeforprojectcontact=reset(array_keys($listofprojcontact));
+ $typeforprojectcontact = reset(array_keys($listofprojcontact));
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
}
}
@@ -264,43 +264,43 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
}
}
- if (! $error)
+ if (!$error)
{
setEventMessages("TaskAssignedToEnterTime", null);
- $taskid=0;
+ $taskid = 0;
}
- $action='';
+ $action = '';
}
if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilteraction') != 'listafterchangingselectedfields')
{
- $timetoadd=$_POST['task'];
+ $timetoadd = $_POST['task'];
if (empty($timetoadd))
{
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
}
else
{
- foreach($timetoadd as $taskid => $value) // Loop on each task
+ foreach ($timetoadd as $taskid => $value) // Loop on each task
{
- $updateoftaskdone=0;
- foreach($value as $key => $val) // Loop on each day
+ $updateoftaskdone = 0;
+ foreach ($value as $key => $val) // Loop on each day
{
- $amountoadd=$timetoadd[$taskid][$key];
- if (! empty($amountoadd))
+ $amountoadd = $timetoadd[$taskid][$key];
+ if (!empty($amountoadd))
{
- $tmpduration=explode(':', $amountoadd);
- $newduration=0;
- if (! empty($tmpduration[0])) $newduration+=($tmpduration[0] * 3600);
- if (! empty($tmpduration[1])) $newduration+=($tmpduration[1] * 60);
- if (! empty($tmpduration[2])) $newduration+=($tmpduration[2]);
+ $tmpduration = explode(':', $amountoadd);
+ $newduration = 0;
+ if (!empty($tmpduration[0])) $newduration += ($tmpduration[0] * 3600);
+ if (!empty($tmpduration[1])) $newduration += ($tmpduration[1] * 60);
+ if (!empty($tmpduration[2])) $newduration += ($tmpduration[2]);
if ($newduration > 0)
{
$object->fetch($taskid);
- if (GETPOSTISSET($taskid . 'progress')) $object->progress = GETPOST($taskid . 'progress', 'int');
+ if (GETPOSTISSET($taskid.'progress')) $object->progress = GETPOST($taskid.'progress', 'int');
else unset($object->progress);
$object->timespent_duration = $newduration;
@@ -308,7 +308,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
$object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
$object->timespent_datehour = $object->timespent_date;
- $result=$object->addTimeSpent($user);
+ $result = $object->addTimeSpent($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@@ -321,14 +321,14 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
}
}
- if (! $updateoftaskdone) // Check to update progress if no update were done on task.
+ if (!$updateoftaskdone) // Check to update progress if no update were done on task.
{
$object->fetch($taskid);
//var_dump($object->progress);var_dump(GETPOST($taskid . 'progress', 'int')); exit;
- if ($object->progress != GETPOST($taskid . 'progress', 'int'))
+ if ($object->progress != GETPOST($taskid.'progress', 'int'))
{
- $object->progress = GETPOST($taskid . 'progress', 'int');
- $result=$object->update($user);
+ $object->progress = GETPOST($taskid.'progress', 'int');
+ $result = $object->update($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@@ -339,29 +339,29 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
}
}
- if (! $error)
+ if (!$error)
{
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
- $param='';
- $param.=($mode?'&mode='.urlencode($mode):'');
- $param.=($projectid?'id='.urlencode($projectid):'');
- $param.=($search_usertoprocessid?'&search_usertoprocessid='.urlencode($search_usertoprocessid):'');
- $param.=($day?'&day='.urlencode($day):'').($month?'&month='.urlencode($month):'').($year?'&year='.urlencode($year):'');
- $param.=($search_project_ref?'&search_project_ref='.urlencode($search_project_ref):'');
- $param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.urlencode($search_usertoprocessid):'');
- $param.=($search_thirdparty?'&search_thirdparty='.urlencode($search_thirdparty):'');
- $param.=($search_declared_progress?'&search_declared_progress='.urlencode($search_declared_progress):'');
- $param.=($search_task_ref?'&search_task_ref='.urlencode($search_task_ref):'');
- $param.=($search_task_label?'&search_task_label='.urlencode($search_task_label):'');
+ $param = '';
+ $param .= ($mode ? '&mode='.urlencode($mode) : '');
+ $param .= ($projectid ? 'id='.urlencode($projectid) : '');
+ $param .= ($search_usertoprocessid ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : '');
+ $param .= ($day ? '&day='.urlencode($day) : '').($month ? '&month='.urlencode($month) : '').($year ? '&year='.urlencode($year) : '');
+ $param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
+ $param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : '');
+ $param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
+ $param .= ($search_declared_progress ? '&search_declared_progress='.urlencode($search_declared_progress) : '');
+ $param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
+ $param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
/*$search_array_options=$search_array_options_project;
$search_options_pattern='search_options_';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
*/
- $search_array_options=$search_array_options_task;
- $search_options_pattern='search_task_options_';
+ $search_array_options = $search_array_options_task;
+ $search_options_pattern = 'search_task_options_';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Redirect to avoid submit twice on back
@@ -377,19 +377,19 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
* View
*/
-$form=new Form($db);
-$formother=new FormOther($db);
-$formcompany=new FormCompany($db);
-$formproject=new FormProjets($db);
-$projectstatic=new Project($db);
+$form = new Form($db);
+$formother = new FormOther($db);
+$formcompany = new FormCompany($db);
+$formproject = new FormProjets($db);
+$projectstatic = new Project($db);
$project = new Project($db);
$taskstatic = new Task($db);
$thirdpartystatic = new Societe($db);
$holiday = new Holiday($db);
-$title=$langs->trans("TimeSpent");
+$title = $langs->trans("TimeSpent");
-$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id)?2:0), 1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project
+$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project
//var_dump($projectsListId);
if ($id)
{
@@ -397,14 +397,14 @@ if ($id)
$project->fetch_thirdparty();
}
-$onlyopenedproject=1; // or -1
-$morewherefilter='';
+$onlyopenedproject = 1; // or -1
+$morewherefilter = '';
-if ($search_project_ref) $morewherefilter.=natural_search(array("p.ref", "p.title"), $search_project_ref);
-if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
-if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label);
-if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
-if ($search_declared_progress) $morewherefilter.=natural_search("t.progress", $search_declared_progress, 1);
+if ($search_project_ref) $morewherefilter .= natural_search(array("p.ref", "p.title"), $search_project_ref);
+if ($search_task_ref) $morewherefilter .= natural_search("t.ref", $search_task_ref);
+if ($search_task_label) $morewherefilter .= natural_search(array("t.ref", "t.label"), $search_task_label);
+if ($search_thirdparty) $morewherefilter .= natural_search("s.nom", $search_thirdparty);
+if ($search_declared_progress) $morewherefilter .= natural_search("t.progress", $search_declared_progress, 1);
$sql = &$morewherefilter;
@@ -415,18 +415,18 @@ $extrafieldsobjectkey='projet';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
*/
$search_array_options = $search_array_options_task;
-$extrafieldsobjectprefix='efpt.';
-$search_options_pattern='search_task_options_';
-$extrafieldsobjectkey='projet_task';
+$extrafieldsobjectprefix = 'efpt.';
+$search_options_pattern = 'search_task_options_';
+$extrafieldsobjectkey = 'projet_task';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
-$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0), 0, $extrafields); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
+$tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
if ($morewherefilter) // Get all task without any filter, so we can show total of time spent for not visible tasks
{
- $tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
+ $tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid ? $search_usertoprocessid : 0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
}
-$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
-$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
+$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
+$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
//var_dump($tasksarray);
//var_dump($projectsrole);
//var_dump($taskrole);
@@ -436,31 +436,31 @@ llxHeader("", $title, "", '', '', '', array('/core/js/timesheet.js'));
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'project');
-$param='';
-$param.=($mode?'&mode='.urlencode($mode):'');
-$param.=($search_project_ref?'&search_project_ref='.urlencode($search_project_ref):'');
-$param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.urlencode($search_usertoprocessid):'');
-$param.=($search_thirdparty?'&search_thirdparty='.urlencode($search_thirdparty):'');
-$param.=($search_task_ref?'&search_task_ref='.urlencode($search_task_ref):'');
-$param.=($search_task_label?'&search_task_label='.urlencode($search_task_label):'');
+$param = '';
+$param .= ($mode ? '&mode='.urlencode($mode) : '');
+$param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
+$param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : '');
+$param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
+$param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
+$param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
-$search_array_options=$search_array_options_project;
-$search_options_pattern='search_options_';
+$search_array_options = $search_array_options_project;
+$search_options_pattern = 'search_options_';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
-$search_array_options=$search_array_options_task;
-$search_options_pattern='search_task_options_';
+$search_array_options = $search_array_options_task;
+$search_options_pattern = 'search_task_options_';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Show navigation bar
-$nav =''.img_previous($langs->trans("Previous"))."\n";
-$nav.=" ".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week." \n";
-$nav.=''.img_next($langs->trans("Next"))."\n";
-$nav.=" (".$langs->trans("Today").")";
-$nav.=' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 0).' ';
-$nav.=' ';
+$nav = ''.img_previous($langs->trans("Previous"))."\n";
+$nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week." \n";
+$nav .= ''.img_next($langs->trans("Next"))."\n";
+$nav .= " (".$langs->trans("Today").")";
+$nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 0).' ';
+$nav .= ' ';
-$picto='calendarweek';
+$picto = 'calendarweek';
print '';
print '';
@@ -472,18 +472,18 @@ print '';
print '';
print '';
-$head=project_timesheet_prepare_head($mode, $usertoprocess);
+$head = project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperweek', $langs->trans('TimeSpent'), -1, 'task');
// Show description of content
print '';
-if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').' ';
+if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
else
{
if (empty($usertoprocess->id) || $usertoprocess->id < 0)
{
- if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').' ';
- else print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').' ';
+ if ($user->rights->projet->all->lire && !$socid) print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
+ else print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
}
}
if ($mine || ($usertoprocess->id == $user->id))
@@ -498,13 +498,13 @@ print ' ';
dol_fiche_end();
-print ''.$nav.' '; // We move this before the assign to components so, the default submit button is not the assign to.
+print ''.$nav.' '; // We move this before the assign to components so, the default submit button is not the assign to.
print '';
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
print ' ';
-$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1, 0, 0, '', '', 'all', $usertoprocess);
+$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, 1, 1, 0, 0, '', '', 'all', $usertoprocess);
print ' ';
print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
@@ -514,13 +514,13 @@ print ' ';
print '';
-$startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
+$startday = dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
// Get if user is available or not for each day
-$isavailable=array();
-if (! empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
+$isavailable = array();
+if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
{
- $tmparray=explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
+ $tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
if (count($tmparray) >= 2)
{
$numstartworkingday = $tmparray[0];
@@ -528,9 +528,9 @@ if (! empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
}
}
-for ($idw=0; $idw<7; $idw++)
+for ($idw = 0; $idw < 7; $idw++)
{
- $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
+ $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
$dayinloop = dol_time_plus_duree($startday, $idw, 'd');
// Useless because $dayinloopwithouthours should be same than $dayinloopfromfirstdaytoshow
@@ -543,11 +543,11 @@ for ($idw=0; $idw<7; $idw++)
$statusofholidaytocheck = '3';
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck);
- $isavailable[$dayinloopfromfirstdaytoshow]=$isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
+ $isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
}
-$moreforfilter='';
+$moreforfilter = '';
// Filter on categories
/*
@@ -561,96 +561,96 @@ if (! empty($conf->categorie->enabled))
}*/
// If the user can view user other than himself
-$moreforfilter.='';
-$moreforfilter.=' '.$langs->trans('User'). ' ';
-$includeonly='hierarchyme';
-if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
-$moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
-$moreforfilter.=' ';
+$moreforfilter .= '';
+$moreforfilter .= ' '.$langs->trans('User').' ';
+$includeonly = 'hierarchyme';
+if (empty($user->rights->user->user->lire)) $includeonly = array($user->id);
+$moreforfilter .= $form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
+$moreforfilter .= ' ';
if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
- $moreforfilter.='';
- $moreforfilter.=' '.$langs->trans('Project'). ' ';
- $moreforfilter.=' ';
- $moreforfilter.=' ';
+ $moreforfilter .= '';
+ $moreforfilter .= ' '.$langs->trans('Project').' ';
+ $moreforfilter .= ' ';
+ $moreforfilter .= ' ';
- $moreforfilter.='';
- $moreforfilter.=' '.$langs->trans('ThirdParty'). ' ';
- $moreforfilter.=' ';
- $moreforfilter.=' ';
+ $moreforfilter .= '';
+ $moreforfilter .= ' '.$langs->trans('ThirdParty').' ';
+ $moreforfilter .= ' ';
+ $moreforfilter .= ' ';
}
-if (! empty($moreforfilter))
+if (!empty($moreforfilter))
{
print '';
print $moreforfilter;
- $parameters=array();
- $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print ' ';
}
-$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
-$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
// This must be after the $selectedfields
-$addcolspan=0;
-if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++;
-if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++;
+$addcolspan = 0;
+if (!empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++;
+if (!empty($arrayfields['t.progress']['checked'])) $addcolspan++;
foreach ($arrayfields as $key => $val)
{
if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++;
}
print '';
-print ' '."\n";
+print ''."\n";
print '';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
print ' | ';
// TASK fields
-$search_options_pattern='search_task_options_';
-$extrafieldsobjectkey='projet_task';
-$extrafieldsobjectprefix='efpt.';
+$search_options_pattern = 'search_task_options_';
+$extrafieldsobjectkey = 'projet_task';
+$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
print ' | ';
-if (! empty($arrayfields['t.planned_workload']['checked']))
+if (!empty($arrayfields['t.planned_workload']['checked']))
{
print ' | ';
}
-if (! empty($arrayfields['t.progress']['checked']))
+if (!empty($arrayfields['t.progress']['checked']))
{
print ' | ';
}
print ' | ';
-for ($idw=0;$idw<7;$idw++)
+for ($idw = 0; $idw < 7; $idw++)
{
print ' | ';
}
// Action column
print '';
-$searchpicto=$form->showFilterAndCheckAddButtons(0);
+$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print ' | ';
print " \n";
print '';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print '| '.$langs->trans("Project").' | ';
-if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''.$langs->trans("ThirdParty").' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''.$langs->trans("Project").' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''.$langs->trans("ThirdParty").' | ';
print ''.$langs->trans("Task").' | ';
// TASK fields
-$extrafieldsobjectkey='projet_task';
-$extrafieldsobjectprefix='efpt.';
+$extrafieldsobjectkey = 'projet_task';
+$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
-if (! empty($arrayfields['t.planned_workload']['checked']))
+if (!empty($arrayfields['t.planned_workload']['checked']))
{
print ''.$langs->trans("PlannedWorkload").' | ';
}
-if (! empty($arrayfields['t.progress']['checked']))
+if (!empty($arrayfields['t.progress']['checked']))
{
print ''.$langs->trans("ProgressDeclared").' | ';
}
@@ -658,27 +658,27 @@ if (! empty($arrayfields['t.progress']['checked']))
if ($usertoprocess->id == $user->id) print ''.$langs->trans("TimeSpentByYou").' | ';
else print ''.$langs->trans("TimeSpentByUser").' | ';*/
print ''.$langs->trans("TimeSpent").' ('.$langs->trans("Everybody").') | ';
-print ''.$langs->trans("TimeSpent").($usertoprocess->firstname?' ('.dol_trunc($usertoprocess->firstname, 10).')':'').' | ';
+print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? ' ('.dol_trunc($usertoprocess->firstname, 10).')' : '').' | ';
-for ($idw=0; $idw<7; $idw++)
+for ($idw = 0; $idw < 7; $idw++)
{
- $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
+ $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
$dayinloop = dol_time_plus_duree($startday, $idw, 'd');
- $cssweekend='';
+ $cssweekend = '';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
- $cssweekend='weekend';
+ $cssweekend = 'weekend';
}
- $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
+ $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
- $cssonholiday='';
- if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday ';
- elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning ';
- elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon ';
+ $cssonholiday = '';
+ if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayallday ';
+ elseif (!$isavailable[$tmpday]['morning']) $cssonholiday .= 'onholidaymorning ';
+ elseif (!$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
- print ''.dol_print_date($dayinloopfromfirstdaytoshow, '%a').' '.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').' | ';
+ print ''.dol_print_date($dayinloopfromfirstdaytoshow, '%a').' '.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').' | ';
}
//print ' | ';
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@@ -686,32 +686,32 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $
print " \n";
-$colspan=3+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2);
+$colspan = 3 + (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : 2);
if ($conf->use_javascript_ajax)
{
print '';
- print '| ';
+ print ' | ';
print $langs->trans("Total");
print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'';
print ' | ';
for ($idw = 0; $idw < 7; $idw++)
{
- $cssweekend='';
+ $cssweekend = '';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
- $cssweekend='weekend';
+ $cssweekend = 'weekend';
}
- $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
+ $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
- $cssonholiday='';
- if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday ';
- elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning ';
- elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon ';
+ $cssonholiday = '';
+ if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayallday ';
+ elseif (!$isavailable[$tmpday]['morning']) $cssonholiday .= 'onholidaymorning ';
+ elseif (!$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
- print ' | ';
+ print ' | ';
}
print ' | ';
print ' ';
@@ -720,39 +720,39 @@ if ($conf->use_javascript_ajax)
// By default, we can edit only tasks we are assigned to
-$restrictviewformytask=((! isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
+$restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
if (count($tasksarray) > 0)
{
//var_dump($tasksarray); // contains only selected tasks
//var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
//var_dump($tasksrole);
- $j=0;
- $level=0;
+ $j = 0;
+ $level = 0;
$totalforvisibletasks = projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $arrayfields, $extrafields);
//var_dump($totalforvisibletasks);
// Show total for all other tasks
// Calculate total for all tasks
- $listofdistinctprojectid=array(); // List of all distinct projects
+ $listofdistinctprojectid = array(); // List of all distinct projects
if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter))
{
- foreach($tasksarraywithoutfilter as $tmptask)
+ foreach ($tasksarraywithoutfilter as $tmptask)
{
- $listofdistinctprojectid[$tmptask->fk_project]=$tmptask->fk_project;
+ $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
}
}
//var_dump($listofdistinctprojectid);
- $totalforeachday=array();
- foreach($listofdistinctprojectid as $tmpprojectid)
+ $totalforeachday = array();
+ foreach ($listofdistinctprojectid as $tmpprojectid)
{
- $projectstatic->id=$tmpprojectid;
- $projectstatic->loadTimeSpent($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
+ $projectstatic->id = $tmpprojectid;
+ $projectstatic->loadTimeSpent($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
for ($idw = 0; $idw < 7; $idw++)
{
- $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
- $totalforeachday[$tmpday]+=$projectstatic->weekWorkLoad[$tmpday];
+ $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
+ $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday];
}
}
@@ -765,11 +765,11 @@ if (count($tasksarray) > 0)
{
for ($idw = 0; $idw < 7; $idw++)
{
- $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
- $timeonothertasks=($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
+ $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
+ $timeonothertasks = ($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
if ($timeonothertasks)
{
- $isdiff=1;
+ $isdiff = 1;
break;
}
}
@@ -779,20 +779,20 @@ if (count($tasksarray) > 0)
if ($isdiff)
{
print '';
- print '| ';
+ print ' | ';
print $langs->trans("OtherFilteredTasks");
print ' | ';
for ($idw = 0; $idw < 7; $idw++)
{
- $cssweekend='';
+ $cssweekend = '';
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
{
- $cssweekend='weekend';
+ $cssweekend = 'weekend';
}
- print '';
- $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
- $timeonothertasks=($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
+ print ' | ';
+ $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
+ $timeonothertasks = ($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
if ($timeonothertasks)
{
print 'use_javascript_ajax)
{
@@ -865,7 +865,7 @@ if ($conf->use_javascript_ajax)
}
});'."\n";
- $idw=0;
+ $idw = 0;
while ($idw < 7)
{
print ' updateTotal('.$idw.',\''.$modeinput.'\');';
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 51af2f2b14d..74f53cc9b72 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -94,9 +94,9 @@ if (empty($reshook))
// Cancel
if ($cancel)
{
- if (GETPOST("comefromclone")==1)
+ if (GETPOST("comefromclone") == 1)
{
- $result=$object->delete($user);
+ $result = $object->delete($user);
if ($result > 0)
{
header("Location: index.php");
@@ -119,7 +119,7 @@ if (empty($reshook))
if ($action == 'add' && $user->rights->projet->creer)
{
- $error=0;
+ $error = 0;
if (empty($_POST["ref"]))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');
@@ -131,21 +131,21 @@ if (empty($reshook))
$error++;
}
- if (GETPOST('opp_amount') != '' && ! (GETPOST('opp_status') > 0))
+ if (GETPOST('opp_amount') != '' && !(GETPOST('opp_status') > 0))
{
$error++;
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
}
// Create with status validated immediatly
- if (! empty($conf->global->PROJECT_CREATE_NO_DRAFT))
+ if (!empty($conf->global->PROJECT_CREATE_NO_DRAFT))
{
- $status=Project::STATUS_VALIDATED;
+ $status = Project::STATUS_VALIDATED;
}
- if (! $error)
+ if (!$error)
{
- $error=0;
+ $error = 0;
$db->begin();
@@ -156,23 +156,23 @@ if (empty($reshook))
$object->public = GETPOST('public', 'alpha');
$object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
$object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
- $object->date_c = dol_now();
+ $object->date_c = dol_now();
$object->date_start = $date_start;
$object->date_end = $date_end;
$object->statut = $status;
$object->opp_status = $opp_status;
$object->opp_percent = $opp_percent;
- $object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha')=='on'?1:0);
- $object->usage_task = (GETPOST('usage_task', 'alpha')=='on'?1:0);
- $object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha')=='on'?1:0);
- $object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha')=='on'?1:0);
+ $object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha') == 'on' ? 1 : 0);
+ $object->usage_task = (GETPOST('usage_task', 'alpha') == 'on' ? 1 : 0);
+ $object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha') == 'on' ? 1 : 0);
+ $object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha') == 'on' ? 1 : 0);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++;
$result = $object->create($user);
- if (! $error && $result > 0)
+ if (!$error && $result > 0)
{
// Add myself as project leader
$result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal');
@@ -189,19 +189,19 @@ if (empty($reshook))
setEventMessages($langs->trans($object->error), null, 'errors');
$error++;
}
- if (! $error && !empty($object->id) > 0)
+ if (!$error && !empty($object->id) > 0)
{
// Category association
$categories = GETPOST('categories', 'array');
- $result=$object->setCategories($categories);
- if ($result<0) {
+ $result = $object->setCategories($categories);
+ if ($result < 0) {
$langs->load("errors");
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
- if (! $error)
+ if (!$error)
{
$db->commit();
@@ -231,9 +231,9 @@ if (empty($reshook))
}
}
- if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
+ if ($action == 'update' && !$_POST["cancel"] && $user->rights->projet->creer)
{
- $error=0;
+ $error = 0;
if (empty($ref))
{
@@ -250,7 +250,7 @@ if (empty($reshook))
$db->begin();
- if (! $error)
+ if (!$error)
{
$object->oldcopy = clone $object;
@@ -260,18 +260,18 @@ if (empty($reshook))
$object->title = GETPOST('title', 'none'); // Do not use 'alpha' here, we want field as it is
$object->statut = GETPOST('status', 'int');
$object->socid = GETPOST('socid', 'int');
- $object->description = GETPOST('description', 'none'); // Do not use 'alpha' here, we want field as it is
+ $object->description = GETPOST('description', 'none'); // Do not use 'alpha' here, we want field as it is
$object->public = GETPOST('public', 'alpha');
- $object->date_start = empty($_POST["projectstart"])?'':$date_start;
- $object->date_end = empty($_POST["projectend"])?'':$date_end;
+ $object->date_start = empty($_POST["projectstart"]) ? '' : $date_start;
+ $object->date_end = empty($_POST["projectend"]) ? '' : $date_end;
if (isset($_POST['opp_amount'])) $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
- if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount', 'alpha'));
+ if (isset($_POST['budget_amount'])) $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
if (isset($_POST['opp_status'])) $object->opp_status = $opp_status;
if (isset($_POST['opp_percent'])) $object->opp_percent = $opp_percent;
- $object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha')=='on'?1:0);
- $object->usage_task = (GETPOST('usage_task', 'alpha')=='on'?1:0);
- $object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha')=='on'?1:0);
- $object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha')=='on'?1:0);
+ $object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha') == 'on' ? 1 : 0);
+ $object->usage_task = (GETPOST('usage_task', 'alpha') == 'on' ? 1 : 0);
+ $object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha') == 'on' ? 1 : 0);
+ $object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha') == 'on' ? 1 : 0);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@@ -284,18 +284,18 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
}
- if (! $error)
+ if (!$error)
{
- $result=$object->update($user);
+ $result = $object->update($user);
if ($result < 0)
{
$error++;
if ($result == -4) setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
else setEventMessages($object->error, $object->errors, 'errors');
- }else {
+ } else {
// Category association
$categories = GETPOST('categories', 'array');
- $result=$object->setCategories($categories);
+ $result = $object->setCategories($categories);
if ($result < 0)
{
$error++;
@@ -304,11 +304,11 @@ if (empty($reshook))
}
}
- if (! $error)
+ if (!$error)
{
- if (GETPOST("reportdate") && ($object->date_start!=$old_start_date))
+ if (GETPOST("reportdate") && ($object->date_start != $old_start_date))
{
- $result=$object->shiftTaskDate($old_start_date);
+ $result = $object->shiftTaskDate($old_start_date);
if ($result < 0)
{
$error++;
@@ -332,7 +332,7 @@ if (empty($reshook))
if ($error)
{
$db->rollback();
- $action='edit';
+ $action = 'edit';
}
else
{
@@ -355,11 +355,11 @@ if (empty($reshook))
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
}
- $result= $object->generateDocument($object->modelpdf, $outputlangs);
+ $result = $object->generateDocument($object->modelpdf, $outputlangs);
if ($result <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
- $action='';
+ $action = '';
}
}
@@ -368,11 +368,11 @@ if (empty($reshook))
{
if ($object->id > 0)
{
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("other");
$upload_dir = $conf->projet->dir_output;
- $file = $upload_dir . '/' . GETPOST('file');
+ $file = $upload_dir.'/'.GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret)
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
@@ -413,7 +413,7 @@ if (empty($reshook))
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->projet->supprimer)
{
$object->fetch($id);
- $result=$object->delete($user);
+ $result = $object->delete($user);
if ($result > 0)
{
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
@@ -429,15 +429,15 @@ if (empty($reshook))
if ($action == 'confirm_clone' && $user->rights->projet->creer && $confirm == 'yes')
{
- $clone_contacts=GETPOST('clone_contacts')?1:0;
- $clone_tasks=GETPOST('clone_tasks')?1:0;
+ $clone_contacts = GETPOST('clone_contacts') ? 1 : 0;
+ $clone_tasks = GETPOST('clone_tasks') ? 1 : 0;
$clone_project_files = GETPOST('clone_project_files') ? 1 : 0;
$clone_task_files = GETPOST('clone_task_files') ? 1 : 0;
- $clone_notes=GETPOST('clone_notes')?1:0;
- $move_date=GETPOST('move_date')?1:0;
- $clone_thirdparty=GETPOST('socid', 'int')?GETPOST('socid', 'int'):0;
+ $clone_notes = GETPOST('clone_notes') ? 1 : 0;
+ $move_date = GETPOST('move_date') ? 1 : 0;
+ $clone_thirdparty = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : 0;
- $result=$object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
+ $result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
if ($result <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@@ -445,21 +445,21 @@ if (empty($reshook))
else
{
// Load new object
- $newobject=new Project($db);
+ $newobject = new Project($db);
$newobject->fetch($result);
$newobject->fetch_optionals();
- $newobject->fetch_thirdparty(); // Load new object
- $object=$newobject;
- $action='edit';
- $comefromclone=true;
+ $newobject->fetch_thirdparty(); // Load new object
+ $object = $newobject;
+ $action = 'edit';
+ $comefromclone = true;
}
}
// Actions to send emails
- $trigger_name='PROJECT_SENTBYMAIL';
- $paramname='id';
- $autocopy='MAIN_MAIL_AUTOCOPY_PROJECT_TO'; // used to know the automatic BCC to add
- $trackid='proj'.$object->id;
+ $trigger_name = 'PROJECT_SENTBYMAIL';
+ $paramname = 'id';
+ $autocopy = 'MAIN_MAIL_AUTOCOPY_PROJECT_TO'; // used to know the automatic BCC to add
+ $trackid = 'proj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
@@ -473,21 +473,21 @@ $formfile = new FormFile($db);
$formproject = new FormProjets($db);
$userstatic = new User($db);
-$title=$langs->trans("Project").' - '.$object->ref.($object->thirdparty->name?' - '.$object->thirdparty->name:'').($object->title?' - '.$object->title:'');
-if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) $title=$object->ref.($object->thirdparty->name?' - '.$object->thirdparty->name:'').($object->title?' - '.$object->title:'');
-$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
+$title = $langs->trans("Project").' - '.$object->ref.($object->thirdparty->name ? ' - '.$object->thirdparty->name : '').($object->title ? ' - '.$object->title : '');
+if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) $title = $object->ref.($object->thirdparty->name ? ' - '.$object->thirdparty->name : '').($object->title ? ' - '.$object->title : '');
+$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
llxHeader("", $title, $help_url);
-$titleboth=$langs->trans("LeadsOrProjects");
-$titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default
+$titleboth = $langs->trans("LeadsOrProjects");
+$titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default
if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0)
{
- $titleboth=$langs->trans("Projects");
+ $titleboth = $langs->trans("Projects");
$titlenew = $langs->trans("NewProject");
}
if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only
- $titleboth=$langs->trans("Leads");
+ $titleboth = $langs->trans("Leads");
$titlenew = $langs->trans("NewLead");
}
@@ -497,7 +497,7 @@ if ($action == 'create' && $user->rights->projet->creer)
* Create
*/
- $thirdparty=new Societe($db);
+ $thirdparty = new Societe($db);
if ($socid > 0) $thirdparty->fetch($socid);
print load_fiche_titre($titlenew, '', 'project');
@@ -511,18 +511,18 @@ if ($action == 'create' && $user->rights->projet->creer)
print '';
- $defaultref='';
- $modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
+ $defaultref = '';
+ $modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
// Search template files
- $file=''; $classname=''; $filefound=0;
- $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
- foreach($dirmodels as $reldir)
+ $file = ''; $classname = ''; $filefound = 0;
+ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+ foreach ($dirmodels as $reldir)
{
- $file=dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
+ $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
if (file_exists($file))
{
- $filefound=1;
+ $filefound = 1;
$classname = $modele;
break;
}
@@ -530,16 +530,16 @@ if ($action == 'create' && $user->rights->projet->creer)
if ($filefound)
{
- $result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
+ $result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
$modProject = new $classname;
$defaultref = $modProject->getNextValue($thirdparty, $object);
}
- if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
+ if (is_numeric($defaultref) && $defaultref <= 0) $defaultref = '';
// Ref
- $suggestedref=($_POST["ref"]?$_POST["ref"]:$defaultref);
+ $suggestedref = ($_POST["ref"] ? $_POST["ref"] : $defaultref);
print '| '.$langs->trans("Ref").' | ';
print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref));
print ' | ';
@@ -552,23 +552,23 @@ if ($action == 'create' && $user->rights->projet->creer)
print $langs->trans("Usage");
print '';
print '';
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
- print ' ';
+ print ' ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print ' ';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
- print ' ';
+ print ' ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print ' ';
}
- if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
+ if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
- print ' ';
+ print ' ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print ' ';
@@ -584,16 +584,16 @@ if ($action == 'create' && $user->rights->projet->creer)
if ($conf->societe->enabled)
{
print ' | | ';
- print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'');
+ print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print $langs->trans("ThirdParty");
- print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'');
+ print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print ' | ';
- $filteronlist='';
- if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
- $text=$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300');
+ $filteronlist = '';
+ if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
+ $text = $form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300');
if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
{
- $texthelp=$langs->trans("IfNeedToUseOtherObjectKeepEmpty");
+ $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1);
}
else print $text;
@@ -612,46 +612,46 @@ if ($action == 'create' && $user->rights->projet->creer)
// Visibility
print ' | | '.$langs->trans("Visibility").' | ';
- $array=array();
+ $array = array();
if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject");
if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject");
- print $form->selectarray('public', $array, GETPOST('public')?GETPOST('public'):$object->public);
+ print $form->selectarray('public', $array, GETPOST('public') ?GETPOST('public') : $object->public);
print ' | ';
// Date start
print '| '.$langs->trans("DateStart").' | ';
- print $form->selectDate(($date_start?$date_start:''), 'projectstart', 0, 0, 0, '', 1, 0);
+ print $form->selectDate(($date_start ? $date_start : ''), 'projectstart', 0, 0, 0, '', 1, 0);
print ' | ';
// Date end
print '| '.$langs->trans("DateEnd").' | ';
- print $form->selectDate(($date_end?$date_end:-1), 'projectend', 0, 0, 0, '', 1, 0);
+ print $form->selectDate(($date_end ? $date_end : -1), 'projectend', 0, 0, 0, '', 1, 0);
print ' | ';
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
// Opportunity status
print '| '.$langs->trans("OpportunityStatus").' | ';
print '';
- print $formproject->selectOpportunityStatus('opp_status', GETPOST('opp_status')?GETPOST('opp_status'):$object->opp_status);
+ print $formproject->selectOpportunityStatus('opp_status', GETPOST('opp_status') ?GETPOST('opp_status') : $object->opp_status);
print ' | ';
// Opportunity probability
print '| '.$langs->trans("OpportunityProbability").' | ';
- print ' %';
- print '';
+ print ' | %';
+ print '';
print ' | ';
print ' ';
// Opportunity amount
print '| '.$langs->trans("OpportunityAmount").' | ';
- print ' | ';
+ print ' | ';
print ' ';
}
// Budget
print '| '.$langs->trans("Budget").' | ';
- print ' | ';
+ print ' | ';
print ' ';
// Description
@@ -664,14 +664,14 @@ if ($action == 'create' && $user->rights->projet->creer)
// Categories
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1);
- $arrayselected=GETPOST('categories', 'array');
+ $arrayselected = GETPOST('categories', 'array');
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print " | ";
}
// Other options
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -684,7 +684,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print '';
print '';
- if (! empty($backtopage))
+ if (!empty($backtopage))
{
print ' ';
print '';
@@ -692,7 +692,7 @@ if ($action == 'create' && $user->rights->projet->creer)
else
{
print ' ';
- print '';
+ print '';
}
print ' ';
@@ -721,7 +721,7 @@ elseif ($object->id > 0)
* Show or edit
*/
- $res=$object->fetch_optionals();
+ $res = $object->fetch_optionals();
// To verify role of users
$userAccess = $object->restrictedProjectArea($user, 'read');
@@ -748,26 +748,26 @@ elseif ($object->id > 0)
// Confirmation delete
if ($action == 'delete')
{
- $text=$langs->trans("ConfirmDeleteAProject");
- $task=new Task($db);
- $taskarray=$task->getTasksArray(0, 0, $object->id, 0, 0);
- $nboftask=count($taskarray);
- if ($nboftask) $text.=' '.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks", $nboftask);
+ $text = $langs->trans("ConfirmDeleteAProject");
+ $task = new Task($db);
+ $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
+ $nboftask = count($taskarray);
+ if ($nboftask) $text .= ' '.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks", $nboftask);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAProject"), $text, "confirm_delete", '', '', 1);
}
// Clone confirmation
if ($action == 'clone')
{
- $formquestion=array(
+ $formquestion = array(
'text' => $langs->trans("ConfirmClone"),
- array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int')>0?GETPOST('socid', 'int'):$object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200')),
- array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true),
- array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true),
- array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true),
- array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true),
- array('type' => 'checkbox', 'name' => 'clone_project_files','label' => $langs->trans("CloneProjectFiles"), 'value' => false),
- array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false)
+ array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int') > 0 ?GETPOST('socid', 'int') : $object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200')),
+ array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true),
+ array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true),
+ array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true),
+ array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true),
+ array('type' => 'checkbox', 'name' => 'clone_project_files', 'label' => $langs->trans("CloneProjectFiles"), 'value' => false),
+ array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false)
);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 300, 590);
@@ -803,9 +803,9 @@ elseif ($object->id > 0)
// Status
print '| '.$langs->trans("Status").' | ';
print '';
- foreach($object->statuts_short as $key => $val)
+ foreach ($object->statuts_short as $key => $val)
{
- print 'statut) == $key ? ' selected="selected"':'').'>'.$langs->trans($val).'';
+ print 'statut) == $key ? ' selected="selected"' : '').'>'.$langs->trans($val).'';
}
print '';
print ' | ';
@@ -815,23 +815,23 @@ elseif ($object->id > 0)
print $langs->trans("Usage");
print '';
print '';
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
- print 'usage_opportunity ? ' checked="checked"' : '')).'"> ';
+ print 'usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print ' ';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
- print 'usage_task ? ' checked="checked"' : '')).'"> ';
+ print 'usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print ' ';
}
- if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
+ if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
- print 'usage_bill_time ? ' checked="checked"' : '')).'"> ';
+ print 'usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print ' ';
@@ -842,16 +842,16 @@ elseif ($object->id > 0)
if ($conf->societe->enabled)
{
print ' | | ';
- print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'');
+ print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print $langs->trans("ThirdParty");
- print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'');
+ print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print ' | ';
- $filteronlist='';
- if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
- $text=$form->select_company($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), 0, 'minwidth300');
+ $filteronlist = '';
+ if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
+ $text = $form->select_company($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), 0, 'minwidth300');
if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
{
- $texthelp=$langs->trans("IfNeedToUseOtherObjectKeepEmpty");
+ $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
}
else print $text;
@@ -860,13 +860,13 @@ elseif ($object->id > 0)
// Visibility
print ' | | '.$langs->trans("Visibility").' | ';
- $array=array();
+ $array = array();
if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject");
if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject");
print $form->selectarray('public', $array, $object->public);
print ' | ';
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
// Opportunity status
print '| '.$langs->trans("OpportunityStatus").' | ';
@@ -881,33 +881,33 @@ elseif ($object->id > 0)
// Opportunity probability
print ' | '.$langs->trans("OpportunityProbability").' | ';
- print ' %';
+ print ' | %';
print '';
print ' | ';
print ' ';
// Opportunity amount
print '| '.$langs->trans("OpportunityAmount").' | ';
- print ' | ';
+ print ' | ';
print ' ';
}
// Date start
print '| '.$langs->trans("DateStart").' | ';
- print $form->selectDate($object->date_start?$object->date_start:-1, 'projectstart', 0, 0, 0, '', 1, 0);
+ print $form->selectDate($object->date_start ? $object->date_start : -1, 'projectstart', 0, 0, 0, '', 1, 0);
print ' '. $langs->trans("ProjectReportDate");
+ if ($comefromclone) {print ' checked '; }
+ print '/> '.$langs->trans("ProjectReportDate");
print ' | ';
// Date end
print '| '.$langs->trans("DateEnd").' | ';
- print $form->selectDate($object->date_end?$object->date_end:-1, 'projectend', 0, 0, 0, '', 1, 0);
+ print $form->selectDate($object->date_end ? $object->date_end : -1, 'projectend', 0, 0, 0, '', 1, 0);
print ' | ';
// Budget
print '| '.$langs->trans("Budget").' | ';
- print ' | ';
+ print ' | ';
print ' ';
// Description
@@ -923,7 +923,7 @@ elseif ($object->id > 0)
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_PROJECT);
- foreach($cats as $cat) {
+ foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
@@ -931,8 +931,8 @@ elseif ($object->id > 0)
}
// Other options
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -943,28 +943,28 @@ elseif ($object->id > 0)
}
else
{
- dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
+ dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
// Project card
$linkback = ''.$langs->trans("BackToList").'';
- $morehtmlref='';
+ $morehtmlref = ' ';
// Title
- $morehtmlref.=$object->title;
+ $morehtmlref .= $object->title;
// Thirdparty
- $morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ';
+ $morehtmlref .= ' '.$langs->trans('ThirdParty').' : ';
if ($object->thirdparty->id > 0)
{
$morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
}
- $morehtmlref.=' ';
+ $morehtmlref .= ' ';
// Define a complementary filter for search of next/prev ref.
- if (! $user->rights->projet->all->lire)
+ if (!$user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
- $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',', array_keys($objectsListId)):'0').")";
+ $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@@ -981,23 +981,23 @@ elseif ($object->id > 0)
print $langs->trans("Usage");
print '';
print '';
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
- print 'usage_opportunity ? ' checked="checked"' : '')).'"> ';
+ print 'usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print ' ';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
- print 'usage_task ? ' checked="checked"' : '')).'"> ';
+ print 'usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print ' ';
}
- if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
+ if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
- print 'usage_bill_time ? ' checked="checked"' : '')).'"> ';
+ print 'usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print ' ';
@@ -1010,7 +1010,7 @@ elseif ($object->id > 0)
else print $langs->trans('PrivateProject');
print ' | ';
- if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && ! empty($object->usage_opportunity))
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity))
{
// Opportunity status
print '| '.$langs->trans("OpportunityStatus").' | ';
@@ -1036,10 +1036,10 @@ elseif ($object->id > 0)
// Date start - end
print ' | | '.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").' | ';
$start = dol_print_date($object->date_start, 'day');
- print ($start?$start:'?');
+ print ($start ? $start : '?');
$end = dol_print_date($object->date_end, 'day');
print ' - ';
- print ($end?$end:'?');
+ print ($end ? $end : '?');
if ($object->hasDelay()) print img_warning("Late");
print ' | ';
@@ -1050,7 +1050,7 @@ elseif ($object->id > 0)
// Other attributes
$cols = 2;
- include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print ' ';
@@ -1067,7 +1067,7 @@ elseif ($object->id > 0)
print ' | ';
// Categories
- if($conf->categorie->enabled) {
+ if ($conf->categorie->enabled) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, 'project', 1);
print " | ";
@@ -1095,11 +1095,11 @@ elseif ($object->id > 0)
print '';
// Change probability from status
- if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
+ if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
// Default value to close or not when we set opp to 'WON'.
- $defaultcheckedwhenoppclose=1;
- if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0;
+ $defaultcheckedwhenoppclose = 1;
+ if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose = 0;
print '';
print '';
print ''."\n";
}
-if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)
-|| ! empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
+if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)
+|| !empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
{
// $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount
- $amount=0;
- if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
- $amount=$conf->global->MEMBER_NEWFORM_AMOUNT;
+ $amount = 0;
+ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
+ $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
}
- if (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
+ if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
{
- $amount=GETPOST('amount')?GETPOST('amount'):$conf->global->MEMBER_NEWFORM_AMOUNT;
+ $amount = GETPOST('amount') ?GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT;
}
// $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe'
print '| '.$langs->trans("Subscription").' | ';
- if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT))
+ if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT))
{
print '';
}
@@ -730,7 +730,7 @@ dol_fiche_end();
// Save
print '';
print ' ';
-if (! empty($backtopage))
+if (!empty($backtopage))
{
print ' ';
}
diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php
index e10186458fa..32a83e5c432 100644
--- a/htdocs/public/members/public_card.php
+++ b/htdocs/public/members/public_card.php
@@ -25,14 +25,14 @@
* \brief File to show a public card of a member
*/
-if (! defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
-if (! defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
-if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
+if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
-$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
+$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php';
@@ -46,7 +46,7 @@ if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
$langs->loadLangs(array("main", "members", "companies", "other"));
-$id=GETPOST('id', 'int');
+$id = GETPOST('id', 'int');
$object = new Adherent($db);
$extrafields = new ExtraFields($db);
@@ -64,9 +64,9 @@ $extrafields = new ExtraFields($db);
* View
*/
-$morehead='';
-if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead=' ';
-else $morehead=' ';
+$morehead = '';
+if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = ' ';
+else $morehead = ' ';
llxHeaderVierge($langs->trans("MemberCard"), $morehead);
@@ -75,9 +75,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
if ($id > 0)
{
- $res=$object->fetch($id);
+ $res = $object->fetch($id);
if ($res < 0) { dol_print_error($db, $object->error); exit; }
- $res=$object->fetch_optionals();
+ $res = $object->fetch_optionals();
print load_fiche_titre($langs->trans("MemberCard"), '', '');
@@ -101,7 +101,7 @@ if ($id > 0)
print ' | '.$langs->trans("EMail").' | '.$object->email.' | ';
print ' | '.$langs->trans("Birthday").' | '.dol_print_date($object->birth, 'day').' | ';
- if (isset($object->photo) && $object->photo !='')
+ if (isset($object->photo) && $object->photo != '')
{
$form = new Form($db);
print ' | URL Photo | ';
diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php
index 9829aa03f7b..834d5aa67ee 100644
--- a/htdocs/public/ticket/list.php
+++ b/htdocs/public/ticket/list.php
@@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","other","ticket"));
+$langs->loadLangs(array("companies", "other", "ticket"));
// Get parameters
$track_id = GETPOST('track_id', 'alpha');
@@ -117,7 +117,7 @@ if ($action == "view_ticketlist") {
}
}
if ($object->fk_user_create > 0) {
- $tmpuser=new User($db);
+ $tmpuser = new User($db);
$tmpuser->fetch($object->fk_user_create);
if ($email == $tmpuser->email) {
$display_ticket_list = true;
@@ -159,7 +159,7 @@ $user_create = new User($db);
$formTicket = new FormTicket($db);
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) {
- print ' ' . $langs->trans('TicketPublicInterfaceForbidden') . ' ';
+ print ''.$langs->trans('TicketPublicInterfaceForbidden').' ';
$db->close();
exit();
}
@@ -235,50 +235,50 @@ if ($action == "view_ticketlist")
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate') {
- $arrayfields["ef." . $key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => $extrafields->attributes[$object->table_element]['list'][$key], 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => $extrafields->attributes[$object->table_element]['perms'][$key]);
+ $arrayfields["ef.".$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => $extrafields->attributes[$object->table_element]['list'][$key], 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => $extrafields->attributes[$object->table_element]['perms'][$key]);
}
}
}
if (!empty($search_subject)) {
$filter['t.subject'] = $search_subject;
- $param .= '&search_subject=' .urlencode($search_subject);
+ $param .= '&search_subject='.urlencode($search_subject);
}
if (!empty($search_type)) {
$filter['t.type_code'] = $search_type;
- $param .= '&search_type=' . urlencode($search_type);
+ $param .= '&search_type='.urlencode($search_type);
}
if (!empty($search_category)) {
$filter['t.category_code'] = $search_category;
- $param .= '&search_category=' . urlencode($search_category);
+ $param .= '&search_category='.urlencode($search_category);
}
if (!empty($search_severity)) {
$filter['t.severity_code'] = $search_severity;
- $param .= '&search_severity=' . urlencode($search_severity);
+ $param .= '&search_severity='.urlencode($search_severity);
}
if (!empty($search_fk_user_assign)) {
// -1 value = all so no filter
if ($search_fk_user_assign > 0) {
$filter['t.fk_user_assign'] = $search_fk_user_assign;
- $param .= '&search_fk_user_assign=' . urlencode($search_fk_user_assign);
+ $param .= '&search_fk_user_assign='.urlencode($search_fk_user_assign);
}
}
if (!empty($search_fk_user_create)) {
// -1 value = all so no filter
if ($search_fk_user_create > 0) {
$filter['t.fk_user_create'] = $search_fk_user_create;
- $param .= '&search_fk_user_create=' . urlencode($search_fk_user_create);
+ $param .= '&search_fk_user_create='.urlencode($search_fk_user_create);
}
}
if ((isset($search_fk_status) && $search_fk_status != '') && $search_fk_status != '-1' && $search_fk_status != 'non_closed') {
$filter['t.fk_statut'] = $search_fk_status;
- $param .= '&search_fk_status=' . urlencode($search_fk_status);
+ $param .= '&search_fk_status='.urlencode($search_fk_status);
}
if (isset($search_fk_status) && $search_fk_status == 'non_closed') {
$filter['t.fk_statut'] = array(0, 1, 3, 4, 5, 6);
$param .= '&search_fk_status=non_closed';
}
- require DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
+ require DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
@@ -325,54 +325,54 @@ if ($action == "view_ticketlist")
// Add fields for extrafields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . ' as options_' . $key : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
- $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticket_type as type ON type.code=t.type_code";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticket_category as category ON category.code=t.category_code";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticket_severity as severity ON severity.code=t.severity_code";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid=t.fk_soc";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as uc ON uc.rowid=t.fk_user_create";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as ua ON ua.rowid=t.fk_user_assign";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON ec.element_id=t.rowid";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON ec.fk_c_type_contact=tc.rowid";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople sp ON ec.fk_socpeople=sp.rowid";
+ $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid=t.fk_user_create";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid=t.fk_user_assign";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id=t.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact=tc.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople=sp.rowid";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "ticket_extrafields as ef on (t.rowid = ef.fk_object)";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)";
}
- $sql .= " WHERE t.entity IN (" . getEntity('ticket') . ")";
+ $sql .= " WHERE t.entity IN (".getEntity('ticket').")";
$sql .= " AND ((tc.source = 'external'";
- $sql .= " AND tc.element='" . $db->escape($object->dao->element) . "'";
+ $sql .= " AND tc.element='".$db->escape($object->dao->element)."'";
$sql .= " AND tc.active=1)";
- $sql .= " OR (sp.email='" . $db->escape($_SESSION['email_customer']) . "'";
- $sql .= " OR s.email='" . $db->escape($_SESSION['email_customer']) . "'";
- $sql .= " OR t.origin_email='" . $db->escape($_SESSION['email_customer']) . "'))";
+ $sql .= " OR (sp.email='".$db->escape($_SESSION['email_customer'])."'";
+ $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'";
+ $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."'))";
// Manage filter
if (!empty($filter)) {
foreach ($filter as $key => $value) {
if (strpos($key, 'date')) { // To allow $filter['YEAR(s.dated)']=>$year
- $sql .= ' AND ' . $key . ' = \'' . $value . '\'';
+ $sql .= ' AND '.$key.' = \''.$value.'\'';
} elseif (($key == 't.fk_user_assign') || ($key == 't.type_code') || ($key == 't.category_code') || ($key == 't.severity_code')) {
- $sql .= " AND " . $key . " = '" . $db->escape($value) ."'";
+ $sql .= " AND ".$key." = '".$db->escape($value)."'";
} elseif ($key == 't.fk_statut') {
if (is_array($value) && count($value) > 0) {
- $sql .= 'AND ' . $key . ' IN (' . implode(',', $value) . ')';
+ $sql .= 'AND '.$key.' IN ('.implode(',', $value).')';
} else {
- $sql .= ' AND ' . $key . ' = ' . $db->escape($value);
+ $sql .= ' AND '.$key.' = '.$db->escape($value);
}
} else {
- $sql .= ' AND ' . $key . ' LIKE \'%' . $value . '%\'';
+ $sql .= ' AND '.$key.' LIKE \'%'.$value.'%\'';
}
}
}
//$sql .= " GROUP BY t.track_id";
- $sql .= " ORDER BY " . $sortfield . ' ' . $sortorder;
+ $sql .= " ORDER BY ".$sortfield.' '.$sortorder;
$resql = $db->query($sql);
if ($resql) {
$num_total = $db->num_rows($resql);
if (!empty($limit)) {
- $sql .= ' ' . $db->plimit($limit + 1, $offset);
+ $sql .= ' '.$db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
@@ -381,16 +381,16 @@ if ($action == "view_ticketlist")
print_barre_liste($langs->trans('TicketList'), $page, 'public/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
// Search bar
- print '' . "\n";
+ print ''."\n";
print '';
print '';
- print '';
- print '';
+ print '';
+ print '';
$varpage = empty($contextpage) ? $url_page_current : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
- print '';
+ print '';
// Filter bar
print '';
@@ -412,7 +412,7 @@ if ($action == "view_ticketlist")
if (!empty($arrayfields['t.subject']['checked'])) {
print '| ';
- print '';
+ print '';
print ' | ';
}
@@ -454,8 +454,8 @@ if ($action == "view_ticketlist")
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
- $parameters=array('arrayfields'=>$arrayfields);
- $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
+ $parameters = array('arrayfields'=>$arrayfields);
+ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
@@ -468,7 +468,7 @@ if ($action == "view_ticketlist")
// Action column
print '';
- $searchpicto=$form->showFilterButtons();
+ $searchpicto = $form->showFilterButtons();
print $searchpicto;
print ' | ';
print ' ';
@@ -516,8 +516,8 @@ if ($action == "view_ticketlist")
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
- $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
- $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
+ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['t.fk_statut']['checked'])) {
@@ -561,7 +561,7 @@ if ($action == "view_ticketlist")
// Subject
if (!empty($arrayfields['t.subject']['checked'])) {
print '';
- print '' . $obj->subject . '';
+ print ''.$obj->subject.'';
print ' | ';
}
@@ -620,20 +620,20 @@ if ($action == "view_ticketlist")
}
if (!empty($arrayfields['t.tms']['checked'])) {
- print '' . dol_print_date($db->jdate($obj->tms), 'dayhour') . ' | ';
+ print ''.dol_print_date($db->jdate($obj->tms), 'dayhour').' | ';
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- if (!empty($arrayfields["ef." . $key]['checked'])) {
+ if (!empty($arrayfields["ef.".$key]['checked'])) {
print 'getAlignFlag($key);
if ($align) {
- print ' align="' . $align . '"';
+ print ' align="'.$align.'"';
}
print '>';
- $tmpkey = 'options_' . $key;
+ $tmpkey = 'options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print ' | ';
}
@@ -657,8 +657,8 @@ if ($action == "view_ticketlist")
print ' ';
print '';
- print '';
- print '';
+ print '';
+ print '';
print '';
print '';
print '';
@@ -675,28 +675,28 @@ if ($action == "view_ticketlist")
}
}
} else {
- print '';
+ print '';
}
} else {
- print '' . $langs->trans("TicketPublicMsgViewLogIn") . ' ';
+ print ''.$langs->trans("TicketPublicMsgViewLogIn").' ';
print ' ';
print '';
- print ' ';
- print '';
+ print '';
+ print '';
print '';
//print '';
- print '';
- print '';
+ print ' ';
+ print '';
print ' ';
- print '';
- print '';
+ print ' ';
+ print '';
print ' ';
print '';
- print '';
+ print '';
print " \n";
print "\n";
diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php
index 79552539834..43e03ef4c07 100644
--- a/htdocs/public/ticket/view.php
+++ b/htdocs/public/ticket/view.php
@@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","other","ticket"));
+$langs->loadLangs(array("companies", "other", "ticket"));
// Get parameters
$track_id = GETPOST('track_id', 'alpha');
@@ -69,12 +69,12 @@ $object = new ActionsTicket($db);
if ($cancel)
{
- if (! empty($backtopage))
+ if (!empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
- $action='view_ticket';
+ $action = 'view_ticket';
}
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") {
@@ -155,20 +155,20 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
}
}
- if (! $error && $action == 'confirm_public_close' && $display_ticket)
+ if (!$error && $action == 'confirm_public_close' && $display_ticket)
{
if ($object->dao->close($user)) {
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
- $url = 'view.php?action=view_ticket&track_id=' . GETPOST('track_id', 'alpha');
- header("Location: " . $url);
+ $url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha');
+ header("Location: ".$url);
} else {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
}
}
- if (! $error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message'))
+ if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message'))
{
// TODO Add message...
$ret = $object->dao->newMessage($user, $action, 0);
@@ -176,7 +176,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
- if (! $error)
+ if (!$error)
{
$action = 'view_ticket';
}
@@ -198,10 +198,10 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
//$object->doActions($action);
// Actions to send emails (for ticket, we need to manage the addfile and removefile only)
-$trigger_name='TICKET_SENTBYMAIL';
-$paramname='id';
-$autocopy='MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to add
-$trackid='tic'.$object->id;
+$trigger_name = 'TICKET_SENTBYMAIL';
+$paramname = 'id';
+$autocopy = 'MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to add
+$trackid = 'tic'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
@@ -214,7 +214,7 @@ $form = new Form($db);
$formticket = new FormTicket($db);
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) {
- print ' ' . $langs->trans('TicketPublicInterfaceForbidden') . ' ';
+ print ' '.$langs->trans('TicketPublicInterfaceForbidden').' ';
$db->close();
exit();
}
@@ -231,7 +231,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
{
// Confirmation close
if ($action == 'close') {
- print $form->formconfirm($_SERVER["PHP_SELF"] . "?track_id=" . $track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
}
print ' | | | |
|
|
| |
|
|
|