Merge branch 'develop' into develop_merger_cust_prospect_tab

This commit is contained in:
fhenry 2013-02-12 19:18:15 +01:00
commit 136dc651f3
20 changed files with 231 additions and 195 deletions

View File

@ -183,7 +183,7 @@ if ($action == 'add_action')
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $actioncomm->use_phenix=1; if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $actioncomm->use_phenix=1;
// Check parameters // Check parameters
if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || $datef == '')) if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
{ {
$error++; $error++;
$action = 'create'; $action = 'create';
@ -559,7 +559,7 @@ if ($action == 'create')
} else { } else {
print $form->select_company('','socid','',1,1); print $form->select_company('','socid','',1,1);
} }
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/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';
@ -260,7 +260,7 @@ else if ($action == 'add' && $user->rights->propal->creer)
$action='create'; $action='create';
$error++; $error++;
} }
if ($socid<1) if ($socid<1)
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors');
@ -1174,7 +1174,7 @@ $now=dol_now();
if ($action == 'create') if ($action == 'create')
{ {
print_fiche_titre($langs->trans("NewProp")); print_fiche_titre($langs->trans("NewProp"));
$soc = new Societe($db); $soc = new Societe($db);
if ($socid>0) $res=$soc->fetch($socid); if ($socid>0) $res=$soc->fetch($socid);
@ -1214,7 +1214,7 @@ if ($action == 'create')
print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" 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">';
if ($origin != 'project' && $originid) if ($origin != 'project' && $originid)
{ {
print '<input type="hidden" name="origin" value="'.$origin.'">'; print '<input type="hidden" name="origin" value="'.$origin.'">';
@ -1459,20 +1459,20 @@ if ($action == 'create')
print "</form>"; print "</form>";
} }
else else
{ {
/* /*
* Show object in view mode * Show object in view mode
*/ */
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($object->socid); $soc->fetch($object->socid);
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal');
$formconfirm=''; $formconfirm='';
// Clone confirmation // Clone confirmation
if ($action == 'clone') if ($action == 'clone')
{ {
@ -1486,30 +1486,30 @@ else
// Paiement incomplet. On demande si motif = escompte ou autre // Paiement incomplet. On demande si motif = escompte ou autre
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1);
} }
// Confirm delete // Confirm delete
else if ($action == 'delete') else if ($action == 'delete')
{ {
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1);
} }
// Confirm reopen // Confirm reopen
else if ($action == 'reopen') else if ($action == 'reopen')
{ {
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1);
} }
// Confirmation delete product/service line // Confirmation delete product/service line
else if ($action == 'ask_deleteline') else if ($action == 'ask_deleteline')
{ {
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1);
} }
// Confirm validate proposal // Confirm validate proposal
else if ($action == 'validate') else if ($action == 'validate')
{ {
$error=0; $error=0;
// on verifie si l'objet est en numerotation provisoire // on verifie si l'objet est en numerotation provisoire
$ref = substr($object->ref, 1, 4); $ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') if ($ref == 'PROV')
@ -1525,7 +1525,7 @@ else
{ {
$numref = $object->ref; $numref = $object->ref;
} }
$text=$langs->trans('ConfirmValidateProp',$numref); $text=$langs->trans('ConfirmValidateProp',$numref);
if (! empty($conf->notification->enabled)) if (! empty($conf->notification->enabled))
{ {
@ -1534,29 +1534,29 @@ else
$text.='<br>'; $text.='<br>';
$text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid); $text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid);
} }
if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1); if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1);
} }
if (! $formconfirm) if (! $formconfirm)
{ {
$parameters=array('lineid'=>$lineid); $parameters=array('lineid'=>$lineid);
$formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
} }
// Print form confirm // Print form confirm
print $formconfirm; print $formconfirm;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$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">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>'; print '</td></tr>';
// Ref client // Ref client
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">'; print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
@ -1580,11 +1580,11 @@ else
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Company // Company
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$soc->getNomUrl(1).'</td>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$soc->getNomUrl(1).'</td>';
print '</tr>'; print '</tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
@ -1614,7 +1614,7 @@ else
} }
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>'; print '</td></tr>';
// Date of proposal // Date of proposal
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
@ -1645,7 +1645,7 @@ else
} }
} }
print '</td>'; print '</td>';
// Date end proposal // Date end proposal
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
@ -1678,7 +1678,7 @@ else
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Payment term // Payment term
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1697,7 +1697,7 @@ else
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Delivery date // Delivery date
$langs->load('deliveries'); $langs->load('deliveries');
print '<tr><td>'; print '<tr><td>';
@ -1722,7 +1722,7 @@ else
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Delivery delay // Delivery delay
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1740,10 +1740,10 @@ else
{ {
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1);
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Origin of demand // Origin of demand
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1761,10 +1761,10 @@ else
{ {
$form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none');
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Payment mode // Payment mode
print '<tr>'; print '<tr>';
print '<td width="25%">'; print '<td width="25%">';
@ -1783,7 +1783,7 @@ else
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
} }
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
@ -1825,7 +1825,7 @@ else
} }
print '</tr>'; print '</tr>';
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -1841,12 +1841,12 @@ else
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
} }
// Amount HT // Amount HT
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>'; print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
print '<td align="right" nowrap><b>'.price($object->total_ht).'</b></td>'; print '<td align="right" nowrap><b>'.price($object->total_ht).'</b></td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td>'; print '<td>'.$langs->trans("Currency".$conf->currency).'</td>';
// Margin Infos // Margin Infos
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
print '<td valign="top" width="50%" rowspan="4">'; print '<td valign="top" width="50%" rowspan="4">';
@ -1854,12 +1854,12 @@ else
print '</td>'; print '</td>';
} }
print '</tr>'; print '</tr>';
// Amount VAT // Amount VAT
print '<tr><td height="10">'.$langs->trans('AmountVAT').'</td>'; print '<tr><td height="10">'.$langs->trans('AmountVAT').'</td>';
print '<td align="right" nowrap>'.price($object->total_tva).'</td>'; print '<td align="right" nowrap>'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>'; print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Amount Local Taxes // Amount Local Taxes
if ($mysoc->localtax1_assuj=="1") //Localtax1 if ($mysoc->localtax1_assuj=="1") //Localtax1
{ {
@ -1873,55 +1873,55 @@ else
print '<td align="right" nowrap>'.price($object->total_localtax2).'</td>'; print '<td align="right" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>'; print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
} }
// Amount TTC // Amount TTC
print '<tr><td height="10">'.$langs->trans('AmountTTC').'</td>'; print '<tr><td height="10">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right" nowrap>'.price($object->total_ttc).'</td>'; print '<td align="right" nowrap>'.price($object->total_ttc).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>'; print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Statut // Statut
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="2">'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="2">'.$object->getLibStatut(4).'</td></tr>';
print '</table><br>'; print '</table><br>';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
$blocname = 'contacts'; $blocname = 'contacts';
$title = $langs->trans('ContactsAddresses'); $title = $langs->trans('ContactsAddresses');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
} }
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{ {
$blocname = 'notes'; $blocname = 'notes';
$title = $langs->trans('Notes'); $title = $langs->trans('Notes');
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
} }
/* /*
* Lines * Lines
*/ */
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) if (! empty($conf->use_javascript_ajax) && $object->statut == 0)
{ {
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
} }
print '<table id="tablelines" class="noborder" width="100%">'; print '<table id="tablelines" class="noborder" width="100%">';
// Show object lines // Show object lines
$result = $object->getLinesArray(); $result = $object->getLinesArray();
if (! empty($object->lines)) if (! empty($object->lines))
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid); $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid);
// Form to add new line // Form to add new line
if ($object->statut == 0 && $user->rights->propal->creer) if ($object->statut == 0 && $user->rights->propal->creer)
{ {
if ($action != 'editline') if ($action != 'editline')
{ {
$var=true; $var=true;
if ($conf->global->MAIN_FEATURES_LEVEL > 1) if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{ {
// Add free or predefined products/services // Add free or predefined products/services
@ -1931,7 +1931,7 @@ else
{ {
// Add free products/services // Add free products/services
$object->formAddFreeProduct(0,$mysoc,$soc); $object->formAddFreeProduct(0,$mysoc,$soc);
// Add predefined products/services // Add predefined products/services
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{ {
@ -1939,17 +1939,17 @@ else
$object->formAddPredefinedProduct(0,$mysoc,$soc); $object->formAddPredefinedProduct(0,$mysoc,$soc);
} }
} }
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
} }
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print "\n"; print "\n";
if ($action == 'statut') if ($action == 'statut')
{ {
/* /*
@ -1975,18 +1975,18 @@ else
$form_close.= '<a name="close">&nbsp;</a>'; $form_close.= '<a name="close">&nbsp;</a>';
$form_close.= '</td>'; $form_close.= '</td>';
$form_close.= '</tr></table></form>'; $form_close.= '</tr></table></form>';
print $form_close; print $form_close;
} }
/* /*
* Boutons Actions * Boutons Actions
*/ */
if ($action != 'presend') if ($action != 'presend')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($action != 'statut' && $action <> 'editline') if ($action != 'statut' && $action <> 'editline')
{ {
// Validate // Validate
@ -1995,20 +1995,20 @@ else
if (count($object->lines) > 0) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a>'; if (count($object->lines) > 0) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a>';
else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>'; else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
} }
// Edit // Edit
if ($object->statut == 1 && $user->rights->propal->creer) if ($object->statut == 1 && $user->rights->propal->creer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a>';
} }
// ReOpen // ReOpen
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"';
print '>'.$langs->trans('ReOpen').'</a>'; print '>'.$langs->trans('ReOpen').'</a>';
} }
// Send // Send
if ($object->statut == 1 || $object->statut == 2) if ($object->statut == 1 || $object->statut == 2)
{ {
@ -2018,7 +2018,7 @@ else
} }
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>'; else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
} }
// Create an order // Create an order
if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0)
{ {
@ -2027,7 +2027,7 @@ else
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>';
} }
} }
// Create an invoice and classify billed // Create an invoice and classify billed
if ($object->statut == 2 && $user->societe_id == 0) if ($object->statut == 2 && $user->societe_id == 0)
{ {
@ -2035,46 +2035,46 @@ else
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a>';
} }
$arraypropal=$object->getInvoiceArrayList(); $arraypropal=$object->getInvoiceArrayList();
if (is_array($arraypropal) && count($arraypropal) > 0) if (is_array($arraypropal) && count($arraypropal) > 0)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled&amp;socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled&amp;socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a>';
} }
} }
// Close // Close
if ($object->statut == 1 && $user->rights->propal->cloturer) if ($object->statut == 1 && $user->rights->propal->cloturer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#close').'"';
print '>'.$langs->trans('Close').'</a>'; print '>'.$langs->trans('Close').'</a>';
} }
// Clone // Clone
if ($user->rights->propal->creer) if ($user->rights->propal->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object='.$object->element.'">'.$langs->trans("ToClone").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object='.$object->element.'">'.$langs->trans("ToClone").'</a>';
} }
// Delete // Delete
if ($user->rights->propal->supprimer) if ($user->rights->propal->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete"'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete"';
print '>'.$langs->trans('Delete').'</a>'; print '>'.$langs->trans('Delete').'</a>';
} }
} }
print '</div>'; print '</div>';
print "<br>\n"; print "<br>\n";
} }
if ($action != 'presend') if ($action != 'presend')
{ {
print '<table width="100%"><tr><td width="50%" valign="top">'; print '<table width="100%"><tr><td width="50%" valign="top">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
/* /*
* Documents generes * Documents generes
*/ */
@ -2083,28 +2083,28 @@ else
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$user->rights->propal->creer; $genallowed=$user->rights->propal->creer;
$delallowed=$user->rights->propal->supprimer; $delallowed=$user->rights->propal->supprimer;
$var=true; $var=true;
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang); $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang);
/* /*
* Linked object block * Linked object block
*/ */
$somethingshown=$object->showLinkedObjectBlock(); $somethingshown=$object->showLinkedObjectBlock();
print '</td><td valign="top" width="50%">'; print '</td><td valign="top" width="50%">';
// List of actions on element // List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db); $formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'propal',$socid); $somethingshown=$formactions->showactions($object,'propal',$socid);
print '</td></tr></table>'; print '</td></tr></table>';
} }
/* /*
* Action presend * Action presend
* *
@ -2115,7 +2115,7 @@ else
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
// Build document if it not exists // Build document if it not exists
if (! $file || ! is_readable($file)) if (! $file || ! is_readable($file))
{ {
@ -2129,7 +2129,7 @@ else
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) if ($result <= 0)
{ {
@ -2139,10 +2139,10 @@ else
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
} }
print '<br>'; print '<br>';
print_titre($langs->trans('SendPropalByMail')); print_titre($langs->trans('SendPropalByMail'));
// Create form object // Create form object
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
@ -2151,18 +2151,17 @@ else
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;
$formmail->withdeliveryreceipt=1; $formmail->withdeliveryreceipt=1;
$formmail->withcancel=1; $formmail->withcancel=1;
// Tableau des substitutions // Tableau des substitutions
$formmail->substit['__PROPREF__']=$object->ref; $formmail->substit['__PROPREF__']=$object->ref;
$formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__SIGNATURE__']=$user->signature;
@ -2172,16 +2171,16 @@ else
$formmail->param['models']='propal_send'; $formmail->param['models']='propal_send';
$formmail->param['id']=$object->id; $formmail->param['id']=$object->id;
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
// Init list of files // Init list of files
if (GETPOST("mode")=='init') if (GETPOST("mode")=='init')
{ {
$formmail->clear_attached_files(); $formmail->clear_attached_files();
$formmail->add_attached_files($file,basename($file),dol_mimetype($file)); $formmail->add_attached_files($file,basename($file),dol_mimetype($file));
} }
$formmail->show_form(); $formmail->show_form();
print '<br>'; print '<br>';
} }
} }

View File

@ -2418,12 +2418,11 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):1; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -3403,12 +3403,11 @@ else if ($id > 0 || ! empty($ref))
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__'); $formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -823,11 +823,13 @@ class Form
* @param string $showfunction Add function into label * @param string $showfunction Add function into label
* @param string $moreclass Add more class to class style * @param string $moreclass Add more class to class style
* @param string $showsoc Add company into label * @param string $showsoc Add company into label
* @param int $forcecombo Force to use combo box
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return int <0 if KO, Nb of contact in list if OK * @return int <0 if KO, Nb of contact in list if OK
*/ */
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0) function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $event=array())
{ {
print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $showsoc); print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $showsoc, $forcecombo, $event);
return $this->num; return $this->num;
} }
@ -844,9 +846,11 @@ class Form
* @param string $moreclass Add more class to class style * @param string $moreclass Add more class to class style
* @param bool $options_only Return options only (for ajax treatment) * @param bool $options_only Return options only (for ajax treatment)
* @param string $showsoc Add company into label * @param string $showsoc Add company into label
* @param int $forcecombo Force to use combo box
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return int <0 if KO, Nb of contact in list if OK * @return int <0 if KO, Nb of contact in list if OK
*/ */
function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false, $showsoc=0) function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $event=array())
{ {
global $conf,$langs; global $conf,$langs;
@ -872,6 +876,11 @@ class Form
if ($resql) if ($resql)
{ {
$num=$this->db->num_rows($resql); $num=$this->db->num_rows($resql);
if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
$out.= ajax_combobox($htmlname, $event);
}
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">'; if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected="selected"':'').'></option>'; if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected="selected"':'').'></option>';

View File

@ -49,6 +49,7 @@ class FormMail
var $withto; var $withto;
var $withtofree; var $withtofree;
var $withtocc; var $withtocc;
var $withtoccc;
var $withtopic; var $withtopic;
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
var $withbody; var $withbody;
@ -428,23 +429,11 @@ class FormMail
else else
{ {
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />'; $out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
if (! empty($this->withto) && is_array($this->withto)) if (! empty($this->withtocc) && is_array($this->withtocc))
{ {
$out.= " ".$langs->trans("or")." "; $out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1); $out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1);
} }
if (! empty($this->withtoccsocid) && $this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
{
$liste=array();
$soc=new Societe($this->db);
$soc->fetch($this->withtoccsocid);
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
{
$liste[$key]=$value;
}
$out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receivercc", $liste, GETPOST("receivercc"), 1);
}
} }
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
} }
@ -462,23 +451,11 @@ class FormMail
else else
{ {
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />'; $out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
if (! empty($this->withto) && is_array($this->withto)) if (! empty($this->withtoccc) && is_array($this->withtoccc))
{ {
$out.= " ".$langs->trans("or")." "; $out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1); $out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1);
} }
if (! empty($this->withtocccsocid) && $this->withtocccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
{
$liste=array();
$soc=new Societe($this->db);
$soc->fetch($this->withtosocid);
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
{
$liste[$key]=$value;
}
$out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receiverccc", $liste, GETPOST("receiverccc"), 1);
}
} }
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1); //if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";

