Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop Conflicts: htdocs/core/lib/functions2.lib.php htdocs/install/lib/repair.lib.php htdocs/install/mysql/migration/3.2.0-3.3.0.sql
@@ -203,11 +203,15 @@
|
|||||||
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
|
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCaptial">
|
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCaptial">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
|
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
|
||||||
|
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class modMyModule extends DolibarrModules
|
|||||||
// 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
|
// 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||||
// 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file
|
// 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file
|
||||||
// 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
|
// 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
|
||||||
// 'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) // Set here all workflow context managed by module
|
// 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module
|
||||||
// );
|
// );
|
||||||
$this->module_parts = array();
|
$this->module_parts = array();
|
||||||
|
|
||||||
|
|||||||
@@ -40,13 +40,6 @@ $id=GETPOST('id','int');
|
|||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@@ -120,7 +113,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file);
|
dol_delete_file($file);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -740,7 +740,7 @@ else
|
|||||||
// Forme juridique
|
// Forme juridique
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("JuridicalStatus").'</td><td>';
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("JuridicalStatus").'</td><td>';
|
||||||
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1);
|
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// ProfId1
|
// ProfId1
|
||||||
|
|||||||
@@ -77,34 +77,40 @@ print "</tr>\n";
|
|||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
$workflowcodes=array(
|
$workflowcodes=array(
|
||||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>($conf->propal->enabled && $conf->commande->enabled), 'picto'=>'order'),
|
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>($conf->propal->enabled && $conf->commande->enabled), 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
||||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>($conf->commande->enabled && $conf->facture->enabled), 'picto'=>'bill'),
|
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>($conf->facture->enabled && $conf->commande->enabled), 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) $workflow = array_merge($workflow, $conf->modules_parts['workflow']);
|
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
|
||||||
|
{
|
||||||
|
foreach($conf->modules_parts['workflow'] as $workflow)
|
||||||
|
{
|
||||||
|
$workflowcodes = array_merge($workflowcodes, $workflow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$nbqualified=0;
|
$nbqualified=0;
|
||||||
|
|
||||||
foreach($workflowcodes as $key => $tmparray)
|
foreach($workflowcodes as $key => $params)
|
||||||
{
|
{
|
||||||
$picto=$tmparray['picto'];
|
$picto=$params['picto'];
|
||||||
$enabled=$tmparray['enabled'];
|
$enabled=$params['enabled'];
|
||||||
if (empty($enabled)) continue;
|
if (! verifCond($enabled)) continue;
|
||||||
|
|
||||||
$nbqualified++;
|
$nbqualified++;
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var].">\n";
|
print "<tr ".$bc[$var].">\n";
|
||||||
print "<td>".img_object('', $picto).$langs->trans('desc'.$key);
|
print "<td>".img_object('', $picto).$langs->trans('desc'.$key);
|
||||||
if (! empty($tmparray['warning']))
|
if (! empty($params['warning']))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print ' '.img_warning($langs->transnoentitiesnoconv($tmparray['warning']));
|
print ' '.img_warning($langs->transnoentitiesnoconv($params['warning']));
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($conf->use_javascript_ajax)
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
print ajax_constantonoff($key);
|
print ajax_constantonoff($key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1084,21 +1084,28 @@ class Categorie
|
|||||||
*/
|
*/
|
||||||
function get_all_ways ()
|
function get_all_ways ()
|
||||||
{
|
{
|
||||||
$ways = array ();
|
$ways = array();
|
||||||
|
|
||||||
foreach ($this->get_meres() as $mere)
|
$parents=$this->get_meres();
|
||||||
|
if (! empty($parents))
|
||||||
{
|
{
|
||||||
foreach ($mere->get_all_ways() as $way)
|
foreach ($parents as $parent)
|
||||||
{
|
{
|
||||||
$w = $way;
|
$allways=$parent->get_all_ways();
|
||||||
$w[] = $this;
|
if (! empty($allways))
|
||||||
|
{
|
||||||
$ways[] = $w;
|
foreach ($allways as $way)
|
||||||
|
{
|
||||||
|
$w = $way;
|
||||||
|
$w[] = $this;
|
||||||
|
$ways[] = $w;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (count($ways) == 0)
|
if (count($ways) == 0)
|
||||||
$ways[0][0] = $this;
|
$ways[0][0] = $this;
|
||||||
|
}
|
||||||
|
|
||||||
return $ways;
|
return $ways;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ if ($action == 'setcustomeraccountancycode')
|
|||||||
$result=$object->update($object->id,$user,1,1,0);
|
$result=$object->update($object->id,$user,1,1,0);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg=join(',',$object->errors);
|
$mesgs[]=join(',',$object->errors);
|
||||||
}
|
}
|
||||||
$action="";
|
$action="";
|
||||||
}
|
}
|
||||||
@@ -158,11 +158,6 @@ if ($id > 0)
|
|||||||
dol_print_error($db,$object->error);
|
dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($errmesg)
|
|
||||||
{
|
|
||||||
print "<b>".$errmesg."</b><br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
@@ -821,6 +816,7 @@ else
|
|||||||
dol_print_error($db,'Bad value for socid parameter');
|
dol_print_error($db,'Bad value for socid parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_htmloutput_mesg('',$mesgs);
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@@ -41,13 +41,6 @@ $action=GETPOST('action','alpha');
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$urlfrom=GETPOST('urlfrom');
|
$urlfrom=GETPOST('urlfrom');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$object=new Mailing($db);
|
$object=new Mailing($db);
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
|
|
||||||
@@ -79,7 +72,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
|
|||||||
$object->substitutionarray,
|
$object->substitutionarray,
|
||||||
array(
|
array(
|
||||||
'__CHECK_READ__' => 'CheckMail',
|
'__CHECK_READ__' => 'CheckMail',
|
||||||
'__UNSUSCRIBE__' => 'Unsubscribe'
|
'__UNSUBSCRIBE__' => 'Unsubscribe'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -104,7 +97,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
|
|||||||
$object->substitutionarrayfortest,
|
$object->substitutionarrayfortest,
|
||||||
array(
|
array(
|
||||||
'__CHECK_READ__' => 'TESTCheckMail',
|
'__CHECK_READ__' => 'TESTCheckMail',
|
||||||
'__UNSUSCRIBE__' => 'TESTUnsubscribe'
|
'__UNSUBSCRIBE__' => 'TESTUnsubscribe'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -231,7 +224,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
|||||||
'__ID__' => $obj->source_id,
|
'__ID__' => $obj->source_id,
|
||||||
'__EMAIL__' => $obj->email,
|
'__EMAIL__' => $obj->email,
|
||||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||||
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
||||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
||||||
'__LASTNAME__' => $obj->nom,
|
'__LASTNAME__' => $obj->nom,
|
||||||
'__FIRSTNAME__' => $obj->prenom,
|
'__FIRSTNAME__' => $obj->prenom,
|
||||||
@@ -562,7 +555,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes')
|
|||||||
{
|
{
|
||||||
$object->valid($user);
|
$object->valid($user);
|
||||||
|
|
||||||
$_SESSION['DolMessage']='<div class="ok">'.$langs->trans("MailingSuccessfullyValidated").'</div>';
|
$_SESSION['dol_message']='<div class="ok">'.$langs->trans("MailingSuccessfullyValidated").'</div>';
|
||||||
|
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ $search_montant_ht=GETPOST('search_montant_ht','alpha');
|
|||||||
|
|
||||||
$sall=GETPOST("sall");
|
$sall=GETPOST("sall");
|
||||||
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||||
|
$mesgs=array();
|
||||||
$year=GETPOST("year");
|
$year=GETPOST("year");
|
||||||
$month=GETPOST("month");
|
$month=GETPOST("month");
|
||||||
|
|
||||||
@@ -824,8 +825,8 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
-1,
|
-1,
|
||||||
0,
|
0,
|
||||||
$_POST['fk_parent_line'],
|
$_POST['fk_parent_line'],
|
||||||
$fk_fournprice,
|
$fk_fournprice,
|
||||||
$pa_ht
|
$pa_ht
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@@ -863,7 +864,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour d'une ligne dans la propale
|
// Mise a jour d'une ligne dans la propale
|
||||||
else if ($action == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
|
else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('save') == $langs->trans("Save"))
|
||||||
{
|
{
|
||||||
if (! $object->fetch($_POST["id"]) > 0)
|
if (! $object->fetch($_POST["id"]) > 0)
|
||||||
{
|
{
|
||||||
@@ -922,9 +923,9 @@ else if ($action == 'updateligne' && $user->rights->propale->creer && $_POST["sa
|
|||||||
$info_bits,
|
$info_bits,
|
||||||
$special_code,
|
$special_code,
|
||||||
$_POST['fk_parent_line'],
|
$_POST['fk_parent_line'],
|
||||||
0,
|
0,
|
||||||
$fk_fournprice,
|
$fk_fournprice,
|
||||||
$pa_ht
|
$pa_ht
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
@@ -1266,7 +1267,7 @@ print $formconfirm;
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?page='.$page.'&socid='.$socid.'&viewstatut='.$viewstatut.'&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$langs->trans("BackToList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">';
|
||||||
@@ -1278,7 +1279,7 @@ print '<tr><td>';
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
||||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'refclient' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&id='.$object->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
|
if ($action != 'refclient' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&id='.$object->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="5">';
|
print '</td><td colspan="5">';
|
||||||
if ($user->rights->propale->creer && $action == 'refclient')
|
if ($user->rights->propale->creer && $action == 'refclient')
|
||||||
@@ -1337,10 +1338,10 @@ print '<td>';
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Date');
|
print $langs->trans('Date');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editdate' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
if ($action != 'editdate' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($object->brouillon && $action == 'editdate')
|
if (! empty($object->brouillon) && $action == 'editdate')
|
||||||
{
|
{
|
||||||
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@@ -1368,10 +1369,10 @@ print '<td>';
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('DateEndPropal');
|
print $langs->trans('DateEndPropal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editecheance' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editecheance&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
if ($action != 'editecheance' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editecheance&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($object->brouillon && $action == 'editecheance')
|
if (! empty($object->brouillon) && $action == 'editecheance')
|
||||||
{
|
{
|
||||||
print '<form name="editecheance" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
print '<form name="editecheance" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@@ -1382,7 +1383,7 @@ if ($object->brouillon && $action == 'editecheance')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($object->fin_validite)
|
if (! empty($object->fin_validite))
|
||||||
{
|
{
|
||||||
print dol_print_date($object->fin_validite,'daytext');
|
print dol_print_date($object->fin_validite,'daytext');
|
||||||
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||||
@@ -1400,7 +1401,7 @@ print '<tr><td>';
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentConditionsShort');
|
print $langs->trans('PaymentConditionsShort');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editconditions' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'</a></td>';
|
if ($action != 'editconditions' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($action == 'editconditions')
|
if ($action == 'editconditions')
|
||||||
@@ -1420,7 +1421,7 @@ print '<tr><td>';
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('DeliveryDate');
|
print $langs->trans('DeliveryDate');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editdate_livraison' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'</a></td>';
|
if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($action == 'editdate_livraison')
|
if ($action == 'editdate_livraison')
|
||||||
@@ -1443,9 +1444,9 @@ print '</tr>';
|
|||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('AvailabilityPeriod');
|
print $langs->trans('AvailabilityPeriod');
|
||||||
if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')';
|
if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editavailability' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'</a></td>';
|
if ($action != 'editavailability' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($action == 'editavailability')
|
if ($action == 'editavailability')
|
||||||
@@ -1465,7 +1466,7 @@ print '<tr><td>';
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Source');
|
print $langs->trans('Source');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'</a></td>';
|
if ($action != 'editdemandreason' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
//print $object->demand_reason_id;
|
//print $object->demand_reason_id;
|
||||||
@@ -1487,7 +1488,7 @@ print '<td width="25%">';
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentMode');
|
print $langs->trans('PaymentMode');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editmode' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'</a></td>';
|
if ($action != 'editmode' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($action == 'editmode')
|
if ($action == 'editmode')
|
||||||
@@ -1501,7 +1502,7 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if ($conf->projet->enabled)
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
@@ -1525,7 +1526,7 @@ if ($conf->projet->enabled)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
if (!empty($object->fk_project))
|
if (! empty($object->fk_project))
|
||||||
{
|
{
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
@@ -1732,7 +1733,7 @@ if ($action != 'presend')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create an order
|
// Create an order
|
||||||
if ($conf->commande->enabled && $object->statut == 2 && $user->societe_id == 0)
|
if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0)
|
||||||
{
|
{
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
@@ -1763,9 +1764,9 @@ if ($action != 'presend')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
if ($object->type == 0 && $user->rights->propale->creer)
|
if ($user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=propal">'.$langs->trans("ToClone").'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'">'.$langs->trans("ToClone").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -39,20 +39,14 @@ $confirm = GETPOST('confirm','alpha');
|
|||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$ref = GETPOST('ref','alpha');
|
$ref = GETPOST('ref','alpha');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id)
|
$socid='';
|
||||||
|
if (! empty($user->societe_id))
|
||||||
{
|
{
|
||||||
$action='';
|
$action='';
|
||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'propale', $id, 'propal');
|
$result = restrictedArea($user, 'propal', $id);
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
@@ -77,7 +71,7 @@ if ($object->id > 0)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Envoi fichier
|
// Envoi fichier
|
||||||
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
@@ -131,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -165,7 +159,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
print '<table class="border"width="100%">';
|
print '<table class="border"width="100%">';
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder".'">'.$langs->trans("BackToList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||||
@@ -201,13 +195,13 @@ if ($object->id > 0)
|
|||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche formulaire upload
|
// Affiche formulaire upload
|
||||||
$formfile=new FormFile($db);
|
$formfile=new FormFile($db);
|
||||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
|
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
|
||||||
|
|
||||||
|
|
||||||
// List of document
|
// List of document
|
||||||
@@ -219,7 +213,6 @@ else
|
|||||||
print $langs->trans("UnkownError");
|
print $langs->trans("UnkownError");
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -40,13 +40,6 @@ $confirm = GETPOST('confirm');
|
|||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$ref = GETPOST('ref');
|
$ref = GETPOST('ref');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id)
|
if ($user->societe_id)
|
||||||
{
|
{
|
||||||
@@ -74,7 +67,7 @@ $object = new Commande($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Envoi fichier
|
// Envoi fichier
|
||||||
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
if ($object->fetch($id))
|
if ($object->fetch($id))
|
||||||
{
|
{
|
||||||
@@ -129,7 +122,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
if (! is_array($selected))
|
if (! is_array($selected))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -80,9 +80,9 @@ $htmlother = new FormOther($db);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (($action == 'create' || $action == 'add') && ! $mesg )
|
if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
@@ -92,8 +92,10 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.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/lib/date.lib.php");
|
||||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
if (! empty($conf->projet->enabled)) {
|
||||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
|
||||||
|
}
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
@@ -117,7 +119,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$_POST['originid']=$orders_id[0];
|
$_POST['originid']=$orders_id[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
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']);
|
||||||
$projectid=isset($_GET['projectid'])?$_GET['projectid']:0;
|
$projectid=isset($_GET['projectid'])?$_GET['projectid']:0;
|
||||||
$id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility
|
$id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility
|
||||||
@@ -242,7 +243,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$discount->error;
|
$mesgs[]=$discount->error;
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -310,7 +311,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$srcobject->error;
|
$mesgs[]=$srcobject->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
$ii++;
|
$ii++;
|
||||||
@@ -318,7 +319,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesgs[]=$object->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,7 +339,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
$action='create';
|
$action='create';
|
||||||
$_GET["origin"]=$_POST["origin"];
|
$_GET["origin"]=$_POST["origin"];
|
||||||
$_GET["originid"]=$_POST["originid"];
|
$_GET["originid"]=$_POST["originid"];
|
||||||
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,9 +355,10 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
print_fiche_titre($langs->trans('NewBill'));
|
print_fiche_titre($langs->trans('NewBill'));
|
||||||
dol_htmloutput_mesg($mesg);
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
if ($socid) $res=$soc->fetch($socid);
|
if ($socid) $res=$soc->fetch($socid);
|
||||||
if ($res)
|
if ($res)
|
||||||
@@ -474,7 +476,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
|
|||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Mode liste
|
//Mode liste
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -669,8 +670,8 @@ else
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
dol_htmloutput_mesg($mesg,$mesgs);
|
||||||
dol_htmloutput_mesg($mesg);
|
|
||||||
llxFooter();
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,9 +12,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
* or see http://www.gnu.org/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,33 +21,24 @@
|
|||||||
* \brief Page to setup advanced commissions module
|
* \brief Page to setup advanced commissions module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$res=@include("../main.inc.php"); // For root directory
|
include("../../main.inc.php");
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/commissions/lib/commissions.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/commissions/lib/commissions.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("commissions");
|
$langs->load("commissions");
|
||||||
|
|
||||||
if (!$user->admin)
|
if (! $user->admin) accessforbidden();
|
||||||
accessforbidden();
|
|
||||||
|
|
||||||
// init
|
|
||||||
if ($conf->global->COMMISSION_BASE == "") {
|
|
||||||
if ($conf->marges->enabled)
|
|
||||||
$conf->global->COMMISSION_BASE = "MARGES";
|
|
||||||
else
|
|
||||||
$conf->global->COMMISSION_BASE = "CA";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
if (isset($_POST['commissionBase']))
|
if (GETPOST('commissionBase'))
|
||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, 'COMMISSION_BASE', $_POST['commissionBase'], 'string', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, 'COMMISSION_BASE', GETPOST('commissionBase'), 'string', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
$conf->global->COMMISSION_BASE = $_POST['commissionBase'];
|
$conf->global->COMMISSION_BASE = GETPOST('commissionBase');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -57,9 +46,9 @@ if (isset($_POST['commissionBase']))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['productCommissionRate']))
|
if (GETPOST('productCommissionRate'))
|
||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', $_POST['productCommissionRate'], 'rate', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', GETPOST('productCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -68,9 +57,9 @@ if (isset($_POST['productCommissionRate']))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['serviceCommissionRate']))
|
if (GETPOST('serviceCommissionRate'))
|
||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', $_POST['serviceCommissionRate'], 'rate', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', GETPOST('serviceCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -91,7 +80,7 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
|
|||||||
print_fiche_titre($langs->trans("commissionsSetup"),$linkback,'setup');
|
print_fiche_titre($langs->trans("commissionsSetup"),$linkback,'setup');
|
||||||
|
|
||||||
|
|
||||||
$head = commissions_admin_prepare_head($adh);
|
$head = commissions_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'parameters', $langs->trans("Commissions"), 0, 'commissions');
|
dol_fiche_head($head, 'parameters', $langs->trans("Commissions"), 0, 'commissions');
|
||||||
|
|
||||||
@@ -111,21 +100,21 @@ $form = new Form($db);
|
|||||||
|
|
||||||
print '<form method="post">';
|
print '<form method="post">';
|
||||||
|
|
||||||
// COMMISSION BASE (CA / MARGES)
|
// COMMISSION BASE (TURNOVER / MARGIN)
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$langs->trans("CommissionBase").'</td>';
|
print '<td>'.$langs->trans("CommissionBase").'</td>';
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print '<input type="radio" name="commissionBase" value="CA" ';
|
print '<input type="radio" name="commissionBase" value="TURNOVER" ';
|
||||||
if ($conf->global->COMMISSION_BASE == "CA")
|
if (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "TURNOVER")
|
||||||
print 'checked';
|
print 'checked';
|
||||||
print ' />';
|
print ' />';
|
||||||
print $langs->trans("CommissionBasedOnCA");
|
print $langs->trans("CommissionBasedOnTurnover");
|
||||||
print '<br/>';
|
print '<br/>';
|
||||||
print '<input type="radio" name="commissionBase" value="MARGES" ';
|
print '<input type="radio" name="commissionBase" value="MARGIN" ';
|
||||||
if (!$conf->marges->enabled)
|
if (empty($conf->margin->enabled))
|
||||||
print 'disabled';
|
print 'disabled';
|
||||||
elseif ($conf->global->COMMISSION_BASE == "MARGES")
|
elseif (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "MARGIN")
|
||||||
print 'checked';
|
print 'checked';
|
||||||
print ' />';
|
print ' />';
|
||||||
print $langs->trans("CommissionBasedOnMargins");
|
print $langs->trans("CommissionBasedOnMargins");
|
||||||
@@ -141,7 +130,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$langs->trans("ProductCommissionRate").'</td>';
|
print '<td>'.$langs->trans("ProductCommissionRate").'</td>';
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print '<input type="text" name="productCommissionRate" value="'.$conf->global->PRODUCT_COMMISSION_RATE.'" size=6 /> %';
|
print '<input type="text" name="productCommissionRate" value="'.(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:'').'" size=6 /> %';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans('ProductCommissionRateDetails').'</td>';
|
print '<td>'.$langs->trans('ProductCommissionRateDetails').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@@ -151,7 +140,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$langs->trans("ServiceCommissionRate").'</td>';
|
print '<td>'.$langs->trans("ServiceCommissionRate").'</td>';
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print '<input type="text" name="serviceCommissionRate" value="'.$conf->global->SERVICE_COMMISSION_RATE.'" size=6 /> %';
|
print '<input type="text" name="serviceCommissionRate" value="'.(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:'').'" size=6 /> %';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans('ServiceCommissionRateDetails').'</td>';
|
print '<td>'.$langs->trans('ServiceCommissionRateDetails').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@@ -169,7 +158,7 @@ print '<br>';
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter('$Date: 2011/07/31 22:23:21 $ - $Revision: 1.6 $');
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
@@ -48,10 +48,12 @@ $offset = $conf->liste_limit * $page;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
$startdate=$enddate='';
|
||||||
|
|
||||||
if (!empty($_POST['startdatemonth']))
|
if (!empty($_POST['startdatemonth']))
|
||||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||||
if (!empty($_POST['enddatemonth']))
|
if (!empty($_POST['enddatemonth']))
|
||||||
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
|
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@@ -90,7 +92,7 @@ else {
|
|||||||
if (! $sortfield) $sortfield="u.login";
|
if (! $sortfield) $sortfield="u.login";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date d<>but
|
// Start date
|
||||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||||
print '<td width="20%">';
|
print '<td width="20%">';
|
||||||
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
|
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
|
||||||
@@ -106,22 +108,22 @@ print '</td></tr>';
|
|||||||
// Include unpayed invoices
|
// Include unpayed invoices
|
||||||
print '<tr><td>'.$langs->trans("IncludeUnpayedInvoices").'</td><td colspan="4">';
|
print '<tr><td>'.$langs->trans("IncludeUnpayedInvoices").'</td><td colspan="4">';
|
||||||
print '<input id="selIncluded" type="checkbox" name="unpayed" ';
|
print '<input id="selIncluded" type="checkbox" name="unpayed" ';
|
||||||
if ($_REQUEST['unpayed'] == 'on')
|
if (GETPOST('unpayed') == 'on')
|
||||||
print 'checked ';
|
print 'checked ';
|
||||||
print '/>';
|
print '/>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
// Total Margin
|
// Total Margin
|
||||||
if ($conf->global->COMMISSION_BASE == "MARGES") {
|
if ($conf->global->COMMISSION_BASE == "MARGIN") {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||||
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
elseif ($conf->global->COMMISSION_BASE == "CA") {
|
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("CATotal").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("TurnoverTotal").'</td><td colspan="4">';
|
||||||
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total Commission
|
// Total Commission
|
||||||
@@ -135,13 +137,13 @@ print '</form>';
|
|||||||
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,";
|
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,";
|
||||||
$sql.= " u.login,";
|
$sql.= " u.login,";
|
||||||
$sql.= " f.facnumber, f.total as total_ht,";
|
$sql.= " f.facnumber, f.total as total_ht,";
|
||||||
if ($conf->global->COMMISSION_BASE == "MARGES") {
|
if ($conf->global->COMMISSION_BASE == "MARGIN") {
|
||||||
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ;
|
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ;
|
||||||
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase," ;
|
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase," ;
|
||||||
}
|
}
|
||||||
elseif ($conf->global->COMMISSION_BASE == "CA") {
|
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
|
||||||
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ;
|
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ;
|
||||||
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase," ;
|
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase," ;
|
||||||
}
|
}
|
||||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
@@ -152,13 +154,13 @@ $sql.= ", ".MAIN_DB_PREFIX."user as u";
|
|||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " AND sc.fk_soc = f.fk_soc";
|
$sql.= " AND sc.fk_soc = f.fk_soc";
|
||||||
$sql.= " AND sc.fk_user = u.rowid";
|
$sql.= " AND sc.fk_user = u.rowid";
|
||||||
if ($_REQUEST['unpayed'] == 'on')
|
if (GETPOST('unpayed') == 'on')
|
||||||
$sql.= " AND f.fk_statut > 0";
|
$sql.= " AND f.fk_statut > 0";
|
||||||
else
|
else
|
||||||
$sql.= " AND f.fk_statut > 1";
|
$sql.= " AND f.fk_statut > 1";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
$sql.= " AND d.fk_facture = f.rowid";
|
$sql.= " AND d.fk_facture = f.rowid";
|
||||||
if ($conf->global->COMMISSION_BASE == "MARGES")
|
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||||
$sql.= " AND d.buy_price_ht IS NOT NULL AND d.buy_price_ht <> 0";
|
$sql.= " AND d.buy_price_ht IS NOT NULL AND d.buy_price_ht <> 0";
|
||||||
if ($agentid > 0)
|
if ($agentid > 0)
|
||||||
$sql.= " AND sc.fk_user = $agentid";
|
$sql.= " AND sc.fk_user = $agentid";
|
||||||
@@ -178,37 +180,38 @@ if ($result)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_barre_liste($langs->trans("CommissionDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',$num,0,'');
|
print_barre_liste($langs->trans("CommissionDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if ($agentid > 0)
|
if ($agentid > 0)
|
||||||
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||||
else
|
else
|
||||||
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||||
|
|
||||||
// product commission
|
// product commission
|
||||||
if ($conf->global->COMMISSION_BASE == "MARGES")
|
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||||
print_liste_field_titre($langs->trans("ProductMargin"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ProductMargin"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
elseif ($conf->global->COMMISSION_BASE == "CA")
|
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
|
||||||
print_liste_field_titre($langs->trans("ProductCA"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ProductTurnover"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
|
|
||||||
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ProductCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ProductCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
|
|
||||||
// service commission
|
// service commission
|
||||||
if ($conf->global->COMMISSION_BASE == "MARGES")
|
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||||
print_liste_field_titre($langs->trans("ServiceMargin"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ServiceMargin"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
elseif ($conf->global->COMMISSION_BASE == "CA")
|
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
|
||||||
print_liste_field_titre($langs->trans("ServiceCA"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ServiceTurnover"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
|
|
||||||
|
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("ServiceCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
|
|
||||||
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("ServiceCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
|
||||||
// total commission
|
// total commission
|
||||||
print_liste_field_titre($langs->trans("TotalCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("TotalCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@@ -227,32 +230,39 @@ if ($result)
|
|||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
if ($agentid > 0) {
|
if ($agentid > 0) {
|
||||||
$companystatic->id=$objp->socid;
|
$companystatic->id=$objp->socid;
|
||||||
$companystatic->nom=$objp->nom;
|
$companystatic->nom=$objp->nom;
|
||||||
$companystatic->client=$objp->client;
|
$companystatic->client=$objp->client;
|
||||||
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$userstatic->id=$objp->agent;
|
$userstatic->id=$objp->agent;
|
||||||
$userstatic->login=$objp->login;
|
$userstatic->login=$objp->login;
|
||||||
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
|
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
|
||||||
}
|
}
|
||||||
// product commission
|
|
||||||
$productCommission = $conf->global->PRODUCT_COMMISSION_RATE * $objp->productBase / 100;
|
// product commission
|
||||||
print "<td align=\"right\">".price($objp->productBase)."</td>\n";
|
$productCommissionRate=(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0);
|
||||||
print "<td align=\"right\">".price($conf->global->PRODUCT_COMMISSION_RATE)."</td>\n";
|
$productBase=(! empty($objp->productBase)?$objp->productBase:0);
|
||||||
|
$productCommission = (! empty($productBase)?($productCommissionRate * $productBase / 100):0);
|
||||||
|
print "<td align=\"right\">".price($productBase)."</td>\n";
|
||||||
|
print "<td align=\"right\">".price($productCommissionRate)."</td>\n";
|
||||||
print "<td align=\"right\">".price($productCommission)."</td>\n";
|
print "<td align=\"right\">".price($productCommission)."</td>\n";
|
||||||
// service commission
|
|
||||||
$serviceCommission = $conf->global->SERVICE_COMMISSION_RATE * $objp->serviceBase / 100;
|
// service commission
|
||||||
print "<td align=\"right\">".price($objp->serviceBase)."</td>\n";
|
$serviceCommissionRate=(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0);
|
||||||
print "<td align=\"right\">".price($conf->global->SERVICE_COMMISSION_RATE)."</td>\n";
|
$serviceBase=(! empty($objp->serviceBase)?$objp->serviceBase:0);
|
||||||
|
$serviceCommission = (! empty($serviceBase)?($serviceCommissionRate * $serviceBase / 100):0);
|
||||||
|
print "<td align=\"right\">".price($serviceBase)."</td>\n";
|
||||||
|
print "<td align=\"right\">".price($serviceCommissionRate)."</td>\n";
|
||||||
print "<td align=\"right\">".price($serviceCommission)."</td>\n";
|
print "<td align=\"right\">".price($serviceCommission)."</td>\n";
|
||||||
|
|
||||||
// total commission
|
// total commission
|
||||||
print "<td align=\"right\">".price($productCommission + $serviceCommission)."</td>\n";
|
print "<td align=\"right\">".price($productCommission + $serviceCommission)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
$cumul_base_produit += $objp->productBase;
|
$cumul_base_produit += $productBase;
|
||||||
$cumul_base_service += $objp->serviceBase;
|
$cumul_base_service += $serviceBase;
|
||||||
$cumul_commission_produit += $productCommission;
|
$cumul_commission_produit += $productCommission;
|
||||||
$cumul_commission_service += $serviceCommission;
|
$cumul_commission_service += $serviceCommission;
|
||||||
}
|
}
|
||||||
@@ -261,25 +271,25 @@ if ($result)
|
|||||||
// affichage totaux commission
|
// affichage totaux commission
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||||
if ($client)
|
if (! empty($client))
|
||||||
print '<td colspan=2>';
|
print '<td colspan=2>';
|
||||||
else
|
else
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans('TotalCommission')."</td>";
|
print $langs->trans('TotalCommission')."</td>";
|
||||||
// product commission
|
// product commission
|
||||||
print "<td align=\"right\">".price($cumul_base_produit)."</td>\n";
|
print "<td align=\"right\">".price($cumul_base_produit)."</td>\n";
|
||||||
print "<td align=\"right\">".price($conf->global->PRODUCT_COMMISSION_RATE)."</td>\n";
|
print "<td align=\"right\">".price((! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0))."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_commission_produit)."</td>\n";
|
print "<td align=\"right\">".price($cumul_commission_produit)."</td>\n";
|
||||||
// service commission
|
// service commission
|
||||||
print "<td align=\"right\">".price($cumul_base_service)."</td>\n";
|
print "<td align=\"right\">".price($cumul_base_service)."</td>\n";
|
||||||
print "<td align=\"right\">".price($conf->global->SERVICE_COMMISSION_RATE)."</td>\n";
|
print "<td align=\"right\">".price((! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0))."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_commission_service)."</td>\n";
|
print "<td align=\"right\">".price($cumul_commission_service)."</td>\n";
|
||||||
// total commission
|
// total commission
|
||||||
print "<td align=\"right\">".price($cumul_commission_produit + $cumul_commission_service)."</td>\n";
|
print "<td align=\"right\">".price($cumul_commission_produit + $cumul_commission_service)."</td>\n";
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function commissions_admin_prepare_head()
|
|||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'commissionsadmin');
|
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ $langs->load('main');
|
|||||||
if (! empty($conf->margin->enabled))
|
if (! empty($conf->margin->enabled))
|
||||||
$langs->load('margins');
|
$langs->load('margins');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
$errors=array();
|
|
||||||
|
|
||||||
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
|
|
||||||
|
|
||||||
$sall=trim(GETPOST('sall'));
|
$sall=trim(GETPOST('sall'));
|
||||||
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
||||||
|
|
||||||
@@ -116,7 +111,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
|
|||||||
{
|
{
|
||||||
if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -130,7 +125,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesgs[]=$object->error;
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +147,7 @@ else if ($action == 'reopen' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +165,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +201,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div clas="error">'.$object->error.'</div>';
|
$mesgs[]='<div clas="error">'.$object->error.'</div>';
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +225,7 @@ else if ($action == 'valid' && $user->rights->facture->creer)
|
|||||||
// Si avoir, le signe doit etre negatif
|
// Si avoir, le signe doit etre negatif
|
||||||
if ($object->total_ht >= 0)
|
if ($object->total_ht >= 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'</div>';
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +234,7 @@ else if ($action == 'valid' && $user->rights->facture->creer)
|
|||||||
// Si non avoir, le signe doit etre positif
|
// Si non avoir, le signe doit etre positif
|
||||||
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0)
|
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'</div>';
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,7 +301,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
|||||||
$result=$object->insert_discount($_POST["remise_id"]);
|
$result=$object->insert_discount($_POST["remise_id"]);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -323,7 +318,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
|||||||
$result=$discount->link_to_invoice(0,$id);
|
$result=$discount->link_to_invoice(0,$id);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$discount->error.'</div>';
|
$mesgs[]='<div class="error">'.$discount->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,7 +357,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
|||||||
if (! $idwarehouse || $idwarehouse == -1)
|
if (! $idwarehouse || $idwarehouse == -1)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse"));
|
$mesgs[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse"));
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,7 +385,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,7 +404,7 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
|
|||||||
if (! $idwarehouse || $idwarehouse == -1)
|
if (! $idwarehouse || $idwarehouse == -1)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse"));
|
$mesgs[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse"));
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,7 +481,7 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Classify "abandoned"
|
// Classify "abandoned"
|
||||||
@@ -501,7 +496,7 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,18 +555,18 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
|
|||||||
$result=$object->set_paid($user);
|
$result=$object->set_paid($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
//$mesg='OK'.$discount->id;
|
//$mesgs[]='OK'.$discount->id;
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$discount->error.'</div>';
|
$mesgs[]='<div class="error">'.$discount->error.'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -595,13 +590,13 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
if (empty($datefacture))
|
if (empty($datefacture))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! ($_POST['fac_replacement'] > 0))
|
if (! ($_POST['fac_replacement'] > 0))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@@ -627,7 +622,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$object->type = 1;
|
$object->type = 1;
|
||||||
|
|
||||||
$id=$object->createFromCurrent($user);
|
$id=$object->createFromCurrent($user);
|
||||||
if ($id <= 0) $mesg=$object->error;
|
if ($id <= 0) $mesgs[]=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,14 +632,14 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
if (! $_POST['fac_avoir'] > 0)
|
if (! $_POST['fac_avoir'] > 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$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))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@@ -696,7 +691,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
if (empty($datefacture))
|
if (empty($datefacture))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@@ -725,7 +720,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
if (empty($datefacture))
|
if (empty($datefacture))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@@ -816,7 +811,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$discount->error;
|
$mesgs[]=$discount->error;
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -866,8 +861,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$object->origin,
|
$object->origin,
|
||||||
$lines[$i]->rowid,
|
$lines[$i]->rowid,
|
||||||
$fk_parent_line,
|
$fk_parent_line,
|
||||||
$lines[$i]->fk_fournprice,
|
$lines[$i]->fk_fournprice,
|
||||||
$lines[$i]->pa_ht
|
$lines[$i]->pa_ht
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@@ -895,13 +890,13 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$srcobject->error;
|
$mesgs[]=$srcobject->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesgs[]=$object->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -938,7 +933,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$action='create';
|
$action='create';
|
||||||
$_GET["origin"]=$_POST["origin"];
|
$_GET["origin"]=$_POST["origin"];
|
||||||
$_GET["originid"]=$_POST["originid"];
|
$_GET["originid"]=$_POST["originid"];
|
||||||
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -950,27 +945,27 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
|||||||
if ($_POST['np_price'] < 0 && $_POST["qty"] < 0)
|
if ($_POST['np_price'] < 0 && $_POST["qty"] < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
if (empty($_POST['idprod']) && $_POST["type"] < 0)
|
if (empty($_POST['idprod']) && $_POST["type"] < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not ''
|
if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not ''
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
if (empty($_POST['idprod']) && empty($_POST["np_desc"]) && empty($_POST["dp_desc"]))
|
if (empty($_POST['idprod']) && empty($_POST["np_desc"]) && empty($_POST["dp_desc"]))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
if (! isset($_POST['qty']) || $_POST['qty']=='')
|
if (! isset($_POST['qty']) || $_POST['qty']=='')
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
if ($result >= 0 && ( ($_POST['np_price']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'] ) )
|
if ($result >= 0 && ( ($_POST['np_price']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'] ) )
|
||||||
@@ -1119,8 +1114,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
|||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
GETPOST('fk_parent_line'),
|
GETPOST('fk_parent_line'),
|
||||||
$fk_fournprice,
|
$fk_fournprice,
|
||||||
$pa_ht
|
$pa_ht
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1155,7 +1150,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($mesg)) $mesg='<div class="error">'.$object->error.'</div>';
|
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
@@ -1194,7 +1189,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if (! GETPOST('productid') && GETPOST("type") < 0)
|
if (! GETPOST('productid') && GETPOST("type") < 0)
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
$mesgs[] = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||||
$result = -1 ;
|
$result = -1 ;
|
||||||
}
|
}
|
||||||
// Check minimum price
|
// Check minimum price
|
||||||
@@ -1210,7 +1205,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
|
|||||||
if ($object->type!=2 && $price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
|
if ($object->type!=2 && $price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
|
||||||
{
|
{
|
||||||
//print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
|
//print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
|
||||||
$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'</div>';
|
$mesgs[] = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'</div>';
|
||||||
$result=-1;
|
$result=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1236,9 +1231,9 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
|
|||||||
$info_bits,
|
$info_bits,
|
||||||
$type,
|
$type,
|
||||||
GETPOST('fk_parent_line'),
|
GETPOST('fk_parent_line'),
|
||||||
0,
|
0,
|
||||||
$fk_fournprice,
|
$fk_fournprice,
|
||||||
$pa_ht
|
$pa_ht
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
@@ -1328,7 +1323,7 @@ if (GETPOST('addfile'))
|
|||||||
$vardir=$conf->user->dir_output."/".$user->id;
|
$vardir=$conf->user->dir_output."/".$user->id;
|
||||||
$upload_dir_tmp = $vardir.'/temp';
|
$upload_dir_tmp = $vardir.'/temp';
|
||||||
|
|
||||||
$mesg=dol_add_file_process($upload_dir_tmp,0,0);
|
$mesgs[]=dol_add_file_process($upload_dir_tmp,0,0);
|
||||||
|
|
||||||
$action='presend';
|
$action='presend';
|
||||||
}
|
}
|
||||||
@@ -1345,7 +1340,7 @@ if (! empty($_POST['removedfile']))
|
|||||||
$upload_dir_tmp = $vardir.'/temp';
|
$upload_dir_tmp = $vardir.'/temp';
|
||||||
|
|
||||||
// TODO Delete only files that was uploaded from email form
|
// TODO Delete only files that was uploaded from email form
|
||||||
$mesg=dol_remove_file_process($_POST['removedfile'],0);
|
$mesgs[]=dol_remove_file_process($_POST['removedfile'],0);
|
||||||
|
|
||||||
$action='presend';
|
$action='presend';
|
||||||
}
|
}
|
||||||
@@ -1476,8 +1471,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
{
|
{
|
||||||
// Redirect here
|
// Redirect here
|
||||||
// This avoid sending mail twice if going out and then back to page
|
// This avoid sending mail twice if going out and then back to page
|
||||||
$_SESSION['message'] = $mesg;
|
$_SESSION['dol_message'] = $mesg;
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&mesg=1');
|
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1495,27 +1490,28 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||||
}
|
}
|
||||||
$mesg.='</div>';
|
$mesg.='</div>';
|
||||||
|
$mesgs[]=$mesg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||||
dol_syslog('Failed to read file: '.$file);
|
dol_syslog('Failed to read file: '.$file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>';
|
$mesgs[]='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>';
|
||||||
dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
|
dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1571,7 +1567,7 @@ else if ($action == 'remove_file')
|
|||||||
$upload_dir = $conf->facture->dir_output;
|
$upload_dir = $conf->facture->dir_output;
|
||||||
$file = $upload_dir . '/' . GETPOST('file');
|
$file = $upload_dir . '/' . GETPOST('file');
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
$mesgs[] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1597,11 +1593,11 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|||||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
$mesgs[] = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
$mesgs[] = '<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1661,9 +1657,6 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans('NewBill'));
|
print_fiche_titre($langs->trans('NewBill'));
|
||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
|
||||||
dol_htmloutput_errors('',$errors);
|
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
if ($socid) $res=$soc->fetch($socid);
|
if ($socid) $res=$soc->fetch($socid);
|
||||||
|
|
||||||
@@ -2109,8 +2102,6 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
/*
|
/*
|
||||||
* Show object in view mode
|
* Show object in view mode
|
||||||
*/
|
*/
|
||||||
dol_htmloutput_mesg($mesg);
|
|
||||||
dol_htmloutput_errors('',$errors);
|
|
||||||
|
|
||||||
$result=$object->fetch($id,$ref);
|
$result=$object->fetch($id,$ref);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@@ -3332,6 +3323,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_htmloutput_mesg('',$mesgs);
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@@ -43,13 +43,6 @@ $confirm = GETPOST('confirm');
|
|||||||
$id = GETPOST('facid','int');
|
$id = GETPOST('facid','int');
|
||||||
$ref = GETPOST('ref');
|
$ref = GETPOST('ref');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id)
|
if ($user->societe_id)
|
||||||
{
|
{
|
||||||
@@ -132,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,22 +38,18 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.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/lib/date.lib.php");
|
||||||
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
|
if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
|
||||||
if ($conf->projet->enabled)
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
//print 'ee'.$langs->trans('BillsCustomer');exit;
|
|
||||||
|
|
||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
|
|
||||||
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
|
|
||||||
|
|
||||||
$sall=trim(GETPOST('sall'));
|
$sall=trim(GETPOST('sall'));
|
||||||
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
||||||
|
|
||||||
@@ -84,16 +80,19 @@ $pageprev = $page - 1;
|
|||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
$search_user = GETPOST('search_user','int');
|
$search_user = GETPOST('search_user','int');
|
||||||
|
$search_sale = GETPOST('search_sale','int');
|
||||||
$day = GETPOST('day','int');
|
$day = GETPOST('day','int');
|
||||||
$month = GETPOST('month','int');
|
$month = GETPOST('month','int');
|
||||||
$year = GETPOST('year','int');
|
$year = GETPOST('year','int');
|
||||||
|
$filtre = GETPOST('filtre');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
||||||
|
|
||||||
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
// FIXME $usehm not used ?
|
||||||
|
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:false);
|
||||||
|
|
||||||
$object=new Facture($db);
|
$object=new Facture($db);
|
||||||
|
|
||||||
@@ -166,12 +165,12 @@ if ($userid)
|
|||||||
if ($userid == -1) $sql.=' AND f.fk_user_author IS NULL';
|
if ($userid == -1) $sql.=' AND f.fk_user_author IS NULL';
|
||||||
else $sql.=' AND f.fk_user_author = '.$userid;
|
else $sql.=' AND f.fk_user_author = '.$userid;
|
||||||
}
|
}
|
||||||
if ($_GET['filtre'])
|
if ($filtre)
|
||||||
{
|
{
|
||||||
$filtrearr = explode(',', $_GET['filtre']);
|
$aFilter = explode(',', $filtre);
|
||||||
foreach ($filtrearr as $fil)
|
foreach ($aFilter as $filter)
|
||||||
{
|
{
|
||||||
$filt = explode(':', $fil);
|
$filt = explode(':', $filter);
|
||||||
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
|
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,6 +253,7 @@ if ($resql)
|
|||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
|
|
||||||
// If the user can view prospects other than his'
|
// If the user can view prospects other than his'
|
||||||
|
$moreforfilter='';
|
||||||
if ($user->rights->societe->client->voir || $socid)
|
if ($user->rights->societe->client->voir || $socid)
|
||||||
{
|
{
|
||||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||||
@@ -314,6 +314,7 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$var=True;
|
$var=True;
|
||||||
$total=0;
|
$total=0;
|
||||||
|
$total_ttc=0;
|
||||||
$totalrecu=0;
|
$totalrecu=0;
|
||||||
|
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
|
|||||||
@@ -805,8 +805,12 @@ class Contact extends CommonObject
|
|||||||
$sql = "SELECT count(mc.email) as nb";
|
$sql = "SELECT count(mc.email) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||||
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'";
|
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'";
|
||||||
$sql.= " AND mc.statut=1"; // -1 erreur, 0 non envoye, 1 envoye avec succes
|
$sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG);
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|||||||
@@ -41,13 +41,6 @@ $confirm = GETPOST('confirm','alpha');
|
|||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$ref = GETPOST('ref','alpha');
|
$ref = GETPOST('ref','alpha');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@@ -129,7 +122,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
|
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
$ret=dol_delete_file($file,0,0,0,$object);
|
$ret=dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2055,7 +2055,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (count($this->array_options) > 0)
|
if (! empty($this->array_options))
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
$langs->load('admin');
|
$langs->load('admin');
|
||||||
@@ -2865,25 +2865,25 @@ abstract class CommonObject
|
|||||||
foreach($this->lines as $line) {
|
foreach($this->lines as $line) {
|
||||||
if (isset($line->fk_fournprice) && !$force_price) {
|
if (isset($line->fk_fournprice) && !$force_price) {
|
||||||
$product = new ProductFournisseur($this->db);
|
$product = new ProductFournisseur($this->db);
|
||||||
if ( $product->fetch_product_fournisseur_price($line->fk_fournprice))
|
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
|
||||||
$line->pa_ht = $product->fourn_unitprice;
|
$line->pa_ht = $product->fourn_unitprice;
|
||||||
if ($conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
|
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
|
||||||
$line->pa_ht += $product->fourn_unitcharges;
|
$line->pa_ht += $product->fourn_unitcharges;
|
||||||
}
|
}
|
||||||
// si prix d'achat non renseign<EFBFBD> et devrait l'<EFBFBD>tre, alors prix achat = prix vente
|
// si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente
|
||||||
if ((!isset($line->pa_ht) || $line->pa_ht == 0) && ($conf->global->ForceBuyingPriceIfNull == 1)) {
|
if ((!isset($line->pa_ht) || $line->pa_ht == 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) {
|
||||||
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
|
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcul des marges
|
// calcul des marges
|
||||||
if(isset($line->fk_remise_except)) { // remise
|
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
|
||||||
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale consid<EFBFBD>r<EFBFBD>e comme produit
|
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
|
||||||
$marginInfos['pa_products'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
$marginInfos['pa_products'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||||
$marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100);
|
$marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||||
$marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
$marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||||
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
|
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
|
||||||
}
|
}
|
||||||
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale consid<EFBFBD>r<EFBFBD>e comme service
|
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
|
||||||
$marginInfos['pa_services'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
$marginInfos['pa_services'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||||
$marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100));
|
$marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100));
|
||||||
$marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
$marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
|
||||||
|
|||||||
@@ -2184,7 +2184,7 @@ class Form
|
|||||||
$more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"';
|
$more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"';
|
||||||
if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked="checked"';
|
if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked="checked"';
|
||||||
if (is_bool($input['value']) && $input['value']) $more.=' checked="checked"';
|
if (is_bool($input['value']) && $input['value']) $more.=' checked="checked"';
|
||||||
if ($input['disabled']) $more.=' disabled="disabled"';
|
if (isset($input['disabled'])) $more.=' disabled="disabled"';
|
||||||
$more.=' /></td>';
|
$more.=' /></td>';
|
||||||
$more.='<td valign="top" align="left"> </td>';
|
$more.='<td valign="top" align="left"> </td>';
|
||||||
$more.='</tr>'."\n";
|
$more.='</tr>'."\n";
|
||||||
@@ -3067,11 +3067,11 @@ class Form
|
|||||||
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/',$set_time,$reg))
|
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/',$set_time,$reg))
|
||||||
{
|
{
|
||||||
// Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
|
// Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
|
||||||
$syear = $reg[1];
|
$syear = (! empty($reg[1])?$reg[1]:'');
|
||||||
$smonth = $reg[2];
|
$smonth = (! empty($reg[2])?$reg[2]:'');
|
||||||
$sday = $reg[3];
|
$sday = (! empty($reg[3])?$reg[3]:'');
|
||||||
$shour = $reg[4];
|
$shour = (! empty($reg[4])?$reg[4]:'');
|
||||||
$smin = $reg[5];
|
$smin = (! empty($reg[5])?$reg[5]:'');
|
||||||
}
|
}
|
||||||
elseif (strval($set_time) != '' && $set_time != -1)
|
elseif (strval($set_time) != '' && $set_time != -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -389,6 +389,7 @@ function getFormeJuridiqueLabel($code)
|
|||||||
function show_projects($conf,$langs,$db,$object,$backtopage='')
|
function show_projects($conf,$langs,$db,$object,$backtopage='')
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
global $bc;
|
||||||
|
|
||||||
$i = -1 ;
|
$i = -1 ;
|
||||||
|
|
||||||
@@ -517,13 +518,13 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
print '<td>'.$langs->trans("Poste").'</td><td>'.$langs->trans("Tel").'</td>';
|
print '<td>'.$langs->trans("Poste").'</td><td>'.$langs->trans("Tel").'</td>';
|
||||||
print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>';
|
print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>';
|
||||||
print "<td> </td>";
|
print "<td> </td>";
|
||||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||||
{
|
{
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note ";
|
$sql = "SELECT p.rowid, p.name, p.firstname, p.fk_pays, p.poste, p.phone, p.fax, p.email, p.note ";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||||
$sql .= " WHERE p.fk_soc = ".$object->id;
|
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||||
$sql .= " ORDER by p.datec";
|
$sql .= " ORDER by p.datec";
|
||||||
@@ -552,12 +553,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
|
|
||||||
print '<td>'.$obj->poste.'</td>';
|
print '<td>'.$obj->poste.'</td>';
|
||||||
|
|
||||||
|
$country_code = getCountry($obj->fk_pays, 2);
|
||||||
|
|
||||||
// Lien click to dial
|
// Lien click to dial
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print dol_print_phone($obj->phone,$obj->pays_code,$obj->rowid,$object->id,'AC_TEL');
|
print dol_print_phone($obj->phone,$country_code,$obj->rowid,$object->id,'AC_TEL');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print dol_print_phone($obj->fax,$obj->pays_code,$obj->rowid,$object->id,'AC_FAX');
|
print dol_print_phone($obj->fax,$country_code,$obj->rowid,$object->id,'AC_FAX');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL');
|
print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2008-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2008-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -158,7 +158,9 @@ class MailingTargets // This can't be abstract as it is used for some method
|
|||||||
$sql .= " (fk_mailing,";
|
$sql .= " (fk_mailing,";
|
||||||
$sql .= " fk_contact,";
|
$sql .= " fk_contact,";
|
||||||
$sql .= " nom, prenom, email, other, source_url, source_id,";
|
$sql .= " nom, prenom, email, other, source_url, source_id,";
|
||||||
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= " tag,";
|
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) {
|
||||||
|
$sql .= " tag,";
|
||||||
|
}
|
||||||
$sql.= " source_type)";
|
$sql.= " source_type)";
|
||||||
$sql .= " VALUES (".$mailing_id.",";
|
$sql .= " VALUES (".$mailing_id.",";
|
||||||
$sql .= (empty($cibles[$i]['fk_contact']) ? '0' : "'".$cibles[$i]['fk_contact']."'") .",";
|
$sql .= (empty($cibles[$i]['fk_contact']) ? '0' : "'".$cibles[$i]['fk_contact']."'") .",";
|
||||||
@@ -168,7 +170,9 @@ class MailingTargets // This can't be abstract as it is used for some method
|
|||||||
$sql .= "'".$this->db->escape($cibles[$i]['other'])."',";
|
$sql .= "'".$this->db->escape($cibles[$i]['other'])."',";
|
||||||
$sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',";
|
$sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',";
|
||||||
$sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',";
|
$sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',";
|
||||||
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
|
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) {
|
||||||
|
$sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
|
||||||
|
}
|
||||||
$sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')";
|
$sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')";
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@@ -189,6 +193,7 @@ class MailingTargets // This can't be abstract as it is used for some method
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::add_to_target: sql ".$sql,LOG_DEBUG);
|
||||||
dol_syslog(get_class($this)."::add_to_target: mailing ".$j." targets added");
|
dol_syslog(get_class($this)."::add_to_target: mailing ".$j." targets added");
|
||||||
|
|
||||||
//Update the status to show thirdparty mail that don't want to be contacted anymore'
|
//Update the status to show thirdparty mail that don't want to be contacted anymore'
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class modCommissions extends DolibarrModules
|
|||||||
$this->dirs = array();
|
$this->dirs = array();
|
||||||
|
|
||||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
||||||
$this->config_page_url = array("commissions.php");
|
$this->config_page_url = array("commissions.php@commissions");
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array("modFacture", "modMargin"); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array("modFacture", "modMargin"); // List of modules id that must be enabled if this module is enabled
|
||||||
@@ -77,7 +77,7 @@ class modCommissions extends DolibarrModules
|
|||||||
$this->langfiles = array("commissions");
|
$this->langfiles = array("commissions");
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
$this->const = array(); // List of particular constants to add when module is enabled
|
$this->const = array(0=>array('COMMISSION_BASE',"chaine","TURNOVER",'Default commission base',0)); // List of particular constants to add when module is enabled
|
||||||
|
|
||||||
// New pages on tabs
|
// New pages on tabs
|
||||||
$this->tabs = array();
|
$this->tabs = array();
|
||||||
@@ -106,15 +106,15 @@ class modCommissions extends DolibarrModules
|
|||||||
|
|
||||||
// left menu entry
|
// left menu entry
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r]=array(
|
||||||
'fk_menu'=>0, // Put 0 if this is a top menu
|
'fk_menu'=>'fk_mainmenu=accountancy', // Put 0 if this is a top menu
|
||||||
'type'=>'top', // This is a Top menu entry
|
'type'=>'left', // This is a Top menu entry
|
||||||
'titre'=>'Commissions',
|
'titre'=>'Commissions',
|
||||||
'mainmenu'=>'commissions',
|
'mainmenu'=>'accountancy',
|
||||||
'leftmenu'=>'0', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
|
'leftmenu'=>'commissions', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
|
||||||
'url'=>'/commissions/index.php',
|
'url'=>'/commissions/index.php',
|
||||||
'langs'=>'commissions@commissions', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'commissions', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>110,
|
'position'=>200,
|
||||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
'enabled'=>'$conf->commissions->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ class modFacture extends DolibarrModules
|
|||||||
$this->export_permission[$r]=array(array("facture","facture","export"));
|
$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
|
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||||
|
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||||
|
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||||
@@ -193,6 +194,7 @@ class modFacture extends DolibarrModules
|
|||||||
$this->export_permission[$r]=array(array("facture","facture","export"));
|
$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
|
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
|
||||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
|
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
|
||||||
|
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||||
|
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ class modMargin extends DolibarrModules
|
|||||||
$this->special = 0;
|
$this->special = 0;
|
||||||
// Name of png file (without png) used for this module.
|
// Name of png file (without png) used for this module.
|
||||||
// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
|
// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
|
||||||
$this->picto='marges';
|
$this->picto='margin';
|
||||||
|
|
||||||
// Data directories to create when module is enabled.
|
// Data directories to create when module is enabled.
|
||||||
$this->dirs = array('/margin/temp');
|
$this->dirs = array('/margin/temp');
|
||||||
|
|
||||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
||||||
$this->config_page_url = array("margin.php");
|
$this->config_page_url = array("margin.php@margin");
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array("modPropale", "modProduct"); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array("modPropale", "modProduct"); // List of modules id that must be enabled if this module is enabled
|
||||||
@@ -98,62 +98,19 @@ class modMargin extends DolibarrModules
|
|||||||
|
|
||||||
// left menu entry
|
// left menu entry
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r]=array(
|
||||||
'fk_menu'=>0, // Put 0 if this is a top menu
|
'fk_menu'=>'fk_mainmenu=accountancy', // Put 0 if this is a top menu
|
||||||
'type'=>'top', // This is a Top menu entry
|
'type'=>'left', // This is a Top menu entry
|
||||||
'titre'=>'Margins',
|
'titre'=>'Margins',
|
||||||
'mainmenu'=>'margins',
|
'mainmenu'=>'accountancy',
|
||||||
'leftmenu'=>'1', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
|
'leftmenu'=>'margins', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
|
||||||
'url'=>'/margin/index.php',
|
'url'=>'/margin/index.php',
|
||||||
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>100,
|
'position'=>100,
|
||||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
// top menu entry
|
|
||||||
$this->menu[$r]=array(
|
|
||||||
'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
|
||||||
'type'=>'left', // This is a Left menu entry
|
|
||||||
'titre'=>'ProductMargins',
|
|
||||||
'mainmenu'=>'margins',
|
|
||||||
'url'=>'/margin/productMargins.php',
|
|
||||||
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
|
||||||
'position'=>100,
|
|
||||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
|
||||||
'target'=>'',
|
|
||||||
'user'=>2); // 0=Menu for internal users,1=external users, 2=both
|
|
||||||
$r++;
|
|
||||||
|
|
||||||
$this->menu[$r]=array(
|
|
||||||
'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
|
||||||
'type'=>'left', // This is a Left menu entry
|
|
||||||
'titre'=>'CustomerMargins',
|
|
||||||
'mainmenu'=>'margins',
|
|
||||||
'url'=>'/margin/customerMargins.php',
|
|
||||||
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
|
||||||
'position'=>200,
|
|
||||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
|
||||||
'target'=>'',
|
|
||||||
'user'=>2); // 0=Menu for internal users,1=external users, 2=both
|
|
||||||
$r++;
|
|
||||||
|
|
||||||
$this->menu[$r]=array(
|
|
||||||
'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
|
||||||
'type'=>'left', // This is a Left menu entry
|
|
||||||
'titre'=>'AgentMargins',
|
|
||||||
'mainmenu'=>'margins',
|
|
||||||
'url'=>'/margin/agentMargins.php',
|
|
||||||
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
|
||||||
'position'=>300,
|
|
||||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
|
||||||
'target'=>'',
|
|
||||||
'user'=>2); // 0=Menu for internal users,1=external users, 2=both
|
|
||||||
$r++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
* @return int 1 if OK, <=0 if KO
|
* @return int 1 if OK, <=0 if KO
|
||||||
*/
|
*/
|
||||||
function write_file(&$object,$outputlangs,$srctemplatepath)
|
function write_file($object,$outputlangs,$srctemplatepath)
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf,$mysoc;
|
global $user,$langs,$conf,$mysoc;
|
||||||
|
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ abstract class ModeleAccountancyCode
|
|||||||
* @param Translate $outputlangs Object lang to use for translation
|
* @param Translate $outputlangs Object lang to use for translation
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function thirdparty_doc_create($db, &$object, $message, $modele, $outputlangs)
|
function thirdparty_doc_create($db, $object, $message, $modele, $outputlangs)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user;
|
global $conf,$langs,$user;
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|||||||
@@ -231,15 +231,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans('Date').'</td>';
|
print '<tr><td>'.$langs->trans('Date').'</td>';
|
||||||
print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
|
print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
|
||||||
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
|
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource().'</td>';
|
||||||
if ($commande->source == 0 && $conf->propal->enabled && $commande->propale_id)
|
|
||||||
{
|
|
||||||
// Si source = propal
|
|
||||||
$propal = new Propal($db);
|
|
||||||
$propal->fetch($commande->propale_id);
|
|
||||||
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$propal->id.'">'.$propal->ref.'</a>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Delivery date planned
|
// Delivery date planned
|
||||||
@@ -276,7 +268,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print $langs->trans('PaymentConditionsShort');
|
print $langs->trans('PaymentConditionsShort');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($action != 'editconditions' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
if ($action != 'editconditions' && ! empty($commande->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if ($action == 'editconditions')
|
if ($action == 'editconditions')
|
||||||
@@ -294,7 +286,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentMode');
|
print $langs->trans('PaymentMode');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($actionº != 'editmode' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$commande->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
if ($action != 'editmode' && ! empty($commande->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$commande->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if ($action == 'editmode')
|
if ($action == 'editmode')
|
||||||
@@ -394,7 +386,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$reste_a_livrer = array();
|
$toBeShipped=array();
|
||||||
|
$toBeShippedTotal=0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@@ -412,25 +405,25 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Product label
|
// Product label
|
||||||
if ($objp->fk_product > 0)
|
if ($objp->fk_product > 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||||
{
|
{
|
||||||
$commande->fetch_thirdparty();
|
$commande->fetch_thirdparty();
|
||||||
$prod = new Product($db, $objp->fk_product);
|
$prod = new Product($db, $objp->fk_product);
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang='';
|
$newlang='';
|
||||||
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
if (empty($newlang)) $newlang=$commande->client->default_lang;
|
if (empty($newlang)) $newlang=$commande->client->default_lang;
|
||||||
if (! empty($newlang))
|
if (! empty($newlang))
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label;
|
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$label = $objp->product_label;
|
$label = $objp->product_label;
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||||
@@ -475,17 +468,17 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$qtyProdCom=$objp->qty;
|
$qtyProdCom=$objp->qty;
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
// Nb of sending products for this line of order
|
// Nb of sending products for this line of order
|
||||||
$quantite_livree = $commande->expeditions[$objp->rowid];
|
$qtyAlreadyShipped = (! empty($commande->expeditions[$objp->rowid])?$commande->expeditions[$objp->rowid]:0);
|
||||||
print $quantite_livree;
|
print $qtyAlreadyShipped;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Qty remains to ship
|
// Qty remains to ship
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
{
|
{
|
||||||
$reste_a_livrer[$objp->fk_product] = $objp->qty - $quantite_livree;
|
$toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped;
|
||||||
$reste_a_livrer_total += $reste_a_livrer[$objp->fk_product];
|
$toBeShippedTotal += $toBeShipped[$objp->fk_product];
|
||||||
print $reste_a_livrer[$objp->fk_product];
|
print $toBeShipped[$objp->fk_product];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -503,7 +496,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $product->stock_reel;
|
print $product->stock_reel;
|
||||||
if ($product->stock_reel < $reste_a_livrer[$objp->fk_product])
|
if ($product->stock_reel < $toBeShipped[$objp->fk_product])
|
||||||
{
|
{
|
||||||
print ' '.img_warning($langs->trans("StockTooLow"));
|
print ' '.img_warning($langs->trans("StockTooLow"));
|
||||||
}
|
}
|
||||||
@@ -580,7 +573,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($user->rights->expedition->creer)
|
if ($user->rights->expedition->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&origin=commande&object_id='.$id.'">'.$langs->trans("NewSending").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&origin=commande&object_id='.$id.'">'.$langs->trans("NewSending").'</a>';
|
||||||
if ($reste_a_livrer_total <= 0)
|
if ($toBeShippedTotal <= 0)
|
||||||
{
|
{
|
||||||
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
|
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
|
||||||
}
|
}
|
||||||
@@ -625,7 +618,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">';
|
print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">';
|
||||||
if ($reste_a_livrer_total <= 0)
|
if ($toBeShippedTotal <= 0)
|
||||||
{
|
{
|
||||||
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
|
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Export
|
* Class to manage exports
|
||||||
* \brief Class to manage exports
|
|
||||||
*/
|
*/
|
||||||
class Export
|
class Export
|
||||||
{
|
{
|
||||||
@@ -36,7 +35,8 @@ class Export
|
|||||||
var $array_export_label=array(); // Tableau de "libelle de lots"
|
var $array_export_label=array(); // Tableau de "libelle de lots"
|
||||||
var $array_export_sql=array(); // Tableau des "requetes sql"
|
var $array_export_sql=array(); // Tableau des "requetes sql"
|
||||||
var $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
|
var $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
|
||||||
//var $array_export_alias=array(); // Tableau des listes de champ+alias a exporter
|
var $array_export_entities=array(); // Tableau des listes de champ+alias a exporter
|
||||||
|
var $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export
|
||||||
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
||||||
|
|
||||||
// To store export modules
|
// To store export modules
|
||||||
@@ -162,6 +162,8 @@ class Export
|
|||||||
$this->array_export_fields[$i]=$module->export_fields_array[$r];
|
$this->array_export_fields[$i]=$module->export_fields_array[$r];
|
||||||
// Tableau des entites a exporter (cle=champ, valeur=entite)
|
// Tableau des entites a exporter (cle=champ, valeur=entite)
|
||||||
$this->array_export_entities[$i]=$module->export_entities_array[$r];
|
$this->array_export_entities[$i]=$module->export_entities_array[$r];
|
||||||
|
// Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records)
|
||||||
|
$this->array_export_dependencies[$i]=$module->export_dependencies_array[$r];
|
||||||
// Tableau des operations speciales sur champ
|
// Tableau des operations speciales sur champ
|
||||||
$this->array_export_special[$i]=$module->export_special_array[$r];
|
$this->array_export_special[$i]=$module->export_special_array[$r];
|
||||||
|
|
||||||
|
|||||||
@@ -64,12 +64,13 @@ $entitytolang=array( // Translation code
|
|||||||
);
|
);
|
||||||
|
|
||||||
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
|
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
|
||||||
$datatoexport=isset($_GET["datatoexport"])? $_GET["datatoexport"] : (isset($_POST["datatoexport"])?$_POST["datatoexport"]:'');
|
$datatoexport=GETPOST("datatoexport");
|
||||||
$action=isset($_GET["action"]) ? $_GET["action"] : (isset($_POST["action"])?$_POST["action"]:'');
|
$action=GETPOST("action");
|
||||||
$step=isset($_GET["step"])? $_GET["step"] : (isset($_POST["step"])?$_POST["step"]:1);
|
$step=GETPOST("step")?GETPOST("step"):1;
|
||||||
$export_name=isset($_POST["export_name"])? $_POST["export_name"] : '';
|
$export_name=GETPOST("export_name");
|
||||||
$hexa=isset($_POST["hexa"])? $_POST["hexa"] : '';
|
$hexa=GETPOST("hexa");
|
||||||
$exportmodelid=isset($_POST["exportmodelid"])? $_POST["exportmodelid"] : '';
|
$exportmodelid=GETPOST("exportmodelid");
|
||||||
|
$field=GETPOST("field");
|
||||||
|
|
||||||
$objexport=new Export($db);
|
$objexport=new Export($db);
|
||||||
$objexport->load_arrays($user,$datatoexport);
|
$objexport->load_arrays($user,$datatoexport);
|
||||||
@@ -87,12 +88,15 @@ $sqlusedforexport='';
|
|||||||
|
|
||||||
if ($action=='selectfield')
|
if ($action=='selectfield')
|
||||||
{
|
{
|
||||||
if ($_GET["field"]=='all')
|
$fieldsarray=$objexport->array_export_fields[0];
|
||||||
|
$fieldsentitiesarray=$objexport->array_export_entities[0];
|
||||||
|
$fieldsdependenciesarray=$objexport->array_export_dependencies[0];
|
||||||
|
|
||||||
|
if ($field=='all')
|
||||||
{
|
{
|
||||||
$fieldsarray=$objexport->array_export_fields[0];
|
|
||||||
foreach($fieldsarray as $key=>$val)
|
foreach($fieldsarray as $key=>$val)
|
||||||
{
|
{
|
||||||
if (! empty($array_selected[$key])) continue; // If already selected, select next
|
if (! empty($array_selected[$key])) continue; // If already selected, check next
|
||||||
$array_selected[$key]=count($array_selected)+1;
|
$array_selected[$key]=count($array_selected)+1;
|
||||||
//print_r($array_selected);
|
//print_r($array_selected);
|
||||||
$_SESSION["export_selected_fields"]=$array_selected;
|
$_SESSION["export_selected_fields"]=$array_selected;
|
||||||
@@ -100,7 +104,13 @@ if ($action=='selectfield')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$array_selected[$_GET["field"]]=count($array_selected)+1;
|
$array_selected[$field]=count($array_selected)+1; // We tag the key $field as "selected"
|
||||||
|
// We check if there is a dependency
|
||||||
|
if (! empty($fieldsdependenciesarray[$fieldsentitiesarray[$field]]))
|
||||||
|
{
|
||||||
|
// TODO Show warning "risk of duplicate record filtered"
|
||||||
|
|
||||||
|
}
|
||||||
//print_r($array_selected);
|
//print_r($array_selected);
|
||||||
$_SESSION["export_selected_fields"]=$array_selected;
|
$_SESSION["export_selected_fields"]=$array_selected;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,13 +43,6 @@ $ref = GETPOST('ref', 'alpha');
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$confirm = GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
|
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
|
||||||
@@ -128,7 +121,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
|
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,14 +46,6 @@ $ref = GETPOST('ref', 'alpha');
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$confirm = GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
$mesgs=array();
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
|
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
|
||||||
@@ -130,7 +122,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
|
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ AntiVirusCommandExample= Example for ClamWin: c:\Progra~1\ClamWin\bin\clamscan.e
|
|||||||
AntiVirusParam= More parameters on command line
|
AntiVirusParam= More parameters on command line
|
||||||
AntiVirusParamExample= Example for ClamWin: --database="C:\Program Files (x86)\ClamWin\lib"
|
AntiVirusParamExample= Example for ClamWin: --database="C:\Program Files (x86)\ClamWin\lib"
|
||||||
ComptaSetup=Accounting module setup
|
ComptaSetup=Accounting module setup
|
||||||
UserSetup=User's management setup
|
UserSetup=User management setup
|
||||||
MenuSetup=Menu's management setup
|
MenuSetup=Menu management setup
|
||||||
MenuLimits=Limits and accuracy
|
MenuLimits=Limits and accuracy
|
||||||
MenuIdParent=Parent menu ID
|
MenuIdParent=Parent menu ID
|
||||||
DetailMenuIdParent=ID of parent menu (0 for a top menu)
|
DetailMenuIdParent=ID of parent menu (0 for a top menu)
|
||||||
@@ -216,7 +216,7 @@ OfficialWiki=Dolibarr documentation on Wiki
|
|||||||
OfficialDemo=Dolibarr online demo
|
OfficialDemo=Dolibarr online demo
|
||||||
OfficialMarketPlace=Official market place for external modules/addons
|
OfficialMarketPlace=Official market place for external modules/addons
|
||||||
OfficialWebHostingService=Official web hosting service (Cloud hosting)
|
OfficialWebHostingService=Official web hosting service (Cloud hosting)
|
||||||
ForDocumentationSeeWiki=For user's or developer's documentation (Doc, FAQs...),<br>take a look at the Dolibarr Wiki:<br><b><a href="%s" target="_blank">%s</a></b>
|
ForDocumentationSeeWiki=For user or developer documentation (Doc, FAQs...),<br>take a look at the Dolibarr Wiki:<br><b><a href="%s" target="_blank">%s</a></b>
|
||||||
ForAnswersSeeForum=For any other questions/help, you can use the Dolibarr forum:<br><b><a href="%s" target="_blank">%s</a></b>
|
ForAnswersSeeForum=For any other questions/help, you can use the Dolibarr forum:<br><b><a href="%s" target="_blank">%s</a></b>
|
||||||
HelpCenterDesc1=This area can help you to get a Help support service on Dolibarr.
|
HelpCenterDesc1=This area can help you to get a Help support service on Dolibarr.
|
||||||
HelpCenterDesc2=Some part of this service are available in <b>english only</b>.
|
HelpCenterDesc2=Some part of this service are available in <b>english only</b>.
|
||||||
@@ -333,53 +333,53 @@ ButtonHideUnauthorized=Hide buttons unauthorized (instead of seeing gray)
|
|||||||
Module0Name=Users & groups
|
Module0Name=Users & groups
|
||||||
Module0Desc=Users and groups management
|
Module0Desc=Users and groups management
|
||||||
Module1Name=Third parties
|
Module1Name=Third parties
|
||||||
Module1Desc=Companies and contact's management
|
Module1Desc=Companies and contact management
|
||||||
Module2Name=Commercial
|
Module2Name=Commercial
|
||||||
Module2Desc=Commercial management
|
Module2Desc=Commercial management
|
||||||
Module10Name=Accounting
|
Module10Name=Accounting
|
||||||
Module10Desc=Simple accounting management (invoice and payment dispatching)
|
Module10Desc=Simple accounting management (invoice and payment dispatching)
|
||||||
Module20Name=Proposals
|
Module20Name=Proposals
|
||||||
Module20Desc=Commercial proposal's management
|
Module20Desc=Commercial proposal management
|
||||||
Module22Name=Mass E-mailings
|
Module22Name=Mass E-mailings
|
||||||
Module22Desc=Mass E-mailing's management
|
Module22Desc=Mass E-mailing management
|
||||||
Module23Name= Energy
|
Module23Name= Energy
|
||||||
Module23Desc= Monitoring the consumption of energies
|
Module23Desc= Monitoring the consumption of energies
|
||||||
Module25Name=Customer Orders
|
Module25Name=Customer Orders
|
||||||
Module25Desc=Customer order's management
|
Module25Desc=Customer order management
|
||||||
Module30Name=Invoices
|
Module30Name=Invoices
|
||||||
Module30Desc=Invoices and credit note's management for customers. Invoice's management for suppliers
|
Module30Desc=Invoice and credit note management for customers. Invoice management for suppliers
|
||||||
Module40Name=Suppliers
|
Module40Name=Suppliers
|
||||||
Module40Desc=Supplier's management and buying (orders and invoices)
|
Module40Desc=Supplier management and buying (orders and invoices)
|
||||||
Module42Name=Logs
|
Module42Name=Logs
|
||||||
Module42Desc=Logging facilities (file, syslog, ...)
|
Module42Desc=Logging facilities (file, syslog, ...)
|
||||||
Module49Name=Editors
|
Module49Name=Editors
|
||||||
Module49Desc=Editor's management
|
Module49Desc=Editor management
|
||||||
Module50Name=Products
|
Module50Name=Products
|
||||||
Module50Desc=Product's management
|
Module50Desc=Product management
|
||||||
Module51Name=Mass mailings
|
Module51Name=Mass mailings
|
||||||
Module51Desc=Mass paper mailing's management
|
Module51Desc=Mass paper mailing management
|
||||||
Module52Name=Stocks
|
Module52Name=Stocks
|
||||||
Module52Desc=Stock's management of products
|
Module52Desc=Stock management (products)
|
||||||
Module53Name=Services
|
Module53Name=Services
|
||||||
Module53Desc=Service's management
|
Module53Desc=Service management
|
||||||
Module54Name=Contracts
|
Module54Name=Contracts
|
||||||
Module54Desc=Contract's and service's management
|
Module54Desc=Contract and service management
|
||||||
Module55Name=Barcodes
|
Module55Name=Barcodes
|
||||||
Module55Desc=Barcode's management
|
Module55Desc=Barcode management
|
||||||
Module56Name=Telephony
|
Module56Name=Telephony
|
||||||
Module56Desc=Telephony integration
|
Module56Desc=Telephony integration
|
||||||
Module57Name=Standing orders
|
Module57Name=Standing orders
|
||||||
Module57Desc=Standing orders and withdrawal's management
|
Module57Desc=Standing orders and withdrawal management
|
||||||
Module58Name=ClickToDial
|
Module58Name=ClickToDial
|
||||||
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
|
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
|
||||||
Module59Name=Bookmark4u
|
Module59Name=Bookmark4u
|
||||||
Module59Desc=Add function to generate Bookmark4u account from a Dolibarr account
|
Module59Desc=Add function to generate Bookmark4u account from a Dolibarr account
|
||||||
Module70Name=Interventions
|
Module70Name=Interventions
|
||||||
Module70Desc=Intervention's management
|
Module70Desc=Intervention management
|
||||||
Module75Name=Expenses and trips notes
|
Module75Name=Expense and trip notes
|
||||||
Module75Desc=Expenses and trips note's management
|
Module75Desc=Expense and trip notes management
|
||||||
Module80Name=Shipments
|
Module80Name=Shipments
|
||||||
Module80Desc=Shipments and delivery order's management
|
Module80Desc=Shipments and delivery order management
|
||||||
Module85Name=Banks and cash
|
Module85Name=Banks and cash
|
||||||
Module85Desc=Management of bank or cash accounts
|
Module85Desc=Management of bank or cash accounts
|
||||||
Module100Name=External site
|
Module100Name=External site
|
||||||
@@ -399,17 +399,17 @@ Module310Desc=Foundation members management
|
|||||||
Module320Name=RSS Feed
|
Module320Name=RSS Feed
|
||||||
Module320Desc=Add RSS feed inside Dolibarr screen pages
|
Module320Desc=Add RSS feed inside Dolibarr screen pages
|
||||||
Module330Name=Bookmarks
|
Module330Name=Bookmarks
|
||||||
Module330Desc=Bookmark's management
|
Module330Desc=Bookmark management
|
||||||
Module400Name=Projects
|
Module400Name=Projects
|
||||||
Module400Desc=Project's management inside other modules
|
Module400Desc=Project management inside other modules
|
||||||
Module410Name=Webcalendar
|
Module410Name=Webcalendar
|
||||||
Module410Desc=Webcalendar integration
|
Module410Desc=Webcalendar integration
|
||||||
Module500Name=Taxes, social contributions and dividends
|
Module500Name=Taxes, social contributions and dividends
|
||||||
Module500Desc=Taxes and social contribution's management
|
Module500Desc=Taxes and social contribution management
|
||||||
Module600Name=Notifications
|
Module600Name=Notifications
|
||||||
Module600Desc=Send notifications by email on some Dolibarr business events to third party's contacts
|
Module600Desc=Send notifications by email on some Dolibarr business events to third party contacts
|
||||||
Module700Name=Donations
|
Module700Name=Donations
|
||||||
Module700Desc=Donation's management
|
Module700Desc=Donation management
|
||||||
Module800Name=OSCommerce by direct database access
|
Module800Name=OSCommerce by direct database access
|
||||||
Module800Desc=Interface to show an OSCommerce or OSCSS shop via direct database access
|
Module800Desc=Interface to show an OSCommerce or OSCSS shop via direct database access
|
||||||
Module900Name=OSCommerce by WS
|
Module900Name=OSCommerce by WS
|
||||||
@@ -419,13 +419,13 @@ Module1200Desc=Mantis integration
|
|||||||
Module1400Name=Accounting
|
Module1400Name=Accounting
|
||||||
Module1400Desc=Accounting management (double parties)
|
Module1400Desc=Accounting management (double parties)
|
||||||
Module1780Name=Categories
|
Module1780Name=Categories
|
||||||
Module1780Desc=Categorie's management (products, suppliers and customers)
|
Module1780Desc=Category management (products, suppliers and customers)
|
||||||
Module2000Name=WYSIWYG editor
|
Module2000Name=WYSIWYG editor
|
||||||
Module2000Desc=Allow to edit some text area using an advanced editor
|
Module2000Desc=Allow to edit some text area using an advanced editor
|
||||||
Module2200Name=Lending rights
|
Module2200Name=Lending rights
|
||||||
Module2200Desc=Lending rights management
|
Module2200Desc=Lending rights management
|
||||||
Module2300Name=Menus
|
Module2300Name=Menus
|
||||||
Module2300Desc=Menu's management
|
Module2300Desc=Menu management
|
||||||
Module2400Name=Agenda
|
Module2400Name=Agenda
|
||||||
Module2400Desc=Events/tasks and agenda management
|
Module2400Desc=Events/tasks and agenda management
|
||||||
Module2500Name=Electronic Content Management
|
Module2500Name=Electronic Content Management
|
||||||
@@ -493,7 +493,7 @@ Permission94=Export social contributions
|
|||||||
Permission95=Read reports
|
Permission95=Read reports
|
||||||
Permission96=Setup dispatching
|
Permission96=Setup dispatching
|
||||||
Permission97=Read invoice accountancy dispatching
|
Permission97=Read invoice accountancy dispatching
|
||||||
Permission98=Dispatch invoice's accountancy lines
|
Permission98=Dispatch invoice accountancy lines
|
||||||
Permission101=Read sendings
|
Permission101=Read sendings
|
||||||
Permission102=Create/modify sendings
|
Permission102=Create/modify sendings
|
||||||
Permission104=Validate sendings
|
Permission104=Validate sendings
|
||||||
@@ -612,8 +612,8 @@ Permission703=Delete donations
|
|||||||
Permission1001=Read stocks
|
Permission1001=Read stocks
|
||||||
Permission1002=Create/modify stocks
|
Permission1002=Create/modify stocks
|
||||||
Permission1003=Delete stocks
|
Permission1003=Delete stocks
|
||||||
Permission1004=Read stock's movements
|
Permission1004=Read stock movements
|
||||||
Permission1005=Create/modify stock's movements
|
Permission1005=Create/modify stock movements
|
||||||
Permission1101=Read delivery orders
|
Permission1101=Read delivery orders
|
||||||
Permission1102=Create/modify delivery orders
|
Permission1102=Create/modify delivery orders
|
||||||
Permission1104=Validate delivery orders
|
Permission1104=Validate delivery orders
|
||||||
@@ -729,7 +729,7 @@ TableName=Table name
|
|||||||
TableLineFormat=Line format
|
TableLineFormat=Line format
|
||||||
NbOfRecord=Nb of records
|
NbOfRecord=Nb of records
|
||||||
Constraints=Constraints
|
Constraints=Constraints
|
||||||
ConstraintsType=Constraint's type
|
ConstraintsType=Constraints type
|
||||||
ConstraintsToShowOrNotEntry=Constraint to show or not the menu entry
|
ConstraintsToShowOrNotEntry=Constraint to show or not the menu entry
|
||||||
AllMustBeOk=All of these must be checked
|
AllMustBeOk=All of these must be checked
|
||||||
Host=Server
|
Host=Server
|
||||||
@@ -961,7 +961,7 @@ UseOptionLineIfNoQuantity=A line of product/service with a zero amount is consid
|
|||||||
FreeLegalTextOnProposal=Free text on commercial proposals
|
FreeLegalTextOnProposal=Free text on commercial proposals
|
||||||
WatermarkOnDraftProposal=Watermark on draft commercial proposals (any if empty)
|
WatermarkOnDraftProposal=Watermark on draft commercial proposals (any if empty)
|
||||||
##### Orders #####
|
##### Orders #####
|
||||||
OrdersSetup=Order's management setup
|
OrdersSetup=Order management setup
|
||||||
OrdersNumberingModules=Orders numbering modules
|
OrdersNumberingModules=Orders numbering modules
|
||||||
OrdersModelModule=Order documents models
|
OrdersModelModule=Order documents models
|
||||||
HideTreadedOrders=Hide the treated or canceled orders in the list
|
HideTreadedOrders=Hide the treated or canceled orders in the list
|
||||||
@@ -1033,7 +1033,7 @@ LDAPDnMemberActive=Members' synchronization
|
|||||||
LDAPDnMemberActiveExample=Activated/Unactivated synchronization
|
LDAPDnMemberActiveExample=Activated/Unactivated synchronization
|
||||||
LDAPContactDn=Dolibarr contacts' DN
|
LDAPContactDn=Dolibarr contacts' DN
|
||||||
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
|
LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
|
||||||
LDAPMemberDn=Dolibarr member's DN
|
LDAPMemberDn=Dolibarr members DN
|
||||||
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com)
|
LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com)
|
||||||
LDAPMemberObjectClassList=List of objectClass
|
LDAPMemberObjectClassList=List of objectClass
|
||||||
LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
|
LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
|
||||||
@@ -1043,13 +1043,13 @@ LDAPGroupObjectClassList=List of objectClass
|
|||||||
LDAPGroupObjectClassListExample=List of objectClass defining record attributes (ex: top,groupOfUniqueNames)
|
LDAPGroupObjectClassListExample=List of objectClass defining record attributes (ex: top,groupOfUniqueNames)
|
||||||
LDAPContactObjectClassList=List of objectClass
|
LDAPContactObjectClassList=List of objectClass
|
||||||
LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
|
LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory)
|
||||||
LDAPMemberTypeDn=Dolibarr member's type DN
|
LDAPMemberTypeDn=Dolibarr members type DN
|
||||||
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com)
|
LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com)
|
||||||
LDAPTestConnect=Test LDAP connection
|
LDAPTestConnect=Test LDAP connection
|
||||||
LDAPTestSynchroContact=Test contact's synchronization
|
LDAPTestSynchroContact=Test contacts synchronization
|
||||||
LDAPTestSynchroUser=Test user's synchronization
|
LDAPTestSynchroUser=Test user synchronization
|
||||||
LDAPTestSynchroGroup=Test group's synchronization
|
LDAPTestSynchroGroup=Test group synchronization
|
||||||
LDAPTestSynchroMember=Test member's synchronization
|
LDAPTestSynchroMember=Test member synchronization
|
||||||
LDAPSynchroOK=Synchronization test successful
|
LDAPSynchroOK=Synchronization test successful
|
||||||
LDAPSynchroKO=Failed synchronization test
|
LDAPSynchroKO=Failed synchronization test
|
||||||
LDAPSynchroKOMayBePermissions=Failed synchronization test. Check that connexion to server is correctly configured and allows LDAP udpates
|
LDAPSynchroKOMayBePermissions=Failed synchronization test. Check that connexion to server is correctly configured and allows LDAP udpates
|
||||||
@@ -1189,8 +1189,8 @@ FreeLegalTextOnDeliveryReceipts=Free text on delivery receipts
|
|||||||
##### FCKeditor #####
|
##### FCKeditor #####
|
||||||
AdvancedEditor=Advanced editor
|
AdvancedEditor=Advanced editor
|
||||||
ActivateFCKeditor=Activate advanced editor for:
|
ActivateFCKeditor=Activate advanced editor for:
|
||||||
FCKeditorForCompany=WYSIWIG creation/edition of element's description and note (except products/services)
|
FCKeditorForCompany=WYSIWIG creation/edition of elements description and note (except products/services)
|
||||||
FCKeditorForProduct=WYSIWIG creation/edition of products/service's description and note
|
FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note
|
||||||
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <font class="warning">Warning: Using this option for this case is seriously not recommanded as it can create problems with special characters and page formating when building PDF files.</font>
|
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <font class="warning">Warning: Using this option for this case is seriously not recommanded as it can create problems with special characters and page formating when building PDF files.</font>
|
||||||
FCKeditorForMailing=WYSIWIG creation/edition of mailings
|
FCKeditorForMailing=WYSIWIG creation/edition of mailings
|
||||||
##### OSCommerce 1 #####
|
##### OSCommerce 1 #####
|
||||||
@@ -1309,4 +1309,4 @@ TestGeoIPResult=Test of a conversion IP -> country
|
|||||||
##### Projects #####
|
##### Projects #####
|
||||||
ProjectsNumberingModules=Projects numbering module
|
ProjectsNumberingModules=Projects numbering module
|
||||||
ProjectsSetup=Project module setup
|
ProjectsSetup=Project module setup
|
||||||
ProjectsModelModule=Project's report document model
|
ProjectsModelModule=Project reports document model
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ ProductCommission=Commission / produits
|
|||||||
ServiceCommission=Commission / services
|
ServiceCommission=Commission / services
|
||||||
|
|
||||||
CommissionBase=Base de calcul des commissions
|
CommissionBase=Base de calcul des commissions
|
||||||
CommissionBasedOnCA=Commissions calculées sur le CA
|
CommissionBasedOnTurnover=Commissions calculées sur le CA
|
||||||
CommissionBasedOnMargins=Commissions calculées sur les marges
|
CommissionBasedOnMargins=Commissions calculées sur les marges
|
||||||
CommissionBaseDetails=Définit le mode de calcul des commissions
|
CommissionBaseDetails=Définit le mode de calcul des commissions
|
||||||
CommissionBasedOnMarginsDetails=Le calcul basé sur les marges nécessite l'activation du module marges.
|
CommissionBasedOnMarginsDetails=Le calcul basé sur les marges nécessite l'activation du module marges.
|
||||||
|
|
||||||
CATotal = Chiffre d'affaire réalisé HT
|
TurnoverTotal = Chiffre d'affaire réalisé HT
|
||||||
ProductCA=CA HT / produits
|
ProductTurnover=CA HT / produits
|
||||||
ServiceCA=CA HT / services
|
ServiceTurnover=CA HT / services
|
||||||
|
|
||||||
CommercialAgent=Agent commercial
|
CommercialAgent=Agent commercial
|
||||||
|
|
||||||
|
|||||||
@@ -721,6 +721,14 @@ $bc=array(0=>'class="impair"',1=>'class="pair"');
|
|||||||
$bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"');
|
$bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"');
|
||||||
$bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
|
$bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
|
||||||
|
|
||||||
|
// Define messages variables
|
||||||
|
$mesg=''; $mesgs=array();
|
||||||
|
if (isset($_SESSION['dol_message']))
|
||||||
|
{
|
||||||
|
$mesgs[]=$_SESSION['dol_message'];
|
||||||
|
unset($_SESSION['dol_message']);
|
||||||
|
}
|
||||||
|
|
||||||
// Constants used to defined number of lines in textarea
|
// Constants used to defined number of lines in textarea
|
||||||
if (empty($conf->browser->firefox))
|
if (empty($conf->browser->firefox))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file /htdocs/admin/margin.php
|
* \file /htdocs/margin/admin/margin.php
|
||||||
* \ingroup margin
|
* \ingroup margin
|
||||||
* \brief Page to setup margin module
|
* \brief Page to setup margin module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include("../main.inc.php");
|
include("../../main.inc.php");
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/margin/lib/margins.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/margin/lib/margins.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||||
@@ -121,7 +121,7 @@ $form = new Form($db);
|
|||||||
|
|
||||||
// GLOBAL DISCOUNT MANAGEMENT
|
// GLOBAL DISCOUNT MANAGEMENT
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<form method=\"post\" action=\"marges.php\">";
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
@@ -219,7 +219,7 @@ print '</tr>';
|
|||||||
|
|
||||||
// GLOBAL DISCOUNT MANAGEMENT
|
// GLOBAL DISCOUNT MANAGEMENT
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<form method=\"post\" action=\"marges.php\">";
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"remises\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"remises\">";
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
@@ -39,12 +39,16 @@ $mesg = '';
|
|||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
if (! $sortfield) $sortfield="s.nom";
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0; }
|
if ($page == -1) { $page = 0; }
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $conf->liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
$startdate=$enddate='';
|
||||||
|
|
||||||
if (!empty($_POST['startdatemonth']))
|
if (!empty($_POST['startdatemonth']))
|
||||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||||
if (!empty($_POST['enddatemonth']))
|
if (!empty($_POST['enddatemonth']))
|
||||||
@@ -68,30 +72,16 @@ print_fiche_titre($text);
|
|||||||
// Show tabs
|
// Show tabs
|
||||||
$head=marges_prepare_head($user);
|
$head=marges_prepare_head($user);
|
||||||
$titre=$langs->trans("Margins");
|
$titre=$langs->trans("Margins");
|
||||||
$picto='marges';
|
$picto='margin';
|
||||||
dol_fiche_head($head, 'agentMargins', $titre, 0, $picto);
|
dol_fiche_head($head, 'agentMargins', $titre, 0, $picto);
|
||||||
|
|
||||||
print '<form method="post" name="sel">';
|
print '<form method="post" name="sel">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
if ($agentid > 0) {
|
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
||||||
|
print '<td colspan="4">';
|
||||||
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
print $form->select_dolusers($agentid,'agentid',1);
|
||||||
print '<td colspan="4">';
|
print '</td></tr>';
|
||||||
print $form->select_dolusers($selected=$agentid,$htmlname='agentid',$show_empty=1,$exclude='',$disabled=0,$include='',$enableonly='');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if (! $sortorder) $sortorder="ASC";
|
|
||||||
if (! $sortfield) $sortfield="s.nom";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
|
||||||
print '<td colspan="4">';
|
|
||||||
print $form->select_dolusers($selected='',$htmlname='agentid',$show_empty=1,$exclude='',$disabled=0,$include='',$enableonly='');
|
|
||||||
print '</td></tr>';
|
|
||||||
if (! $sortorder) $sortorder="ASC";
|
|
||||||
if (! $sortfield) $sortfield="u.login";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||||
@@ -112,14 +102,14 @@ print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Margin Rate
|
// Margin Rate
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
||||||
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark Rate
|
// Mark Rate
|
||||||
if ($conf->global->DISPLAY_MARK_RATES) {
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
||||||
print '<span id="markRate"></span>'; // set by jquery (see below)
|
print '<span id="markRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -163,24 +153,25 @@ if ($result)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',$num,0,'');
|
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if ($agentid > 0)
|
if ($agentid > 0)
|
||||||
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||||
else
|
else
|
||||||
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder);
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
|
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$cumul_achat = 0;
|
$cumul_achat = 0;
|
||||||
@@ -188,34 +179,34 @@ if ($result)
|
|||||||
$cumul_qty = 0;
|
$cumul_qty = 0;
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var=True;
|
$var=true;
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
while ($i < $num && $i < $conf->liste_limit)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ;
|
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price, 5)):'';
|
||||||
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ;
|
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price, 5)):'';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
if ($agentid > 0) {
|
if ($agentid > 0) {
|
||||||
$companystatic->id=$objp->socid;
|
$companystatic->id=$objp->socid;
|
||||||
$companystatic->nom=$objp->nom;
|
$companystatic->nom=$objp->nom;
|
||||||
$companystatic->client=$objp->client;
|
$companystatic->client=$objp->client;
|
||||||
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$userstatic->id=$objp->agent;
|
$userstatic->id=$objp->agent;
|
||||||
$userstatic->login=$objp->login;
|
$userstatic->login=$objp->login;
|
||||||
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
|
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
|
||||||
}
|
}
|
||||||
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
@@ -227,24 +218,24 @@ if ($result)
|
|||||||
// affichage totaux marges
|
// affichage totaux marges
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$totalMargin = $cumul_vente - $cumul_achat;
|
$totalMargin = $cumul_vente - $cumul_achat;
|
||||||
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'' ;
|
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||||
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ;
|
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||||
if ($client)
|
if (! empty($client))
|
||||||
print '<td colspan=2>';
|
print '<td colspan=2>';
|
||||||
else
|
else
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans('TotalMargin')."</td>";
|
print $langs->trans('TotalMargin')."</td>";
|
||||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,12 +42,16 @@ $mesg = '';
|
|||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
if (! $sortfield) $sortfield="s.nom";
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0; }
|
if ($page == -1) { $page = 0; }
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $conf->liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
$startdate=$enddate='';
|
||||||
|
|
||||||
if (!empty($_POST['startdatemonth']))
|
if (!empty($_POST['startdatemonth']))
|
||||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||||
if (!empty($_POST['enddatemonth']))
|
if (!empty($_POST['enddatemonth']))
|
||||||
@@ -70,37 +74,35 @@ print_fiche_titre($text);
|
|||||||
// Show tabs
|
// Show tabs
|
||||||
$head=marges_prepare_head($user);
|
$head=marges_prepare_head($user);
|
||||||
$titre=$langs->trans("Margins");
|
$titre=$langs->trans("Margins");
|
||||||
$picto='marges';
|
$picto='margin';
|
||||||
dol_fiche_head($head, 'customerMargins', $titre, 0, $picto);
|
dol_fiche_head($head, 'customerMargins', $titre, 0, $picto);
|
||||||
|
|
||||||
print '<form method="post" name="sel">';
|
print '<form method="post" name="sel">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$client = null;
|
$client = false;
|
||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
|
|
||||||
$societe = new Societe($db, $socid);
|
$soc = new Societe($db, $socid);
|
||||||
$societe->fetch($socid);
|
$soc->fetch($socid);
|
||||||
|
|
||||||
if ($societe->client)
|
if ($soc->client)
|
||||||
{
|
{
|
||||||
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>';
|
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>';
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid', $filter='client=1',$showempty=1, $showtype=0, $forcecombo=1);
|
$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid','client=1',1,0,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$client = true;
|
$client = true;
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
if (! $sortfield) $sortfield="f.datef";
|
if (! $sortfield) $sortfield="f.datef";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$client) {
|
else {
|
||||||
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>';
|
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>';
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,null,'socid', $filter='client=1',$showempty=1, $showtype=0, $forcecombo=1);
|
$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,null,'socid','client=1',1,0,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
if (! $sortorder) $sortorder="ASC";
|
|
||||||
if (! $sortfield) $sortfield="s.nom";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
@@ -122,14 +124,14 @@ print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Margin Rate
|
// Margin Rate
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
||||||
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark Rate
|
// Mark Rate
|
||||||
if ($conf->global->DISPLAY_MARK_RATES) {
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
||||||
print '<span id="markRate"></span>'; // set by jquery (see below)
|
print '<span id="markRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -169,25 +171,25 @@ if ($result)
|
|||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',$num,0,'');
|
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if ($client) {
|
if (! empty($client)) {
|
||||||
print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$_REQUEST["socid"],'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$socid,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&socid=".$socid,'align="center"',$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&socid=".$socid,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$socid,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$socid,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$socid,'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$cumul_achat = 0;
|
$cumul_achat = 0;
|
||||||
@@ -200,8 +202,8 @@ if ($result)
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ;
|
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price, 5)):'' ;
|
||||||
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ;
|
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price, 5)):'' ;
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
@@ -224,9 +226,9 @@ if ($result)
|
|||||||
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
@@ -249,9 +251,9 @@ if ($result)
|
|||||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Define head array for tabs of marges tools setup pages
|
* Define head array for tabs of marges tools setup pages
|
||||||
|
*
|
||||||
* @return Array of head
|
* @return Array of head
|
||||||
*/
|
*/
|
||||||
function marges_admin_prepare_head()
|
function marges_admin_prepare_head()
|
||||||
@@ -32,7 +33,7 @@ function marges_admin_prepare_head()
|
|||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/margin.php";
|
$head[$h][0] = DOL_URL_ROOT."/margin/admin/margin.php";
|
||||||
$head[$h][1] = $langs->trans("Parameters");
|
$head[$h][1] = $langs->trans("Parameters");
|
||||||
$head[$h][2] = 'parameters';
|
$head[$h][2] = 'parameters';
|
||||||
$h++;
|
$h++;
|
||||||
@@ -72,7 +73,20 @@ function marges_prepare_head($user)
|
|||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht) {
|
/**
|
||||||
|
* getMarginInfos
|
||||||
|
*
|
||||||
|
* @param float $pvht Buying price with tax
|
||||||
|
* @param float $remise_percent Discount percent
|
||||||
|
* @param float $tva_tx Vat rate
|
||||||
|
* @param float $localtax1_tx Vat rate special 1
|
||||||
|
* @param float $localtax2_tx Vat rate special 2
|
||||||
|
* @param int $fk_pa ???
|
||||||
|
* @param float $paht Buying price without tax
|
||||||
|
* @return array Array of margin info
|
||||||
|
*/
|
||||||
|
function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht)
|
||||||
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$marge_tx_ret='';
|
$marge_tx_ret='';
|
||||||
|
|||||||
@@ -47,12 +47,16 @@ $mesg = '';
|
|||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
if (! $sortfield) $sortfield="p.ref";
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0; }
|
if ($page == -1) { $page = 0; }
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $conf->liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
$startdate=$enddate='';
|
||||||
|
|
||||||
if (!empty($_POST['startdatemonth']))
|
if (!empty($_POST['startdatemonth']))
|
||||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||||
if (!empty($_POST['enddatemonth']))
|
if (!empty($_POST['enddatemonth']))
|
||||||
@@ -76,7 +80,7 @@ print_fiche_titre($text);
|
|||||||
// Show tabs
|
// Show tabs
|
||||||
$head=marges_prepare_head($user);
|
$head=marges_prepare_head($user);
|
||||||
$titre=$langs->trans("Margins");
|
$titre=$langs->trans("Margins");
|
||||||
$picto='marges';
|
$picto='margin';
|
||||||
dol_fiche_head($head, 'productMargins', $titre, 0, $picto);
|
dol_fiche_head($head, 'productMargins', $titre, 0, $picto);
|
||||||
|
|
||||||
print '<form method="post" name="sel">';
|
print '<form method="post" name="sel">';
|
||||||
@@ -84,12 +88,9 @@ print '<table class="border" width="100%">';
|
|||||||
|
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
|
|
||||||
$societe = new Societe($db, $socid);
|
|
||||||
$societe->fetch($socid);
|
|
||||||
|
|
||||||
print '<tr><td width="20%">'.$langs->trans('ChooseProduct/Service').'</td>';
|
print '<tr><td width="20%">'.$langs->trans('ChooseProduct/Service').'</td>';
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
print $form->select_produits($selected=$id, $htmlname='id', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=1);
|
print $form->select_produits($id,'id','',20,0,1,2,'',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td width="20%">'.$langs->trans('AllProducts').'</td>';
|
print '<tr><td width="20%">'.$langs->trans('AllProducts').'</td>';
|
||||||
@@ -99,12 +100,11 @@ if ($id > 0) {
|
|||||||
if (! $sortfield) $sortfield="f.datef";
|
if (! $sortfield) $sortfield="f.datef";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<tr><td width="20%">'.$langs->trans('ChooseProduct/Service').'</td>';
|
print '<tr><td width="20%">'.$langs->trans('ChooseProduct/Service').'</td>';
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
print $form->select_produits($selected='', $htmlname='id', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=1);
|
print $form->select_produits('','id','',20,0,1,2,'',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
if (! $sortorder) $sortorder="ASC";
|
|
||||||
if (! $sortfield) $sortfield="p.ref";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
@@ -126,14 +126,14 @@ print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Margin Rate
|
// Margin Rate
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
|
||||||
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark Rate
|
// Mark Rate
|
||||||
if ($conf->global->DISPLAY_MARK_RATES) {
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
|
||||||
print '<span id="markRate"></span>'; // set by jquery (see below)
|
print '<span id="markRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -142,7 +142,7 @@ if ($conf->global->DISPLAY_MARK_RATES) {
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
$sql = "SELECT distinct d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref,";
|
$sql = "SELECT DISTINCT d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref,";
|
||||||
$sql.= " f.facnumber, f.total as total_ht,";
|
$sql.= " f.facnumber, f.total as total_ht,";
|
||||||
$sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price,";
|
$sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price,";
|
||||||
$sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ;
|
$sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ;
|
||||||
@@ -151,10 +151,10 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND f.fk_soc = s.rowid";
|
||||||
$sql.= " AND d.fk_product = p.rowid";
|
$sql.= " AND d.fk_product = p.rowid";
|
||||||
$sql.= " AND f.fk_statut > 0";
|
$sql.= " AND f.fk_statut > 0";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
|
||||||
$sql.= " AND d.fk_facture = f.rowid";
|
$sql.= " AND d.fk_facture = f.rowid";
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
$sql.= " AND d.fk_product =".$id;
|
$sql.= " AND d.fk_product =".$id;
|
||||||
@@ -174,26 +174,26 @@ if ($result)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,'');
|
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=".$id,$sortfield,$sortorder,'',$num,0,'');
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$_REQUEST["id"],'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$id,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$_REQUEST["id"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","",'align="center"',$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&id=".$_REQUEST["id"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&id=".$id,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$id,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$id,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$id,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$id,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$id,'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$cumul_achat = 0;
|
$cumul_achat = 0;
|
||||||
@@ -213,29 +213,29 @@ if ($result)
|
|||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$invoicestatic->id=$objp->facid;
|
$invoicestatic->id=$objp->facid;
|
||||||
$invoicestatic->ref=$objp->facnumber;
|
$invoicestatic->ref=$objp->facnumber;
|
||||||
print $invoicestatic->getNomUrl(1);
|
print $invoicestatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "<td align=\"center\">";
|
print "<td align=\"center\">";
|
||||||
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
|
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$product_static->type=$objp->fk_product_type;
|
$product_static->type=$objp->fk_product_type;
|
||||||
$product_static->id=$objp->fk_product;
|
$product_static->id=$objp->fk_product;
|
||||||
$product_static->ref=$objp->ref;
|
$product_static->ref=$objp->ref;
|
||||||
$product_static->libelle=$objp->label;
|
$product_static->libelle=$objp->label;
|
||||||
$text=$product_static->getNomUrl(1);
|
$text=$product_static->getNomUrl(1);
|
||||||
$text.= ' - '.$objp->label;
|
$text.= ' - '.$objp->label;
|
||||||
print "<td>".$product_static->getNomUrl(1)."</td>\n";
|
print "<td>".$product_static->getNomUrl(1)."</td>\n";
|
||||||
}
|
}
|
||||||
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
@@ -251,20 +251,20 @@ if ($result)
|
|||||||
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ;
|
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ;
|
||||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
print '<td colspan=2>';
|
print '<td colspan=2>';
|
||||||
else
|
else
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans('TotalMargin')."</td>";
|
print $langs->trans('TotalMargin')."</td>";
|
||||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -287,9 +287,9 @@ $(document).ready(function() {
|
|||||||
$("div.fiche form").submit();
|
$("div.fiche form").submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#totalMargin").html("<?php echo price($totalMargin); ?>");
|
$("#totalMargin").html("<?php echo price($totalMargin); ?>");
|
||||||
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate)."%"); ?>");
|
$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate)."%"); ?>");
|
||||||
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
|
$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -80,7 +80,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$head=product_prepare_head($object, $user);
|
$head=product_prepare_head($object, $user);
|
||||||
$titre=$langs->trans("CardProduct".$object->type);
|
$titre=$langs->trans("CardProduct".$object->type);
|
||||||
$picto=($object->type==1?'service':'product');
|
$picto=($object->type==1?'service':'product');
|
||||||
dol_fiche_head($head, 'marges', $titre, 0, $picto);
|
dol_fiche_head($head, 'margin', $titre, 0, $picto);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@@ -111,14 +111,14 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Margin Rate
|
// Margin Rate
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="3">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="3">';
|
||||||
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark Rate
|
// Mark Rate
|
||||||
if ($conf->global->DISPLAY_MARK_RATES) {
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="3">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="3">';
|
||||||
print '<span id="markRate"></span>'; // set by jquery (see below)
|
print '<span id="markRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -128,7 +128,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
|
$sql = "SELECT DISTINCT s.nom, s.rowid as socid, s.code_client,";
|
||||||
$sql.= " f.facnumber, f.total as total_ht,";
|
$sql.= " f.facnumber, f.total as total_ht,";
|
||||||
$sql.= " (d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, (d.buy_price_ht * d.qty) as buying_price, d.qty, ((d.subprice - d.buy_price_ht) * d.qty) as marge," ;
|
$sql.= " (d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, (d.buy_price_ht * d.qty) as buying_price, d.qty, ((d.subprice - d.buy_price_ht) * d.qty) as marge," ;
|
||||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||||
@@ -143,7 +143,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$sql.= " AND d.fk_facture = f.rowid";
|
$sql.= " AND d.fk_facture = f.rowid";
|
||||||
$sql.= " AND d.fk_product =".$object->id;
|
$sql.= " AND d.fk_product =".$object->id;
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid) $sql.= " AND f.fk_soc = $socid";
|
if (! empty($socid)) $sql.= " AND f.fk_soc = $socid";
|
||||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||||
|
|
||||||
@@ -158,19 +158,19 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$_GET["id"],'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$object->id,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$_GET["id"],'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$object->id,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$_GET["id"],'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$object->id,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$_GET["id"],'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$object->id,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$object->id,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$object->id,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$object->id,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$object->id,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$object->id,'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$cumul_achat = 0;
|
$cumul_achat = 0;
|
||||||
@@ -184,8 +184,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ;
|
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price, 5)):'' ;
|
||||||
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ;
|
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price, 5)):'' ;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$invoicestatic->id=$objp->facid;
|
$invoicestatic->id=$objp->facid;
|
||||||
@@ -200,9 +200,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->qty)."</td>\n";
|
print "<td align=\"right\">".price($objp->qty)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -217,16 +217,16 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
$totalMargin = $cumul_vente - $cumul_achat;
|
$totalMargin = $cumul_vente - $cumul_achat;
|
||||||
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'';
|
$marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'';
|
||||||
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente ,5)):'';
|
$markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'';
|
||||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||||
print '<td colspan=4>'.$langs->trans('TotalMargin')."</td>";
|
print '<td colspan=4>'.$langs->trans('TotalMargin')."</td>";
|
||||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_qty)."</td>\n";
|
print "<td align=\"right\">".price($cumul_qty)."</td>\n";
|
||||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print '<td align="right"> </td>';
|
print '<td align="right"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ if ($socid > 0)
|
|||||||
|
|
||||||
$head = societe_prepare_head($societe);
|
$head = societe_prepare_head($societe);
|
||||||
|
|
||||||
dol_fiche_head($head, 'marges', $langs->trans("ThirdParty"),0,'company');
|
dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"),0,'company');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@@ -109,14 +109,14 @@ if ($socid > 0)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Margin Rate
|
// Margin Rate
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES) {
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="3">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarginRate").'</td><td colspan="3">';
|
||||||
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
print '<span id="marginRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark Rate
|
// Mark Rate
|
||||||
if ($conf->global->DISPLAY_MARK_RATES) {
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="3">';
|
print '<tr style="font-weight: bold"><td>'.$langs->trans("MarkRate").'</td><td colspan="3">';
|
||||||
print '<span id="markRate"></span>'; // set by jquery (see below)
|
print '<span id="markRate"></span>'; // set by jquery (see below)
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@@ -158,9 +158,9 @@ if ($socid > 0)
|
|||||||
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -175,8 +175,8 @@ if ($socid > 0)
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ;
|
$marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price, 5)):'' ;
|
||||||
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ;
|
$markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price, 5)):'' ;
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
@@ -191,9 +191,9 @@ if ($socid > 0)
|
|||||||
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||||
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
print "<td align=\"right\">".price($objp->marge)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -213,9 +213,9 @@ if ($socid > 0)
|
|||||||
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
print "<td align=\"right\">".price($cumul_vente)."</td>\n";
|
||||||
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
print "<td align=\"right\">".price($cumul_achat)."</td>\n";
|
||||||
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
print "<td align=\"right\">".price($totalMargin)."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n";
|
||||||
if ($conf->global->DISPLAY_MARK_RATES)
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n";
|
||||||
print '<td align="right"> </td>';
|
print '<td align="right"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -60,12 +60,12 @@ if (! isset($_GET['htmlname'])) return;
|
|||||||
$htmlname = $_GET['htmlname'];
|
$htmlname = $_GET['htmlname'];
|
||||||
$match = preg_grep('/('.$htmlname.'[0-9]+)/',array_keys($_GET));
|
$match = preg_grep('/('.$htmlname.'[0-9]+)/',array_keys($_GET));
|
||||||
sort($match);
|
sort($match);
|
||||||
$idprod = $match[0];
|
$idprod = (! empty($match[0]) ? $match[0] : '');
|
||||||
|
|
||||||
if (! isset($_GET[$htmlname]) && ! isset($_GET[$idprod])) return;
|
if (! isset($_GET[$htmlname]) && ! isset($_GET[$idprod])) return;
|
||||||
|
|
||||||
// When used from jQuery, the search term is added as GET param "term".
|
// When used from jQuery, the search term is added as GET param "term".
|
||||||
$searchkey=$_GET[$idprod];
|
$searchkey=(! empty($_GET[$idprod])?$_GET[$idprod]:'');
|
||||||
if (empty($searchkey)) $searchkey=$_GET[$htmlname];
|
if (empty($searchkey)) $searchkey=$_GET[$htmlname];
|
||||||
$outjson=isset($_GET['outjson'])?$_GET['outjson']:0;
|
$outjson=isset($_GET['outjson'])?$_GET['outjson']:0;
|
||||||
|
|
||||||
|
|||||||
@@ -700,7 +700,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
if (!$this->db->query($sql2)) return -1;
|
if (!$this->db->query($sql2)) return -1;
|
||||||
}
|
}
|
||||||
else
|
else if (isset($this->multilangs["$key"]))
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result)) // si aucune ligne dans la base
|
if ($this->db->num_rows($result)) // si aucune ligne dans la base
|
||||||
{
|
{
|
||||||
@@ -2082,13 +2082,12 @@ class Product extends CommonObject
|
|||||||
function get_arbo_each_prod($multiply=1)
|
function get_arbo_each_prod($multiply=1)
|
||||||
{
|
{
|
||||||
$this->res = array();
|
$this->res = array();
|
||||||
if (is_array($this -> sousprods))
|
if (isset($this->sousprods) && is_array($this->sousprods))
|
||||||
{
|
{
|
||||||
foreach($this -> sousprods as $nom_pere => $desc_pere)
|
foreach($this->sousprods as $nom_pere => $desc_pere)
|
||||||
{
|
{
|
||||||
if (is_array($desc_pere)) $this->fetch_prod_arbo($desc_pere,"",$multiply);
|
if (is_array($desc_pere)) $this->fetch_prod_arbo($desc_pere,"",$multiply);
|
||||||
}
|
}
|
||||||
// dol_sort($this->res,);
|
|
||||||
}
|
}
|
||||||
return $this->res;
|
return $this->res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,23 +34,24 @@ 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."/core/lib/product.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
||||||
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
if (! empty($conf->propal->enabled)) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||||
if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
if (! empty($conf->facture->enabled)) require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||||
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
if ($conf->stock->enabled) $langs->load("stocks");
|
if (! empty($conf->stock->enabled)) $langs->load("stocks");
|
||||||
if ($conf->facture->enabled) $langs->load("bills");
|
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||||
|
|
||||||
$mesg=''; $error=0; $errors=array();
|
$mesg=''; $error=0; $errors=array(); $_error=0;
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id=GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref=GETPOST('ref', 'alpha');
|
||||||
|
$type=GETPOST('type','int');
|
||||||
$action=(GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view');
|
$action=(GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$socid=GETPOST('socid','int');
|
$socid=GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
|
|
||||||
$object = new Product($db);
|
$object = new Product($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
@@ -58,6 +59,7 @@ $extrafields = new ExtraFields($db);
|
|||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
$object->getCanvas($id,$ref);
|
$object->getCanvas($id,$ref);
|
||||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||||
|
$objcanvas='';
|
||||||
if (! empty($canvas))
|
if (! empty($canvas))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||||
@@ -91,7 +93,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setfk_product_type' && $user->rights->produit->creer)
|
if ($action == 'setfk_product_type' && $user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setValueFrom('fk_product_type', $_POST['fk_product_type']);
|
$result = $object->setValueFrom('fk_product_type', GETPOST('fk_product_type'));
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -100,7 +102,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setfk_barcode_type' && $user->rights->barcode->creer)
|
if ($action == 'setfk_barcode_type' && $user->rights->barcode->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setValueFrom('fk_barcode_type', $_POST['fk_barcode_type']);
|
$result = $object->setValueFrom('fk_barcode_type', GETPOST('fk_barcode_type'));
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -110,7 +112,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
//Todo: ajout verification de la validite du code barre en fonction du type
|
//Todo: ajout verification de la validite du code barre en fonction du type
|
||||||
$result = $object->setValueFrom('barcode', $_POST['barcode']);
|
$result = $object->setValueFrom('barcode', GETPOST('barcode'));
|
||||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -118,7 +120,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setaccountancy_code_buy')
|
if ($action == 'setaccountancy_code_buy')
|
||||||
{
|
{
|
||||||
$object->fetch($id,$ref);
|
$object->fetch($id,$ref);
|
||||||
$result = $object->setValueFrom('accountancy_code_buy', $_POST['accountancy_code_buy']);
|
$result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg=join(',',$object->errors);
|
$mesg=join(',',$object->errors);
|
||||||
@@ -129,7 +131,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setaccountancy_code_sell')
|
if ($action == 'setaccountancy_code_sell')
|
||||||
{
|
{
|
||||||
$object->fetch($id,$ref);
|
$object->fetch($id,$ref);
|
||||||
$result = $object->setValueFrom('accountancy_code_sell', $_POST['accountancy_code_sell']);
|
$result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg=join(',',$object->errors);
|
$mesg=join(',',$object->errors);
|
||||||
@@ -142,63 +144,59 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (empty($_POST["libelle"]))
|
if (GETPOST('libelle'))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'</div>';
|
||||||
$action = "create";
|
$action = "create";
|
||||||
$_GET["canvas"] = $_POST["canvas"];
|
|
||||||
$_GET["type"] = $_POST["type"];
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($ref))
|
if (empty($ref))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'</div>';
|
||||||
$action = "create";
|
$action = "create";
|
||||||
$_GET["canvas"] = $_POST["canvas"];
|
|
||||||
$_GET["type"] = $_POST["type"];
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->ref = $ref;
|
$object->ref = $ref;
|
||||||
$object->libelle = $_POST["libelle"];
|
$object->libelle = GETPOST('libelle');
|
||||||
$object->price_base_type = $_POST["price_base_type"];
|
$object->price_base_type = GETPOST('price_base_type');
|
||||||
if ($object->price_base_type == 'TTC') $object->price_ttc = $_POST["price"];
|
if ($object->price_base_type == 'TTC') $object->price_ttc = GETPOST('price');
|
||||||
else $object->price = $_POST["price"];
|
else $object->price = GETPOST('price');
|
||||||
if ($object->price_base_type == 'TTC') $object->price_min_ttc = $_POST["price_min"];
|
if ($object->price_base_type == 'TTC') $object->price_min_ttc = GETPOST('price_min');
|
||||||
else $object->price_min = $_POST["price_min"];
|
else $object->price_min = GETPOST('price_min');
|
||||||
$object->tva_tx = str_replace('*','',$_POST['tva_tx']);
|
$object->tva_tx = str_replace('*','',GETPOST('tva_tx'));
|
||||||
$object->tva_npr = preg_match('/\*/',$_POST['tva_tx'])?1:0;
|
$object->tva_npr = preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
||||||
|
|
||||||
// local taxes.
|
// local taxes.
|
||||||
$object->localtax1_tx = get_localtax($object->tva_tx,1);
|
$object->localtax1_tx = get_localtax($object->tva_tx,1);
|
||||||
$object->localtax2_tx = get_localtax($object->tva_tx,2);
|
$object->localtax2_tx = get_localtax($object->tva_tx,2);
|
||||||
|
|
||||||
$object->type = $_POST["type"];
|
$object->type = $type;
|
||||||
$object->status = $_POST["statut"];
|
$object->status = GETPOST('statut');
|
||||||
$object->status_buy = $_POST["statut_buy"];
|
$object->status_buy = GETPOST('statut_buy');
|
||||||
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
|
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
|
||||||
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
$object->note = dol_htmlcleanlastbr(GETPOST('note'));
|
||||||
$object->customcode = $_POST["customcode"];
|
$object->customcode = GETPOST('customcode');
|
||||||
$object->country_id = $_POST["country_id"];
|
$object->country_id = GETPOST('country_id');
|
||||||
$object->duration_value = $_POST["duration_value"];
|
$object->duration_value = GETPOST('duration_value');
|
||||||
$object->duration_unit = $_POST["duration_unit"];
|
$object->duration_unit = GETPOST('duration_unit');
|
||||||
$object->seuil_stock_alerte = $_POST["seuil_stock_alerte"]?$_POST["seuil_stock_alerte"]:0;
|
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0;
|
||||||
$object->canvas = $_POST["canvas"];
|
$object->canvas = GETPOST('canvas');
|
||||||
$object->weight = $_POST["weight"];
|
$object->weight = GETPOST('weight');
|
||||||
$object->weight_units = $_POST["weight_units"];
|
$object->weight_units = GETPOST('weight_units');
|
||||||
$object->length = $_POST["size"];
|
$object->length = GETPOST('size');
|
||||||
$object->length_units = $_POST["size_units"];
|
$object->length_units = GETPOST('size_units');
|
||||||
$object->surface = $_POST["surface"];
|
$object->surface = GETPOST('surface');
|
||||||
$object->surface_units = $_POST["surface_units"];
|
$object->surface_units = GETPOST('surface_units');
|
||||||
$object->volume = $_POST["volume"];
|
$object->volume = GETPOST('volume');
|
||||||
$object->volume_units = $_POST["volume_units"];
|
$object->volume_units = GETPOST('volume_units');
|
||||||
$object->finished = $_POST["finished"];
|
$object->finished = GETPOST('finished');
|
||||||
$object->hidden = $_POST["hidden"]=='yes'?1:0;
|
$object->hidden = GETPOST('hidden')=='yes'?1:0;
|
||||||
|
|
||||||
// MultiPrix
|
// MultiPrix
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
{
|
{
|
||||||
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||||
{
|
{
|
||||||
@@ -234,7 +232,6 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
||||||
$action = "create";
|
$action = "create";
|
||||||
$_GET["type"] = $_POST["type"];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,7 +239,7 @@ if (empty($reshook))
|
|||||||
// Update a product or service
|
// Update a product or service
|
||||||
if ($action == 'update' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'update' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
if (! empty($_POST["cancel"]))
|
if (GETPOST('cancel'))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@@ -253,27 +250,27 @@ if (empty($reshook))
|
|||||||
$object->oldcopy=dol_clone($object);
|
$object->oldcopy=dol_clone($object);
|
||||||
|
|
||||||
$object->ref = $ref;
|
$object->ref = $ref;
|
||||||
$object->libelle = $_POST["libelle"];
|
$object->libelle = GETPOST('libelle');
|
||||||
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
|
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
|
||||||
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
$object->note = dol_htmlcleanlastbr(GETPOST('note'));
|
||||||
$object->customcode = $_POST["customcode"];
|
$object->customcode = GETPOST('customcode');
|
||||||
$object->country_id = $_POST["country_id"];
|
$object->country_id = GETPOST('country_id');
|
||||||
$object->status = $_POST["statut"];
|
$object->status = GETPOST('statut');
|
||||||
$object->status_buy = $_POST["statut_buy"];
|
$object->status_buy = GETPOST('statut_buy');
|
||||||
$object->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
|
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
||||||
$object->duration_value = $_POST["duration_value"];
|
$object->duration_value = GETPOST('duration_value');
|
||||||
$object->duration_unit = $_POST["duration_unit"];
|
$object->duration_unit = GETPOST('duration_unit');
|
||||||
$object->canvas = $_POST["canvas"];
|
$object->canvas = GETPOST('canvas');
|
||||||
$object->weight = $_POST["weight"];
|
$object->weight = GETPOST('weight');
|
||||||
$object->weight_units = $_POST["weight_units"];
|
$object->weight_units = GETPOST('weight_units');
|
||||||
$object->length = $_POST["size"];
|
$object->length = GETPOST('size');
|
||||||
$object->length_units = $_POST["size_units"];
|
$object->length_units = GETPOST('size_units');
|
||||||
$object->surface = $_POST["surface"];
|
$object->surface = GETPOST('surface');
|
||||||
$object->surface_units = $_POST["surface_units"];
|
$object->surface_units = GETPOST('surface_units');
|
||||||
$object->volume = $_POST["volume"];
|
$object->volume = GETPOST('volume');
|
||||||
$object->volume_units = $_POST["volume_units"];
|
$object->volume_units = GETPOST('volume_units');
|
||||||
$object->finished = $_POST["finished"];
|
$object->finished = GETPOST('finished');
|
||||||
$object->hidden = $_POST["hidden"]=='yes'?1:0;
|
$object->hidden = GETPOST('hidden')=='yes'?1:0;
|
||||||
|
|
||||||
// Get extra fields
|
// Get extra fields
|
||||||
foreach($_POST as $key => $value)
|
foreach($_POST as $key => $value)
|
||||||
@@ -348,7 +345,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
$_error = 1;
|
$_error++;
|
||||||
$action = "";
|
$action = "";
|
||||||
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorProductAlreadyExists",$object->ref);
|
$mesg='<div class="error">'.$langs->trans("ErrorProductAlreadyExists",$object->ref);
|
||||||
@@ -403,7 +400,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'addinpropal')
|
if ($action == 'addinpropal')
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$result=$propal->fetch($_POST["propalid"]);
|
$result=$propal->fetch(GETPOST('propalid'));
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$propal->error);
|
dol_print_error($db,$propal->error);
|
||||||
@@ -462,12 +459,12 @@ if (empty($reshook))
|
|||||||
$propal->id,
|
$propal->id,
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
$_POST["qty"],
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx, // localtax1
|
$localtax1_tx, // localtax1
|
||||||
$localtax2_tx, // localtax2
|
$localtax2_tx, // localtax2
|
||||||
$prod->id,
|
$prod->id,
|
||||||
$_POST["remise_percent"],
|
GETPOST('remise_percent'),
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
$pu_ttc
|
$pu_ttc
|
||||||
);
|
);
|
||||||
@@ -484,7 +481,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'addincommande')
|
if ($action == 'addincommande')
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
$result=$commande->fetch($_POST["commandeid"]);
|
$result=$commande->fetch(GETPOST('commandeid'));
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$commande->error);
|
dol_print_error($db,$commande->error);
|
||||||
@@ -544,12 +541,12 @@ if (empty($reshook))
|
|||||||
$commande->id,
|
$commande->id,
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
$_POST["qty"],
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx, // localtax1
|
$localtax1_tx, // localtax1
|
||||||
$localtax2_tx, // localtax2
|
$localtax2_tx, // localtax2
|
||||||
$prod->id,
|
$prod->id,
|
||||||
$_POST["remise_percent"],
|
GETPOST('remise_percent'),
|
||||||
'',
|
'',
|
||||||
'', // TODO voir si fk_remise_except est encore valable car n'apparait plus dans les propales
|
'', // TODO voir si fk_remise_except est encore valable car n'apparait plus dans les propales
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
@@ -567,7 +564,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'addinfacture' && $user->rights->facture->creer)
|
if ($action == 'addinfacture' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$facture = New Facture($db);
|
$facture = New Facture($db);
|
||||||
$result=$facture->fetch($_POST["factureid"]);
|
$result=$facture->fetch(GETPOST('factureid'));
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$facture->error);
|
dol_print_error($db,$facture->error);
|
||||||
@@ -626,12 +623,12 @@ if (empty($reshook))
|
|||||||
$facture->id,
|
$facture->id,
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
$_POST["qty"],
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx,
|
$localtax1_tx,
|
||||||
$localtax2_tx,
|
$localtax2_tx,
|
||||||
$prod->id,
|
$prod->id,
|
||||||
$_POST["remise_percent"],
|
GETPOST('remise_percent'),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@@ -697,9 +694,9 @@ else
|
|||||||
print '<form action="fiche.php" method="post">';
|
print '<form action="fiche.php" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="type" value="'.$_GET["type"].'">'."\n";
|
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
||||||
|
|
||||||
if ($_GET["type"]==1) $title=$langs->trans("NewService");
|
if ($type==1) $title=$langs->trans("NewService");
|
||||||
else $title=$langs->trans("NewProduct");
|
else $title=$langs->trans("NewProduct");
|
||||||
print_fiche_titre($title);
|
print_fiche_titre($title);
|
||||||
|
|
||||||
@@ -708,32 +705,32 @@ else
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$ref.'">';
|
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$ref.'">';
|
||||||
if ($_error == 1)
|
if ($_error)
|
||||||
{
|
{
|
||||||
print $langs->trans("RefAlreadyExists");
|
print $langs->trans("RefAlreadyExists");
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$_POST["libelle"].'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.GETPOST('libelle').'"></td></tr>';
|
||||||
|
|
||||||
// On sell
|
// On sell
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||||
print $form->selectarray('statut',$statutarray,$_POST["statut"]);
|
print $form->selectarray('statut',$statutarray,GETPOST('statut'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// To buy
|
// To buy
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||||
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
||||||
print $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
|
print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy"'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Stock min level
|
// Stock min level
|
||||||
if ($_GET["type"] != 1 && $conf->stock->enabled)
|
if ($type != 1 && $conf->stock->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
||||||
print '<input name="seuil_stock_alerte" size="4" value="'.$_POST["seuil_stock_alerte"].'">';
|
print '<input name="seuil_stock_alerte" size="4" value="'.GETPOST('seuil_stock_alerte').'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -745,24 +742,24 @@ else
|
|||||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('desc',$_POST["desc"],'',160,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90);
|
$doleditor=new DolEditor('desc',GETPOST('desc'),'',160,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Nature
|
// Nature
|
||||||
if ($_GET["type"] != 1)
|
if ($type != 1)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
|
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
|
||||||
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||||
print $form->selectarray('finished',$statutarray,$_POST["finished"]);
|
print $form->selectarray('finished',$statutarray,GETPOST('finished'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if ($_GET["type"] == 1)
|
if ($type == 1)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Duration").'</td><td><input name="duration_value" size="6" maxlength="5" value="'.$object->duree.'"> ';
|
print '<tr><td>'.$langs->trans("Duration").'</td><td><input name="duration_value" size="6" maxlength="5" value="'.GETPOST('duration_value').'"> ';
|
||||||
print '<input name="duration_unit" type="radio" value="h">'.$langs->trans("Hour").' ';
|
print '<input name="duration_unit" type="radio" value="h">'.$langs->trans("Hour").' ';
|
||||||
print '<input name="duration_unit" type="radio" value="d">'.$langs->trans("Day").' ';
|
print '<input name="duration_unit" type="radio" value="d">'.$langs->trans("Day").' ';
|
||||||
print '<input name="duration_unit" type="radio" value="w">'.$langs->trans("Week").' ';
|
print '<input name="duration_unit" type="radio" value="w">'.$langs->trans("Week").' ';
|
||||||
@@ -771,36 +768,36 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["type"] != 1) // Le poids et le volume ne concerne que les produits et pas les services
|
if ($type != 1) // Le poids et le volume ne concerne que les produits et pas les services
|
||||||
{
|
{
|
||||||
// Weight
|
// Weight
|
||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
print '<input name="weight" size="4" value="'.$_POST["weight"].'">';
|
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
|
||||||
print $formproduct->select_measuring_units("weight_units","weight");
|
print $formproduct->select_measuring_units("weight_units","weight");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// Length
|
// Length
|
||||||
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
||||||
print '<input name="size" size="4" value="'.$_POST["size"].'">';
|
print '<input name="size" size="4" value="'.GETPOST('size').'">';
|
||||||
print $formproduct->select_measuring_units("size_units","size");
|
print $formproduct->select_measuring_units("size_units","size");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// Surface
|
// Surface
|
||||||
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||||
print '<input name="surface" size="4" value="'.$_POST["surface"].'">';
|
print '<input name="surface" size="4" value="'.GETPOST('surface').'">';
|
||||||
print $formproduct->select_measuring_units("surface_units","surface");
|
print $formproduct->select_measuring_units("surface_units","surface");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// Volume
|
// Volume
|
||||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||||
print '<input name="volume" size="4" value="'.$_POST["volume"].'">';
|
print '<input name="volume" size="4" value="'.GETPOST('volume').'">';
|
||||||
print $formproduct->select_measuring_units("volume_units","volume");
|
print $formproduct->select_measuring_units("volume_units","volume");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customs code
|
// Customs code
|
||||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$_POST["customcode"].'"></td></tr>';
|
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.GETPOST('customcode').'"></td></tr>';
|
||||||
|
|
||||||
// Origin country
|
// Origin country
|
||||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td>';
|
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||||
print $form->select_country($_POST["country_id"],'country_id');
|
print $form->select_country(GETPOST('country_id','int'),'country_id');
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@@ -811,7 +808,7 @@ else
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
$value=(GETPOST('options_'.$key)?GETPOST('options_'.$key):$object->array_options["options_".$key]);
|
||||||
print '<tr><td>'.$label.'</td><td colspan="3">';
|
print '<tr><td>'.$label.'</td><td colspan="3">';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
@@ -821,7 +818,7 @@ else
|
|||||||
// Note (private, no output on invoices, propales...)
|
// Note (private, no output on invoices, propales...)
|
||||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
|
$doleditor=new DolEditor('note',GETPOST('note'),'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,7 +27,8 @@ require("../main.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.product.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.product.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||||
if ($conf->categorie->enabled) require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
if (! empty($conf->categorie->enabled))
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
@@ -43,6 +44,7 @@ $search_categ = GETPOST("search_categ",'int');
|
|||||||
$tosell = GETPOST("tosell");
|
$tosell = GETPOST("tosell");
|
||||||
$tobuy = GETPOST("tobuy");
|
$tobuy = GETPOST("tobuy");
|
||||||
$fourn_id = GETPOST("fourn_id",'int');
|
$fourn_id = GETPOST("fourn_id",'int');
|
||||||
|
$catid = GETPOST('catid','int');
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
@@ -59,7 +61,8 @@ $limit = $conf->liste_limit;
|
|||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
//$object->getCanvas($id);
|
//$object->getCanvas($id);
|
||||||
$canvas = GETPOST("canvas");
|
$canvas=GETPOST("canvas");
|
||||||
|
$objcanvas='';
|
||||||
if (! empty($canvas))
|
if (! empty($canvas))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||||
@@ -85,12 +88,6 @@ if (isset($_POST["button_removefilter_x"]))
|
|||||||
$search_categ=0;
|
$search_categ=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->categorie->enabled && GETPOST('catid'))
|
|
||||||
{
|
|
||||||
$catid = GETPOST('catid','int');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@@ -108,7 +105,7 @@ else
|
|||||||
{
|
{
|
||||||
$title=$langs->trans("ProductsAndServices");
|
$title=$langs->trans("ProductsAndServices");
|
||||||
|
|
||||||
if (isset($_GET["type"]))
|
if (isset($type))
|
||||||
{
|
{
|
||||||
if ($type==1)
|
if ($type==1)
|
||||||
{
|
{
|
||||||
@@ -129,7 +126,7 @@ else
|
|||||||
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
|
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
|
||||||
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||||
if ($search_categ || $catid) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
|
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||||
if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
||||||
@@ -173,13 +170,16 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
$helpurl='';
|
$helpurl='';
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 0)
|
if (isset($type))
|
||||||
{
|
{
|
||||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
if ($type == 0)
|
||||||
}
|
{
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 1)
|
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||||
{
|
}
|
||||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
else if ($type == 1)
|
||||||
|
{
|
||||||
|
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader('',$title,$helpurl,'');
|
llxHeader('',$title,$helpurl,'');
|
||||||
@@ -193,16 +193,16 @@ else
|
|||||||
$param.=isset($type)?"&type=".$type:"";
|
$param.=isset($type)?"&type=".$type:"";
|
||||||
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
||||||
|
|
||||||
if (isset($catid))
|
if (! empty($catid))
|
||||||
{
|
{
|
||||||
print "<div id='ways'>";
|
print "<div id='ways'>";
|
||||||
$c = new Categorie($db, $catid);
|
$c = new Categorie($db);
|
||||||
$ways = $c->print_all_ways(' > ','product/liste.php');
|
$ways = $c->print_all_ways(' > ','product/liste.php');
|
||||||
print " > ".$ways[0]."<br>\n";
|
print " > ".$ways[0]."<br>\n";
|
||||||
print "</div><br>";
|
print "</div><br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET["canvas"]) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/actions_card_'.$_GET["canvas"].'.class.php'))
|
if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php'))
|
||||||
{
|
{
|
||||||
$fieldlist = $object->field_list;
|
$fieldlist = $object->field_list;
|
||||||
$datas = $object->list_datas;
|
$datas = $object->list_datas;
|
||||||
@@ -211,14 +211,14 @@ else
|
|||||||
$title_text = $title;
|
$title_text = $title;
|
||||||
|
|
||||||
// Default templates directory
|
// Default templates directory
|
||||||
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/tpl/';
|
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/';
|
||||||
// Check if a custom template is present
|
// Check if a custom template is present
|
||||||
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/list.tpl.php'))
|
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php'))
|
||||||
{
|
{
|
||||||
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/';
|
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
include($template_dir.'list.tpl.php'); // Include native PHP templates
|
include($template_dir.'list.tpl.php'); // Include native PHP templates
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -233,7 +233,7 @@ else
|
|||||||
|
|
||||||
// Filter on categories
|
// Filter on categories
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
if ($conf->categorie->enabled)
|
if (! empty($conf->categorie->enabled))
|
||||||
{
|
{
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ',1);
|
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ',1);
|
||||||
@@ -251,12 +251,12 @@ else
|
|||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
|
||||||
if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder);
|
if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
|
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans("BuyingPriceMinShort").'</td>';
|
print '<td class="liste_titre" align="right">'.$langs->trans("BuyingPriceMinShort").'</td>';
|
||||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
||||||
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -269,7 +269,7 @@ else
|
|||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" name="snom" size="12" value="'.$snom.'">';
|
print '<input class="flat" type="text" name="snom" size="12" value="'.$snom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($conf->barcode->enabled)
|
if (! empty($conf->barcode->enabled))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
|
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
|
||||||
@@ -280,7 +280,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if ($conf->service->enabled && $type != 0)
|
if (! empty($conf->service->enabled) && $type != 0)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
@@ -301,7 +301,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Stock
|
// Stock
|
||||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
@@ -328,7 +328,7 @@ else
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||||
{
|
{
|
||||||
$sql = "SELECT label";
|
$sql = "SELECT label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||||
@@ -340,7 +340,7 @@ else
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$objtp = $db->fetch_object($result);
|
$objtp = $db->fetch_object($result);
|
||||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ else
|
|||||||
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
||||||
|
|
||||||
// Barcode
|
// Barcode
|
||||||
if ($conf->barcode->enabled)
|
if (! empty($conf->barcode->enabled))
|
||||||
{
|
{
|
||||||
print '<td>'.$objp->barcode.'</td>';
|
print '<td>'.$objp->barcode.'</td>';
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,7 @@ else
|
|||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datem),'day')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($objp->datem),'day')."</td>\n";
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if ($conf->service->enabled && $type != 0)
|
if (! empty($conf->service->enabled) && $type != 0)
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||||
@@ -406,7 +406,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Show stock
|
// Show stock
|
||||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1)
|
||||||
{
|
{
|
||||||
if ($objp->fk_product_type != 1)
|
if ($objp->fk_product_type != 1)
|
||||||
{
|
{
|
||||||
@@ -435,7 +435,7 @@ else
|
|||||||
|
|
||||||
if ($num > $conf->liste_limit)
|
if ($num > $conf->liste_limit)
|
||||||
{
|
{
|
||||||
if ($sref || $snom || $sall || $sbarcode || $_POST["search"])
|
if ($sref || $snom || $sall || $sbarcode || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||||
}
|
}
|
||||||
@@ -458,7 +458,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,13 +27,15 @@
|
|||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
||||||
|
|
||||||
|
$type=GETPOST("type","int");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'produit|service');
|
$result=restrictedArea($user,'produit|service');
|
||||||
|
|
||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = $_GET["page"];
|
$page = GETPOST("page",'int');
|
||||||
if ($page < 0) $page = 0;
|
if ($page < 0) $page = 0;
|
||||||
if (! $sortfield) $sortfield="c";
|
if (! $sortfield) $sortfield="c";
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
@@ -51,22 +53,22 @@ $staticproduct=new Product($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$helpurl='';
|
$helpurl='';
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 0)
|
if ($type == 0)
|
||||||
{
|
{
|
||||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||||
}
|
}
|
||||||
if (isset($_GET["type"]) && $_GET["type"] == 1)
|
else if ($type == 1)
|
||||||
{
|
{
|
||||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader('',$title,$helpurl,'');
|
llxHeader('','',$helpurl);
|
||||||
|
|
||||||
//On n'affiche le lien page suivante que s'il y a une page suivante ...
|
//On n'affiche le lien page suivante que s'il y a une page suivante ...
|
||||||
$sql = "SELECT count(*) as c";
|
$sql = "SELECT count(*) as c";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
$sql.= ' WHERE entity IN ('.getEntity('product', 1).')';
|
$sql.= ' WHERE entity IN ('.getEntity('product', 1).')';
|
||||||
if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type'];
|
if (isset($type)) $sql.= " AND fk_product_type = ".$type;
|
||||||
|
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@@ -77,11 +79,11 @@ if ($result)
|
|||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
$title = $langs->trans("ListProductServiceByPopularity");
|
$title = $langs->trans("ListProductServiceByPopularity");
|
||||||
if (isset($_GET['type']))
|
if (isset($type))
|
||||||
{
|
{
|
||||||
$param = '&type='.$_GET['type'];
|
$param = '&type='.$type;
|
||||||
$title = $langs->trans("ListProductByPopularity");
|
$title = $langs->trans("ListProductByPopularity");
|
||||||
if ($_GET['type'] == 1) $title = $langs->trans("ListServiceByPopularity");
|
if ($type == 1) $title = $langs->trans("ListServiceByPopularity");
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($title, $page, "popuprop.php",$param,"","","",$num);
|
print_barre_liste($title, $page, "popuprop.php",$param,"","","",$num);
|
||||||
@@ -101,7 +103,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd";
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||||
$sql.= " AND p.rowid = pd.fk_product";
|
$sql.= " AND p.rowid = pd.fk_product";
|
||||||
if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type'];
|
if (isset($type)) $sql.= " AND fk_product_type = ".$type;
|
||||||
$sql.= " GROUP BY (p.rowid)";
|
$sql.= " GROUP BY (p.rowid)";
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit, $offset);
|
$sql.= $db->plimit($limit, $offset);
|
||||||
@@ -109,52 +111,54 @@ $sql.= $db->plimit($limit, $offset);
|
|||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||||
{
|
{
|
||||||
$sql = "SELECT label";
|
$sql = "SELECT label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||||
$sql.= " WHERE fk_product=".$objp->rowid;
|
$sql.= " WHERE fk_product=".$objp->rowid;
|
||||||
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
||||||
$sql.= " LIMIT 1";
|
$sql.= " LIMIT 1";
|
||||||
|
|
||||||
$resultp = $db->query($sql);
|
$resultp = $db->query($sql);
|
||||||
if ($resultp)
|
if ($resultp)
|
||||||
{
|
{
|
||||||
$objtp = $db->fetch_object($resultp);
|
$objtp = $db->fetch_object($resultp);
|
||||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$objp->rowid.'">';
|
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$objp->rowid.'">';
|
||||||
if ($objp->type==1) print img_object($langs->trans("ShowService"),"service");
|
if ($objp->type==1) print img_object($langs->trans("ShowService"),"service");
|
||||||
else print img_object($langs->trans("ShowProduct"),"product");
|
else print img_object($langs->trans("ShowProduct"),"product");
|
||||||
print " ";
|
print " ";
|
||||||
print $objp->ref.'</a></td>';
|
print $objp->ref.'</a></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->type==1) print $langs->trans("ShowService");
|
if ($objp->type==1) print $langs->trans("ShowService");
|
||||||
else print $langs->trans("ShowProduct");
|
else print $langs->trans("ShowProduct");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$objp->label.'</td>';
|
print '<td>'.$objp->label.'</td>';
|
||||||
print '<td align="right">'.$objp->c.'</td>';
|
print '<td align="right">'.$objp->c.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free();
|
|
||||||
|
$db->free();
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -36,30 +36,41 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
$result=restrictedArea($user,'produit|service');
|
$result=restrictedArea($user,'produit|service');
|
||||||
|
|
||||||
|
|
||||||
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
$action=GETPOST('action','alpha');
|
||||||
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
|
$sref=GETPOST("sref");
|
||||||
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
|
$snom=GETPOST("snom");
|
||||||
$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
|
$sall=GETPOST("sall");
|
||||||
$sref=trim($sref);
|
$type=GETPOST("type","int");
|
||||||
$snom=trim($snom);
|
$sbarcode=GETPOST("sbarcode");
|
||||||
$sall=trim($sall);
|
$catid=GETPOST('catid','int');
|
||||||
$type=trim($type);
|
$toolowstock=GETPOST('toolowstock');
|
||||||
|
$tosell = GETPOST("tosell");
|
||||||
|
$tobuy = GETPOST("tobuy");
|
||||||
|
$fourn_id = GETPOST("fourn_id",'int');
|
||||||
|
|
||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
if (! $sortfield) $sortfield="stock_physique";
|
if (! $sortfield) $sortfield="stock_physique";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
$page = $_GET["page"];
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
$catid=GETPOST('catid');
|
|
||||||
$toolowstock=GETPOST('toolowstock');
|
|
||||||
|
|
||||||
// Load sale and categ filters
|
// Load sale and categ filters
|
||||||
$search_sale = GETPOST("search_sale");
|
$search_sale = GETPOST("search_sale");
|
||||||
$search_categ = GETPOST("search_categ");
|
$search_categ = GETPOST("search_categ");
|
||||||
|
|
||||||
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
|
//$object->getCanvas($id);
|
||||||
|
$canvas=GETPOST("canvas");
|
||||||
|
$objcanvas='';
|
||||||
|
if (! empty($canvas))
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||||
|
$objcanvas = new Canvas($db,$action);
|
||||||
|
$objcanvas->getCanvas('product','list',$canvas);
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($_POST["button_removefilter_x"]))
|
if (! empty($_POST["button_removefilter_x"]))
|
||||||
{
|
{
|
||||||
$sref="";
|
$sref="";
|
||||||
@@ -118,15 +129,15 @@ if (dol_strlen($type))
|
|||||||
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
||||||
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
||||||
if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'";
|
if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'";
|
||||||
if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0)
|
if (! empty($tosell))
|
||||||
{
|
{
|
||||||
$sql.= " AND p.tosell = ".$_GET["tosell"];
|
$sql.= " AND p.tosell = ".$tosell;
|
||||||
}
|
}
|
||||||
if (isset($_GET["tobuy"]) && dol_strlen($_GET["tobuy"]) > 0)
|
if (! empty($tobuy))
|
||||||
{
|
{
|
||||||
$sql.= " AND p.tobuy = ".$_GET["tobuy"];
|
$sql.= " AND p.tobuy = ".$tobuy;
|
||||||
}
|
}
|
||||||
if (dol_strlen($canvas) > 0)
|
if (! empty($canvas))
|
||||||
{
|
{
|
||||||
$sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
$sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||||
}
|
}
|
||||||
@@ -164,21 +175,10 @@ if ($resql)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["tosell"]) || isset($_POST["tosell"]))
|
|
||||||
{
|
|
||||||
$tosell = (isset($_GET["tosell"])?$_GET["tosell"]:$_POST["tosell"]);
|
|
||||||
}
|
|
||||||
if (isset($_GET["tobuy"]) || isset($_POST["tobuy"]))
|
|
||||||
{
|
|
||||||
$tobuy = (isset($_GET["tobuy"])?$_GET["tobuy"]:$_POST["tobuy"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$helpurl='';
|
$helpurl='';
|
||||||
$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||||
|
|
||||||
if (isset($_GET["type"]) || isset($_POST["type"]))
|
if (isset($type))
|
||||||
{
|
{
|
||||||
if ($type==1) { $texte = $langs->trans("Services"); }
|
if ($type==1) { $texte = $langs->trans("Services"); }
|
||||||
else { $texte = $langs->trans("Products"); }
|
else { $texte = $langs->trans("Products"); }
|
||||||
@@ -190,16 +190,16 @@ if ($resql)
|
|||||||
|
|
||||||
llxHeader("",$title,$helpurl,$texte);
|
llxHeader("",$title,$helpurl,$texte);
|
||||||
|
|
||||||
if ($sref || $snom || $sall || $_POST["search"])
|
if ($sref || $snom || $sall || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$_POST["tosell"]."&tobuy=".$_POST["tobuy"], $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($catid)
|
if (! empty($catid))
|
||||||
{
|
{
|
||||||
print "<div id='ways'>";
|
print "<div id='ways'>";
|
||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
@@ -219,7 +219,7 @@ if ($resql)
|
|||||||
|
|
||||||
// Filter on categories
|
// Filter on categories
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
if ($conf->categorie->enabled)
|
if (! empty($conf->categorie->enabled))
|
||||||
{
|
{
|
||||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
||||||
@@ -258,7 +258,7 @@ if ($resql)
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($conf->service->enabled && $type == 1)
|
if (! empty($conf->service->enabled) && $type == 1)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
@@ -282,7 +282,7 @@ if ($resql)
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||||
{
|
{
|
||||||
$sql = "SELECT label";
|
$sql = "SELECT label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||||
@@ -294,7 +294,7 @@ if ($resql)
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$objtp = $db->fetch_object($result);
|
$objtp = $db->fetch_object($result);
|
||||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$objp->label.'</td>';
|
print '<td>'.$objp->label.'</td>';
|
||||||
|
|
||||||
if ($conf->service->enabled && $type == 1)
|
if (! empty($conf->service->enabled) && $type == 1)
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||||
@@ -335,7 +335,7 @@ if ($resql)
|
|||||||
|
|
||||||
if ($num > $conf->liste_limit)
|
if ($num > $conf->liste_limit)
|
||||||
{
|
{
|
||||||
if ($sref || $snom || $sall || $_POST["search"])
|
if ($sref || $snom || $sall || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, '');
|
print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, '');
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
@@ -39,13 +39,6 @@ $ref = GETPOST('ref','alpha');
|
|||||||
$mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0);
|
$mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0);
|
||||||
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
|
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||||
@@ -122,7 +115,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->s
|
|||||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,13 +44,6 @@ $ref= GETPOST('ref','alpha');
|
|||||||
$withproject=GETPOST('withproject','int');
|
$withproject=GETPOST('withproject','int');
|
||||||
$project_ref = GETPOST('project_ref','alpha');
|
$project_ref = GETPOST('project_ref','alpha');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||||
@@ -119,7 +112,7 @@ if ($action=='delete')
|
|||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
dol_delete_file($file);
|
dol_delete_file($file);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,6 @@ $confirm=GETPOST('confirm');
|
|||||||
$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
|
|
||||||
$mesg='';
|
|
||||||
if (isset($_SESSION['DolMessage']))
|
|
||||||
{
|
|
||||||
$mesg=$_SESSION['DolMessage'];
|
|
||||||
unset($_SESSION['DolMessage']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@@ -131,7 +124,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
|
|
||||||
dol_delete_file($file,0,0,0,$object);
|
dol_delete_file($file,0,0,0,$object);
|
||||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,20 +84,20 @@ $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($_POST["getcustomercode"])
|
if (GETPOST('getcustomercode'))
|
||||||
{
|
{
|
||||||
// We defined value code_client
|
// We defined value code_client
|
||||||
$_POST["code_client"]="Acompleter";
|
$_POST["code_client"]="Acompleter";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["getsuppliercode"])
|
if (GETPOST('getsuppliercode'))
|
||||||
{
|
{
|
||||||
// We defined value code_fournisseur
|
// We defined value code_fournisseur
|
||||||
$_POST["code_fournisseur"]="Acompleter";
|
$_POST["code_fournisseur"]="Acompleter";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new third party
|
// Add new third party
|
||||||
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode'))
|
||||||
&& ($action == 'add' || $action == 'update') && $user->rights->societe->creer)
|
&& ($action == 'add' || $action == 'update') && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||||
@@ -1444,7 +1444,7 @@ else
|
|||||||
dol_htmloutput_errors($error,$errors);
|
dol_htmloutput_errors($error,$errors);
|
||||||
|
|
||||||
$showlogo=$object->logo;
|
$showlogo=$object->logo;
|
||||||
$showbarcode=($conf->barcode->enabled && $user->rights->barcode->lire);
|
$showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@@ -1467,9 +1467,9 @@ else
|
|||||||
// Logo+barcode
|
// Logo+barcode
|
||||||
$rowspan=4;
|
$rowspan=4;
|
||||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++;
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++;
|
||||||
if ($object->client) $rowspan++;
|
if (! empty($object->client)) $rowspan++;
|
||||||
if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++;
|
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++;
|
||||||
if ($conf->global->MAIN_MODULE_BARCODE) $rowspan++;
|
if (! empty($conf->global->MAIN_MODULE_BARCODE)) $rowspan++;
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++;
|
if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++;
|
||||||
$htmllogobar='';
|
$htmllogobar='';
|
||||||
if ($showlogo || $showbarcode)
|
if ($showlogo || $showbarcode)
|
||||||
@@ -1502,7 +1502,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Supplier code
|
// Supplier code
|
||||||
if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
|
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans('SupplierCode').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
|
print $langs->trans('SupplierCode').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
|
||||||
@@ -1514,7 +1514,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Barcode
|
// Barcode
|
||||||
if ($conf->global->MAIN_MODULE_BARCODE)
|
if (! empty($conf->global->MAIN_MODULE_BARCODE))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans('Gencod').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->barcode;
|
print $langs->trans('Gencod').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->barcode;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 579 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 579 B |
@@ -320,7 +320,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'=
|
|||||||
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
||||||
);
|
);
|
||||||
$mainmenuused='home';
|
$mainmenuused='home';
|
||||||
foreach($conf->modules as $key => $val)
|
foreach($conf->modules as $val)
|
||||||
{
|
{
|
||||||
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ $mainmenuusedarray=array(); // Disable
|
|||||||
|
|
||||||
$generic=1;
|
$generic=1;
|
||||||
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk');
|
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk');
|
||||||
foreach($mainmenuusedarray as $key => $val)
|
foreach($mainmenuusedarray as $val)
|
||||||
{
|
{
|
||||||
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
||||||
//print "XXX".$val;
|
//print "XXX".$val;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 579 B |
@@ -383,7 +383,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'=
|
|||||||
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
||||||
);
|
);
|
||||||
$mainmenuused='home';
|
$mainmenuused='home';
|
||||||
foreach($conf->modules as $key => $val)
|
foreach($conf->modules as $val)
|
||||||
{
|
{
|
||||||
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ $mainmenuusedarray=array(); // Disable
|
|||||||
|
|
||||||
$generic=1;
|
$generic=1;
|
||||||
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk');
|
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk');
|
||||||
foreach($mainmenuusedarray as $key => $val)
|
foreach($mainmenuusedarray as $val)
|
||||||
{
|
{
|
||||||
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
||||||
//print "XXX".$val;
|
//print "XXX".$val;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 579 B |
@@ -467,7 +467,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'=
|
|||||||
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
||||||
);
|
);
|
||||||
$mainmenuused='home';
|
$mainmenuused='home';
|
||||||
foreach($conf->modules as $key => $val)
|
foreach($conf->modules as $val)
|
||||||
{
|
{
|
||||||
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused));
|
|||||||
|
|
||||||
$generic=1;
|
$generic=1;
|
||||||
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','bookmark','cashdesk','geoipmaxmind','gravatar','clicktodial','paypal','webservices');
|
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','bookmark','cashdesk','geoipmaxmind','gravatar','clicktodial','paypal','webservices');
|
||||||
foreach($mainmenuusedarray as $key => $val)
|
foreach($mainmenuusedarray as $val)
|
||||||
{
|
{
|
||||||
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
||||||
//print "XXX".$val;
|
//print "XXX".$val;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 579 B |
@@ -628,7 +628,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'=
|
|||||||
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
'barcode'=>'','fckeditor'=>'','categorie'=>'',
|
||||||
);
|
);
|
||||||
$mainmenuused='home';
|
$mainmenuused='home';
|
||||||
foreach($conf->modules as $key => $val)
|
foreach($conf->modules as $val)
|
||||||
{
|
{
|
||||||
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
||||||
}
|
}
|
||||||
@@ -637,7 +637,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused));
|
|||||||
|
|
||||||
$generic=1;
|
$generic=1;
|
||||||
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices');
|
$divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices');
|
||||||
foreach($mainmenuusedarray as $key => $val)
|
foreach($mainmenuusedarray as $val)
|
||||||
{
|
{
|
||||||
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
if (empty($val) || in_array($val,$divalreadydefined)) continue;
|
||||||
//print "XXX".$val;
|
//print "XXX".$val;
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if ($perms)
|
if ($perms)
|
||||||
{
|
{
|
||||||
if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error
|
if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = (object) array(); // For avoid error
|
||||||
if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array();
|
if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array();
|
||||||
if ($subperms)
|
if ($subperms)
|
||||||
{
|
{
|
||||||
@@ -578,7 +578,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if ($perms)
|
if ($perms)
|
||||||
{
|
{
|
||||||
if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error
|
if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = (object) array(); // For avoid error
|
||||||
if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array();
|
if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array();
|
||||||
if ($subperms)
|
if ($subperms)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ if ($resql)
|
|||||||
'__ID__' => $obj2->source_id,
|
'__ID__' => $obj2->source_id,
|
||||||
'__EMAIL__' => $obj2->email,
|
'__EMAIL__' => $obj2->email,
|
||||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj2->tag.'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj2->tag.'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||||
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj2->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj2->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
||||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj2->email.'">'.$obj2->email.'</a>',
|
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj2->email.'">'.$obj2->email.'</a>',
|
||||||
'__LASTNAME__' => $obj2->lastname,
|
'__LASTNAME__' => $obj2->lastname,
|
||||||
'__FIRSTNAME__' => $obj2->firstname,
|
'__FIRSTNAME__' => $obj2->firstname,
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ if ($resql)
|
|||||||
'__ID__' => $obj->source_id,
|
'__ID__' => $obj->source_id,
|
||||||
'__EMAIL__' => $obj->email,
|
'__EMAIL__' => $obj->email,
|
||||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||||
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
||||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
||||||
'__LASTNAME__' => $obj->lastname,
|
'__LASTNAME__' => $obj->lastname,
|
||||||
'__FIRSTNAME__' => $obj->firstname,
|
'__FIRSTNAME__' => $obj->firstname,
|
||||||
|
|||||||