Checkstyle
This commit is contained in:
parent
2ad1cf0665
commit
93ced076ac
@ -65,7 +65,7 @@ $selected=GETPOST('orders_to_invoice');
|
|||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
if (! is_array($selected))
|
if (! is_array($selected))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>';
|
$mesg='<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>';
|
||||||
}
|
}
|
||||||
@ -108,20 +108,20 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$orders_id = $_GET['orders_to_invoice'];
|
$orders_id = $_GET['orders_to_invoice'];
|
||||||
$n = count($orders_id);
|
$n = count($orders_id);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$originid=$orders_id[0];
|
$originid=$orders_id[0];
|
||||||
$_GET['originid']=$orders_id[0];
|
$_GET['originid']=$orders_id[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isset($_POST['orders_to_invoice']))
|
if (isset($_POST['orders_to_invoice']))
|
||||||
{
|
{
|
||||||
$orders_id = $_POST['orders_to_invoice'];
|
$orders_id = $_POST['orders_to_invoice'];
|
||||||
$nn = count($orders_id);
|
$nn = count($orders_id);
|
||||||
$ii = 0;
|
$ii = 0;
|
||||||
|
|
||||||
$originid=$orders_id[0];
|
$originid=$orders_id[0];
|
||||||
$_POST['originid']=$orders_id[0];
|
$_POST['originid']=$orders_id[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
|
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
|
||||||
$sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']);
|
$sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']);
|
||||||
@ -134,7 +134,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$lineid =GETPOST('lineid');
|
$lineid =GETPOST('lineid');
|
||||||
$userid =GETPOST('userid');
|
$userid =GETPOST('userid');
|
||||||
$search_ref =GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
|
$search_ref =GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = isset($_GET["ref"])?'facnumber':'rowid';
|
$fieldid = isset($_GET["ref"])?'facnumber':'rowid';
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@ -142,21 +142,21 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
|
|
||||||
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||||
$object=new Facture($db);
|
$object=new Facture($db);
|
||||||
|
|
||||||
// Insert new invoice in database
|
// Insert new invoice in database
|
||||||
if ($action == 'add' && $user->rights->facture->creer)
|
if ($action == 'add' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$object->socid=GETPOST('socid');
|
$object->socid=GETPOST('socid');
|
||||||
$db->begin();
|
$db->begin();
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Standard or deposit or proforma invoice
|
// Standard or deposit or proforma invoice
|
||||||
if ($_POST['type'] == 0 )
|
if ($_POST['type'] == 0 )
|
||||||
{
|
{
|
||||||
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
if (empty($datefacture))
|
if (empty($datefacture))
|
||||||
{
|
{
|
||||||
$datefacture = dol_mktime(12, 0 , 0, date("m"), date("d"), date("Y"));
|
$datefacture = dol_mktime(12, 0, 0, date("m"), date("d"), date("Y"));
|
||||||
}
|
}
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -176,14 +176,14 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$object->amount = $_POST['amount'];
|
$object->amount = $_POST['amount'];
|
||||||
$object->remise_absolue = $_POST['remise_absolue'];
|
$object->remise_absolue = $_POST['remise_absolue'];
|
||||||
$object->remise_percent = $_POST['remise_percent'];
|
$object->remise_percent = $_POST['remise_percent'];
|
||||||
|
|
||||||
if ($_POST['origin'] && $_POST['originid'])
|
if ($_POST['origin'] && $_POST['originid'])
|
||||||
{
|
{
|
||||||
$object->origin = $_POST['origin'];
|
$object->origin = $_POST['origin'];
|
||||||
$object->origin_id = $orders_id[$ii];
|
$object->origin_id = $orders_id[$ii];
|
||||||
$object->linked_objects = $orders_id;
|
$object->linked_objects = $orders_id;
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
|
|
||||||
if ($id>0)
|
if ($id>0)
|
||||||
{
|
{
|
||||||
foreach($orders_id as $origin => $origin_id)
|
foreach($orders_id as $origin => $origin_id)
|
||||||
@ -201,7 +201,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$sql.= ", ".$id;
|
$sql.= ", ".$id;
|
||||||
$sql.= ", '".$object->element."'";
|
$sql.= ", '".$object->element."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG);
|
||||||
if ($db->query($sql))
|
if ($db->query($sql))
|
||||||
{
|
{
|
||||||
@ -209,11 +209,11 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($ii < $nn)
|
while ($ii < $nn)
|
||||||
{
|
{
|
||||||
dol_include_once('/commande/class/commande.class.php');
|
dol_include_once('/commande/class/commande.class.php');
|
||||||
@ -270,34 +270,34 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||||
// Reset fk_parent_line for no child products and special product
|
// Reset fk_parent_line for no child products and special product
|
||||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
||||||
{
|
{
|
||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
}
|
}
|
||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
$id,
|
$id,
|
||||||
$desc,
|
$desc,
|
||||||
$lines[$i]->subprice,
|
$lines[$i]->subprice,
|
||||||
$lines[$i]->qty,
|
$lines[$i]->qty,
|
||||||
$lines[$i]->tva_tx,
|
$lines[$i]->tva_tx,
|
||||||
$lines[$i]->localtax1_tx,
|
$lines[$i]->localtax1_tx,
|
||||||
$lines[$i]->localtax2_tx,
|
$lines[$i]->localtax2_tx,
|
||||||
$lines[$i]->fk_product,
|
$lines[$i]->fk_product,
|
||||||
$lines[$i]->remise_percent,
|
$lines[$i]->remise_percent,
|
||||||
$date_start,
|
$date_start,
|
||||||
$date_end,
|
$date_end,
|
||||||
0,
|
0,
|
||||||
$lines[$i]->info_bits,
|
$lines[$i]->info_bits,
|
||||||
$lines[$i]->fk_remise_except,
|
$lines[$i]->fk_remise_except,
|
||||||
'HT',
|
'HT',
|
||||||
0,
|
0,
|
||||||
$product_type,
|
$product_type,
|
||||||
$lines[$i]->rang,
|
$lines[$i]->rang,
|
||||||
$lines[$i]->special_code,
|
$lines[$i]->special_code,
|
||||||
$object->origin,
|
$object->origin,
|
||||||
$lines[$i]->rowid,
|
$lines[$i]->rowid,
|
||||||
$fk_parent_line
|
$fk_parent_line
|
||||||
);
|
);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$lineid=$result;
|
$lineid=$result;
|
||||||
@ -309,7 +309,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Defined the new fk_parent_line
|
// Defined the new fk_parent_line
|
||||||
if ($result > 0 && $lines[$i]->product_type == 9)
|
if ($result > 0 && $lines[$i]->product_type == 9)
|
||||||
{
|
{
|
||||||
$fk_parent_line = $result;
|
$fk_parent_line = $result;
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
$ii++;
|
$ii++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -332,7 +332,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of object creation, we show it
|
// End of object creation, we show it
|
||||||
if ($id > 0 && ! $error)
|
if ($id > 0 && ! $error)
|
||||||
{
|
{
|
||||||
@ -349,7 +349,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -357,7 +357,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$htmlother = new FormOther($db);
|
$htmlother = new FormOther($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
// Mode creation
|
// Mode creation
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
@ -375,7 +375,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
}
|
}
|
||||||
$remise_absolue = 0;
|
$remise_absolue = 0;
|
||||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||||
|
|
||||||
$absolute_discount=$soc->getAvailableDiscounts();
|
$absolute_discount=$soc->getAvailableDiscounts();
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -438,7 +438,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||||
print '<td valign="top" colspan="2">';
|
print '<td valign="top" colspan="2">';
|
||||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||||
|
|
||||||
dol_include_once('/commande/class/commande.class.php');
|
dol_include_once('/commande/class/commande.class.php');
|
||||||
$srcobject = new Commande($db);
|
$srcobject = new Commande($db);
|
||||||
$commandes = $langs->trans("Orders").": ";
|
$commandes = $langs->trans("Orders").": ";
|
||||||
@ -460,22 +460,22 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||||
print '<td valign="top" colspan="2">';
|
print '<td valign="top" colspan="2">';
|
||||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||||
|
|
||||||
print '</textarea></td></tr>';
|
print '</textarea></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($i < $n)
|
while ($i < $n)
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="orders_to_invoice[]" value="'.$orders_id[$i].'">';
|
print '<input type="hidden" name="orders_to_invoice[]" value="'.$orders_id[$i].'">';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
// Button "Create Draft"
|
// Button "Create Draft"
|
||||||
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></center>';
|
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></center>';
|
||||||
@ -484,8 +484,8 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
|
|
||||||
|
|
||||||
//Mode liste
|
//Mode liste
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llxHeader();
|
llxHeader();
|
||||||
?>
|
?>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
@ -498,7 +498,7 @@ else
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||||
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
|
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
|
||||||
@ -565,7 +565,7 @@ else
|
|||||||
print_liste_field_titre($langs->trans('Status'),'','','','','align="right"');
|
print_liste_field_titre($langs->trans('Status'),'','','','','align="right"');
|
||||||
print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"');
|
print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
print '<form method="get" action="orderstoinvoice.php">';
|
print '<form method="get" action="orderstoinvoice.php">';
|
||||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||||
@ -577,21 +577,21 @@ else
|
|||||||
//print '<td class="liste_titre">';
|
//print '<td class="liste_titre">';
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" size="10" name="sref_client" value="'.$sref_client.'">';
|
print '<input class="flat" type="text" size="10" name="sref_client" value="'.$sref_client.'">';
|
||||||
|
|
||||||
//DATE ORDER
|
//DATE ORDER
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
print $period;
|
print $period;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
//DATE DELIVERY
|
//DATE DELIVERY
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
print $periodely;
|
print $periodely;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
//SEARCH BUTTON
|
//SEARCH BUTTON
|
||||||
print '</td><td align="right" class="liste_titre">';
|
print '</td><td align="right" class="liste_titre">';
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||||
|
|
||||||
//ALL/NONE
|
//ALL/NONE
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
||||||
@ -600,10 +600,10 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
|
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
|
||||||
$var=True;
|
$var=True;
|
||||||
$generic_commande = new Commande($db);
|
$generic_commande = new Commande($db);
|
||||||
|
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@ -637,7 +637,7 @@ else
|
|||||||
print '<td align="center" nowrap>';
|
print '<td align="center" nowrap>';
|
||||||
print dol_print_date($db->jdate($objp->date_commande),'day');
|
print dol_print_date($db->jdate($objp->date_commande),'day');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
//Delivery date
|
//Delivery date
|
||||||
print '<td align="center" nowrap>';
|
print '<td align="center" nowrap>';
|
||||||
print dol_print_date($db->jdate($objp->date_livraison),'day');
|
print dol_print_date($db->jdate($objp->date_livraison),'day');
|
||||||
@ -658,7 +658,7 @@ else
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
*/
|
*/
|
||||||
@ -675,7 +675,7 @@ else
|
|||||||
{
|
{
|
||||||
print dol_print_error($db);
|
print dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user