View File

@ -1443,12 +1443,11 @@ else
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=GETPOST('sendto','int')?GETPOST('sendto','int'):1; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendShippingRef','__SHIPPINGREF__'); $formmail->withtopic=$langs->trans('SendShippingRef','__SHIPPINGREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -1487,12 +1487,11 @@ else if ($id > 0 || ! empty($ref))
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=(!GETPOST('sendto','alpha'))?1:GETPOST('sendto','alpha'); $liste=array();
$formmail->withtosocid=$societe->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__'); $formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -1819,12 +1819,11 @@ if (! empty($object->id))
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$object->thirdparty->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -2075,12 +2075,11 @@ else
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$societe->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendBillRef','__FACREF__'); $formmail->withtopic=$langs->trans('SendBillRef','__FACREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -32,14 +32,14 @@ class Holiday extends CommonObject
{ {
public $element='holiday'; public $element='holiday';
public $table_element='holiday'; public $table_element='holiday';
var $db; var $db;
var $error; var $error;
var $errors=array(); var $errors=array();
var $rowid; var $rowid;
var $ref; var $ref;
var $fk_user; var $fk_user;
var $date_create=''; var $date_create='';
var $description; var $description;
@ -72,16 +72,24 @@ class Holiday extends CommonObject
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
// Mets à jour les congés payés en début de mois
$this->updateSoldeCP();
// Vérifie le nombre d'utilisateur et mets à jour si besoin
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
return 1;
} }
/**
* updateSold
*
* @return int Return 1
*/
function updateSold()
{
// Mets à jour les congés payés en début de mois
$this->updateSoldeCP();
// Vérifie le nombre d'utilisateur et mets à jour si besoin
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
return 1;
}
/** /**
* Créer un congés payés dans la base de données * Créer un congés payés dans la base de données
* *
@ -358,10 +366,10 @@ class Holiday extends CommonObject
$sql.= " uu.name as user_lastname,"; $sql.= " uu.name as user_lastname,";
$sql.= " uu.firstname as user_firstname,"; $sql.= " uu.firstname as user_firstname,";
$sql.= " ua.name as validator_lastname,"; $sql.= " ua.name as validator_lastname,";
$sql.= " ua.firstname as validator_firstname"; $sql.= " ua.firstname as validator_firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau $sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
@ -415,10 +423,10 @@ class Holiday extends CommonObject
$tab_result[$i]['user_firstname'] = $obj->user_firstname; $tab_result[$i]['user_firstname'] = $obj->user_firstname;
$tab_result[$i]['user_lastname'] = $obj->user_lastname; $tab_result[$i]['user_lastname'] = $obj->user_lastname;
$tab_result[$i]['validator_firstname'] = $obj->validator_firstname; $tab_result[$i]['validator_firstname'] = $obj->validator_firstname;
$tab_result[$i]['validator_lastname'] = $obj->validator_lastname; $tab_result[$i]['validator_lastname'] = $obj->validator_lastname;
$i++; $i++;
} }
// Retourne 1 et ajoute le tableau à la variable // Retourne 1 et ajoute le tableau à la variable
@ -601,13 +609,13 @@ class Holiday extends CommonObject
{ {
$this->fetchByUser($fk_user,'',''); $this->fetchByUser($fk_user,'','');
foreach($this->holiday as $infos_CP) foreach($this->holiday as $infos_CP)
{ {
if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
// TODO Also use halfday for the check // TODO Also use halfday for the check
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut']) if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
{ {
return false; return false;
} }
@ -627,23 +635,24 @@ class Holiday extends CommonObject
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
{ {
global $langs; global $langs;
$result=''; $result='';
$lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">';
$lienfin='</a>'; $lienfin='</a>';
$picto='holiday'; $picto='holiday';
$label=$langs->trans("Show").': '.$this->ref; $label=$langs->trans("Show").': '.$this->ref;
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
return $result; return $result;
} }
/** /**
* Returns the label status * Returns the label status
* *
@ -654,7 +663,7 @@ class Holiday extends CommonObject
{ {
return $this->LibStatut($this->statut, $mode, $this->date_debut); return $this->LibStatut($this->statut, $mode, $this->date_debut);
} }
/** /**
* Returns the label of a statut * Returns the label of a statut
* *
@ -678,7 +687,7 @@ class Holiday extends CommonObject
if ($mode == 2) if ($mode == 2)
{ {
$pictoapproved='statut6'; $pictoapproved='statut6';
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft
if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval
if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP'); if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP');
@ -688,18 +697,18 @@ class Holiday extends CommonObject
if ($mode == 5) if ($mode == 5)
{ {
$pictoapproved='statut6'; $pictoapproved='statut6';
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft
if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval
if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved); if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved);
if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5');
if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5');
} }
return $statut; return $statut;
} }
/** /**
* Affiche un select HTML des statuts de congés payés * Affiche un select HTML des statuts de congés payés
* *
@ -857,19 +866,21 @@ class Holiday extends CommonObject
{ {
// Si mise à jour pour tout le monde en début de mois // Si mise à jour pour tout le monde en début de mois
$now=dol_now(); $now=dol_now();
// Mois actuel // Mois actuel
$month = date('m',$now); $month = date('m',$now);
$lastUpdate = $this->getConfCP('lastUpdate'); $lastUpdate = $this->getConfCP('lastUpdate');
$monthLastUpdate = date('m', $lastUpdate); $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;
// Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp // Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
if ($month != $monthLastUpdate) if ($month != $monthLastUpdate)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
$sql.= " value = '".$this->db->idate($now)."'"; $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
$sql.= " WHERE name = 'lastUpdate'"; $sql.= " WHERE name = 'lastUpdate'";
dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql);
$result = $this->db->query($sql); $result = $this->db->query($sql);
// On ajoute x jours à chaque utilisateurs // On ajoute x jours à chaque utilisateurs

View File

@ -50,7 +50,7 @@ $sql.= " WHERE name = 'userGroup'";
$result = $db->query($sql); $result = $db->query($sql);
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
if ($obj->value == null) if ($obj->value == null || $obj->value < 0)
{ {
llxHeader('',$langs->trans('CPTitreMenu')); llxHeader('',$langs->trans('CPTitreMenu'));

View File

@ -73,6 +73,9 @@ $search_statut = GETPOST('select_statut');
$holiday = new Holiday($db); $holiday = new Holiday($db);
$holidaystatic=new Holiday($db); $holidaystatic=new Holiday($db);
// Update sold
$holiday->updateSold();
$max_year = 5; $max_year = 5;
$min_year = 10; $min_year = 10;
$filter=''; $filter='';

View File

@ -50,6 +50,7 @@ DisableJavascript=Disable JavaScript and Ajax functions
ConfirmAjax=Use Ajax confirmation popups ConfirmAjax=Use Ajax confirmation popups
UseSearchToSelectCompany=Use autocompletion fields to choose third parties (instead of using a list box).<br><br>Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. UseSearchToSelectCompany=Use autocompletion fields to choose third parties (instead of using a list box).<br><br>Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
ActivityStateToSelectCompany= Add a filter option to show/hide thirdparties which are currently in activity or has ceased it ActivityStateToSelectCompany= Add a filter option to show/hide thirdparties which are currently in activity or has ceased it
UseSearchToSelectContact=Use autocompletion fields to choose contact (instead of using a list box).<br><br>Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
SearchFilter=Search filters options SearchFilter=Search filters options
NumberOfKeyToSearch=Nbr of characters to trigger search: %s NumberOfKeyToSearch=Nbr of characters to trigger search: %s
ViewFullDateActions=Show full dates events in the third sheet ViewFullDateActions=Show full dates events in the third sheet

View File

@ -15,7 +15,7 @@ MyEvents=My events
OtherEvents=Other events OtherEvents=Other events
ListOfActions=List of events ListOfActions=List of events
Location=Location Location=Location
EventOnFullDay=Event on full day EventOnFullDay=Event on all day(s)
SearchAnAction= Search an event/task SearchAnAction= Search an event/task
MenuToDoActions= All incomplete events MenuToDoActions= All incomplete events
MenuDoneActions= All terminated events MenuDoneActions= All terminated events

View File

@ -85,7 +85,7 @@ CountryDM=Dominica
CountryDO=República Dominicana CountryDO=República Dominicana
CountryEC=Ecuador CountryEC=Ecuador
CountryEG=Egipto CountryEG=Egipto
CountrySV=Salvador CountrySV=El Salvador
CountryGQ=Guinea Ecuatorial CountryGQ=Guinea Ecuatorial
CountryER=Eritrea CountryER=Eritrea
CountryEE=Estonia CountryEE=Estonia

View File

@ -49,6 +49,7 @@ DisableJavascript= Désactiver les fonctions Javascript et Ajax
ConfirmAjax= Utiliser les popups de confirmation Ajax ConfirmAjax= Utiliser les popups de confirmation Ajax
UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
ActivityStateToSelectCompany= Ajouter une option de filtrage lors des recherches pour afficher/masquer les tiers en exercice ou ayant cessés d'exercer ActivityStateToSelectCompany= Ajouter une option de filtrage lors des recherches pour afficher/masquer les tiers en exercice ou ayant cessés d'exercer
UseSearchToSelectContact= Utiliser un champ avec autocomplétion pour choisir un contact (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante CONTACT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
SearchFilter=Options des filtres de recherche SearchFilter=Options des filtres de recherche
NumberOfKeyToSearch=Nb carac. déclenchant recherche: %s NumberOfKeyToSearch=Nb carac. déclenchant recherche: %s
ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers

View File

@ -14,7 +14,7 @@ EventsNb=Nombre d'événements
MyEvents=Mes événements MyEvents=Mes événements
OtherEvents=Autres événements OtherEvents=Autres événements
ListOfActions=Liste des événements ListOfActions=Liste des événements
EventOnFullDay=Événement sur la journée EventOnFullDay=Événement sur la(les) journée(s)
Location=Lieu Location=Lieu
SearchAnAction=Rechercher un événement/tâche SearchAnAction=Rechercher un événement/tâche
MenuToDoActions=Les événem. incomplets MenuToDoActions=Les événem. incomplets

View File

@ -82,6 +82,21 @@ if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
} }
} }
if ($action == 'CONTACT_USE_SEARCH_TO_SELECT')
{
$contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha');
$res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) // Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
if ($action == 'setModuleOptions') if ($action == 'setModuleOptions')
{ {
@ -647,9 +662,37 @@ else
print '</tr>'; print '</tr>';
print '</form>'; print '</form>';
$var=!$var;
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="CONTACT_USE_SEARCH_TO_SELECT">';
print "<tr ".$bc[$var].">";
print '<td width="80%">'.$langs->trans("UseSearchToSelectContact").'</td>';
if (! $conf->use_javascript_ajax)
{
print '<td nowrap="nowrap" align="right" colspan="2">';
print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>";
}
else
{
print '<td width="60" align="right">';
$arrval=array('0'=>$langs->trans("No"),
'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
);
print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT",$arrval,$conf->global->CONTACT_USE_SEARCH_TO_SELECT);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td>";
}
print '</tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
$db->close(); $db->close();

View File

@ -324,9 +324,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$object->firstname = GETPOST("prenom"); $object->firstname = GETPOST("prenom");
$object->login = GETPOST("login"); $object->login = GETPOST("login");
$object->pass = GETPOST("password"); $object->pass = GETPOST("password");
if($user->admin == 1) { // A user can only be set admin by an admin $object->admin = empty($user->admin)?0:GETPOST("admin"); // A user can only be set admin by an admin
$object->admin = GETPOST("admin");
}
$object->office_phone=GETPOST("office_phone"); $object->office_phone=GETPOST("office_phone");
$object->office_fax = GETPOST("office_fax"); $object->office_fax = GETPOST("office_fax");
$object->user_mobile= GETPOST("user_mobile"); $object->user_mobile= GETPOST("user_mobile");