Merge remote-tracking branch 'uptream/develop' into 8.0-a13

This commit is contained in:
Alexandre SPANGARO 2018-04-05 20:42:28 +02:00
commit 06dc70df09
83 changed files with 847 additions and 298 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -301,7 +301,7 @@ if (empty($reshook))
$object->phone = trim(GETPOST("phone",'alpha'));
$object->phone_perso = trim(GETPOST("phone_perso",'alpha'));
$object->phone_mobile= trim(GETPOST("phone_mobile",'alpha'));
$object->email = trim(GETPOST("member_email",'alpha'));
$object->email = preg_replace('/\s+/', '', GETPOST("member_email",'alpha'));
$object->skype = trim(GETPOST("skype",'alpha'));
$object->birth = $birthdate;
@ -445,7 +445,7 @@ if (empty($reshook))
$phone_perso=GETPOST("phone_perso",'alpha');
$phone_mobile=GETPOST("phone_mobile",'alpha');
$skype=GETPOST("member_skype",'alpha');
$email=GETPOST("member_email",'alpha');
$email=preg_replace('/\s+/', '', GETPOST("member_email",'alpha'));
$login=GETPOST("member_login",'alpha');
$pass=GETPOST("password",'alpha');
$photo=GETPOST("photo",'alpha');

View File

@ -48,9 +48,6 @@ $subscriptionstatic=new Subscription($db);
print load_fiche_titre($langs->trans("MembersArea"));
$var=True;
$Adherents=array();
$AdherentsAValider=array();
$MemberUpToDate=array();
@ -255,7 +252,6 @@ print '<th align="right">'.$langs->trans("AmountTotal").'</th>';
print '<th align="right">'.$langs->trans("AmountAverage").'</th>';
print "</tr>\n";
$var=true;
krsort($Total);
foreach ($Total as $key=>$value)
{

View File

@ -345,6 +345,12 @@ if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs-
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->adherent->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/card.php?action=create">'.$langs->trans('NewMember').'</a>';
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -355,7 +361,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
$topicmail="Information";
$modelmail="member";

View File

@ -181,6 +181,8 @@ if ($result)
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1">'.$langs->trans('NewSubscription').'</a>';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -191,7 +193,7 @@ if ($result)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
$topicmail="Information";
$modelmail="subscription";

View File

@ -228,6 +228,12 @@ if (! $rowid && $action != 'create' && $action != 'edit')
$param = '';
$newcardbutton='';
if ($user->rights->adherent->configurer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type.php?action=create">'.$langs->trans('NewMemberType').'</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -237,7 +243,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
$moreforfilter = '';

View File

@ -55,8 +55,7 @@ $search_lang=GETPOST('search_lang','alpha');
$search_fk_user=GETPOST('search_fk_user','intcomma');
$search_topic=GETPOST('search_topic','alpha');
$allowed=1;
if (! $allowed) accessforbidden();
if (! empty($user->socid)) accessforbidden();
$acts[0] = "activate";
$acts[1] = "disable";
@ -168,6 +167,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
if ($conf->projet->enabled) $elementList['project']=$langs->trans('MailToProject');
$elementList['user']=$langs->trans('MailToUser');
$elementList['all'] =$langs->trans('VisibleEverywhere');
$elementList['none']=$langs->trans('VisibleNowhere');
@ -521,7 +521,7 @@ $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]
);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
@ -732,7 +732,7 @@ if ($resql)
{
$tmpaction='edit';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('editEmailTemplateFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
// Show fields
@ -791,7 +791,7 @@ if ($resql)
{
$tmpaction = 'view';
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('viewEmailTemplateFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;

View File

@ -79,9 +79,9 @@ $familyinfo=array(
$param='';
if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword);
if ($search_status > -1) $param.='&search_status='.urlencode($search_status);
if ($search_nature > -1) $param.='&search_nature='.urlencode($search_nature);
if ($search_version > -1) $param.='&search_version='.urlencode($search_version);
if ($search_status && $search_status != '-1') $param.='&search_status='.urlencode($search_status);
if ($search_nature && $search_nature != '-1') $param.='&search_nature='.urlencode($search_nature);
if ($search_version && $search_version != '-1') $param.='&search_version='.urlencode($search_version);
$dirins=DOL_DOCUMENT_ROOT.'/custom';
$urldolibarrmodules='https://www.dolistore.com/';
@ -462,7 +462,7 @@ if ($mode == 'common')
{
dol_set_focus('#search_keyword');
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';

View File

@ -257,17 +257,6 @@ print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$con
print '</td><td align="right">';
print "</td></tr>\n";
// Add js auto fill amount on paiement form
/* always on now
$var=! $var;
print '<tr class="oddeven"><td>';
print $langs->trans("JSOnPaimentBill");
print '</td><td width="60" align="center">';
print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1);
print '</td><td align="right">';
print "</td></tr>\n";
*/
print '</table>';
print '<center>';

View File

@ -64,7 +64,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin'));
$hookmanager->initHooks(array('website'));
// Name of SQL tables of dictionaries
$tabname=array();
@ -514,15 +514,7 @@ if ($id)
}
}
$tmpaction = 'create';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook))
{
fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
}
fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
print '<td colspan="3" align="right">';
if ($action != 'edit')
@ -602,7 +594,7 @@ if ($id)
{
$tmpaction='edit';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('editWebsiteFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook)) fieldListWebsites($fieldlist,$obj,$tabname[$id],'edit');
@ -614,7 +606,7 @@ if ($id)
{
$tmpaction = 'view';
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('viewWebsiteFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;

View File

@ -81,7 +81,9 @@ $userstatic=new User($db);
llxHeader('', $langs->trans("ListOfBookmarks"));
print load_fiche_titre($langs->trans("ListOfBookmarks"));
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create">'.$langs->trans('NewBookmark').'</a>';
print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton);
$sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
$sql.= " u.login, u.lastname, u.firstname";
@ -204,16 +206,6 @@ else
}
print "<div class=\"tabsAction\">\n";
if ($user->rights->bookmark->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create">'.$langs->trans("NewBookmark").'</a>';
}
print '</div>';
llxFooter();
$db->close();

View File

@ -103,7 +103,10 @@ if ($result)
$title=$langs->trans("ListOfEMailings");
if ($filteremail) $title.=' ('.$langs->trans("SentTo",$filteremail).')';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,"",$num);
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/mailing/card.php?action=create">'.$langs->trans('NewMailing').'</a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '',$num, '', 'title_generic.png', 0, $newcardbutton);
$i = 0;

View File

@ -394,6 +394,12 @@ if ($resql)
if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->propal->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create">'.$langs->trans('NewPropal').'</a>';
}
// Lignes des champs de filtre
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -405,7 +411,7 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendPropalRef";
$modelmail="proposal_send";

View File

@ -52,18 +52,18 @@ foreach($linkedObjectBlock as $key => $objectlink)
$trclass=($var?'pair':'impair');
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("Proposal"); ?></td>
<td><?php echo $objectlink->getNomUrl(1); ?></td>
<td><?php echo $objectlink->ref_client; ?></td>
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
<td align="right"><?php
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?></td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
<td class="linkedcol-amount" align="right"><?php
if ($user->rights->propale->lire) {
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action" align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -2451,7 +2451,7 @@ if ($action == 'create' && $user->rights->commande->creer)
/*
* Form to add new line
*/
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer)
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines')
{
if ($action != 'editline')
{

View File

@ -419,6 +419,12 @@ if ($resql)
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($contextpage == 'orderlist' && $user->rights->commande->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create">'.$langs->trans('NewOrder').'</a>';
}
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -431,7 +437,7 @@ if ($resql)
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendOrderRef";
$modelmail="order_send";

View File

@ -47,18 +47,20 @@ foreach($linkedObjectBlock as $key => $objectlink)
$trclass=($var?'pair':'impair');
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("CustomerOrder"); ?></td>
<td><?php echo $objectlink->getNomUrl(1); ?></td>
<td align="center"><?php echo $objectlink->ref_client; ?></td>
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
<td align="right"><?php
<tr class="<?php echo $trclass; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerOrder"); ?>
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0,'',0,1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
</td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
<td class="linkedcol-amount" align="right"><?php
if ($user->rights->commande->lire) {
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right">
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action" align="right">
<?php
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'shipping') {

View File

@ -153,6 +153,8 @@ if ($result)
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create">'.$langs->trans('MenuNewVariousPayment').'</a>';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -163,7 +165,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";

View File

@ -2095,6 +2095,82 @@ if (empty($reshook))
exit();
}
// add lines from objectlinked
elseif($action == 'import_lines_from_object'
&& $user->rights->facture->creer
&& $object->statut == Facture::STATUS_DRAFT
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION))
{
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
{
if($fromElement == 'commande')
{
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class');
$lineClassName = 'OrderLine';
}
$nextRang = count($object->lines) + 1;
$importCount = 0;
$error = 0;
foreach($importLines as $lineId)
{
$lineId = intval($lineId);
$originLine = new $lineClassName($db);
if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0)
{
$originLine->fetch_optionals($lineId);
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
$txtva = $originLine->tva_tx;
$txlocaltax1 = $originLine->localtax1_tx;
$txlocaltax2 = $originLine->localtax2_tx;
$fk_product = $originLine->fk_product;
$remise_percent = $originLine->remise_percent;
$date_start = $originLine->date_start;
$date_end = $originLine->date_end;
$ventil = 0;
$info_bits = $originLine->info_bits;
$fk_remise_except = $originLine->fk_remise_except;
$price_base_type='HT';
$pu_ttc=0;
$type = $originLine->product_type;
$rang=$nextRang++;
$special_code = $originLine->special_code;
$origin = $originLine->element;
$origin_id = $originLine->id;
$fk_parent_line=0;
$fk_fournprice=$originLine->fk_fournprice;
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
$situation_percent = 100;
$fk_prev_id = '';
$fk_unit = $originLine->fk_unit;
$pu_ht_devise = $originLine->multicurrency_subprice;
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise);
if($res > 0){
$importCount++;
}else{
$error++;
}
}
else{
$error++;
}
}
if($error)
{
setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors');
}
}
}
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
@ -4156,7 +4232,7 @@ else if ($id > 0 || ! empty($ref))
// Form to add new line
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref))
{
if ($action != 'editline')
if ($action != 'editline' && $action != 'selectlines')
{
// Add free products/services
$object->formAddObjectLine(1, $mysoc, $soc);
@ -4448,8 +4524,16 @@ else if ($id > 0 || ! empty($ref))
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
$compatibleImportElementsList = false;
if($user->rights->facture->creer
&& $object->statut == Facture::STATUS_DRAFT
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) )
{
$compatibleImportElementsList = array('commande'); // import from linked elements
}
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);
// Show online payment link
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));

View File

@ -769,10 +769,16 @@ class Facture extends CommonInvoice
}
else if ($reshook < 0) $error++;*/
// Call trigger
$result=$this->call_trigger('BILL_CREATE',$user);
if ($result < 0) $error++;
// End call triggers
if (! $error)
{
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BILL_CREATE',$user);
if ($result < 0) $error++;
// End call triggers
}
}
if (! $error)
{

View File

@ -589,6 +589,12 @@ if ($resql)
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if($user->rights->facture->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create">'.$langs->trans('NewBill').'</a>';
}
$i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
@ -602,7 +608,7 @@ if ($resql)
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
$topicmail="SendBillRef";
$modelmail="facture_send";

View File

@ -47,12 +47,12 @@ foreach($linkedObjectBlock as $key => $objectlink)
$trclass=($var?'pair':'impair');
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("CustomerInvoice"); ?></td>
<td><?php echo $objectlink->getNomUrl(1); ?></td>
<td align="center"><?php echo $objectlink->ref_client; ?></td>
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
<td align="right"><?php
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerInvoice"); ?></td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
<td class="linkedcol-amount" align="right"><?php
if ($user->rights->facture->lire) {
$sign = 1;
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
@ -66,8 +66,8 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo '<strike>'.price($objectlink->total_ht).'</strike>';
}
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action" align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}
@ -87,4 +87,4 @@ if (count($linkedObjectBlock) > 1)
}
?>
<!-- END PHP TEMPLATE -->
<!-- END PHP TEMPLATE -->

View File

@ -131,6 +131,12 @@ if ($resql)
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
$newcardbutton='';
if ($user->rights->banque->cheque)
{
$newcardbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new">'.$langs->trans('NewCheckDeposit').'</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -140,7 +146,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', '', '', $limit);
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, $newcardbutton, '', $limit);
$moreforfilter='';

View File

@ -101,6 +101,8 @@ if ($result)
$selectedfields='';
$newcardbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/prelevement/create.php">'.$langs->trans('NewStandingOrder').'</a>';
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -112,7 +114,7 @@ if ($result)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit);
$moreforfilter='';

View File

@ -150,6 +150,8 @@ if ($result)
if ($typeid) $param.='&amp;typeid='.$typeid;
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/salaries/card.php?action=create">'.$langs->trans('NewSalaryPayment').'</a>';
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -159,7 +161,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";

View File

@ -146,6 +146,12 @@ if ($resql)
if ($year) $param.='&amp;year='.$year;
if ($typeid) $param.='&amp;typeid='.$typeid;
$newcardbutton='';
if($user->rights->tax->charges->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?action=create">'.$langs->trans('MenuNewSocialContribution').'</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -158,11 +164,11 @@ if ($resql)
if ($year)
{
$center=($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":"");
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
}
else
{
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
}
if (empty($mysoc->country_id) && empty($mysoc->country_code))

View File

@ -148,6 +148,11 @@ if ($result)
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($typeid) $param.='&amp;typeid='.$typeid;
$newcardbutton='';
if ($user->rights->tax->charges->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?action=create">'.$langs->trans('NewVATPayment').'</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -157,7 +162,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit);
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, $newcardbutton, '', $limit);
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';

View File

@ -412,6 +412,12 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->societe->contact->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/card.php?action=create">'.$langs->trans('NewContactAddress').'</a>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -421,7 +427,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit);
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit);
$topicmail="Information";
$modelmail="contact";

View File

@ -369,6 +369,12 @@ if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->contrat->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create">'.$langs->trans('NewContractSubscription').'</a>';
}
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -378,7 +384,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendContractRef";
$modelmail="contract";

View File

@ -776,7 +776,8 @@ class CMailFile
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
$res=false;
} else {
$this->error = sprintf ("Sent %d messages\n", $result);
$this->error = $langs->trans("SentXXXmessages", $result);
$this->errors[] = $langs->trans("SentXXXmessages", $result);
}
}
else

View File

@ -1428,19 +1428,24 @@ abstract class CommonObject
if (empty($format)) $format='text';
if (empty($id_field)) $id_field='rowid';
$fk_user_field = 'fk_user_modif';
$error=0;
$this->db->begin();
// Special case
if ($table == 'product' && $field == 'note_private') $field='note';
if (in_array($table, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
$fk_user_field = 'fk_user_mod';
}
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'";
else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value);
else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null");
if (! empty($fuser) && is_object($fuser)) $sql.=", fk_user_modif = ".$fuser->id;
elseif (empty($fuser) || $fuser != 'none') $sql.=", fk_user_modif = ".$user->id;
if (! empty($fuser) && is_object($fuser)) $sql.=", ".$fk_user_field." = ".$fuser->id;
elseif (empty($fuser) || $fuser != 'none') $sql.=", ".$fk_user_field." = ".$user->id;
$sql.= " WHERE ".$id_field." = ".$id;
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
@ -2437,11 +2442,13 @@ abstract class CommonObject
if (! $this->table_element)
{
$this->error='update_note was called on objet with property table_element not defined';
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
if (! in_array($suffix,array('','_public','_private')))
{
$this->error='update_note Parameter suffix must be empty, \'_private\' or \'_public\'';
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
return -2;
}
@ -3728,6 +3735,14 @@ abstract class CommonObject
print '<td class="linecolmove" width="10"></td>';
if($action == 'selectlines')
{
print '<td class="linecolcheckall" align="center">';
print '<input type="checkbox" class="linecheckboxtoggle" />';
print '<script type="text/javascript">$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
print '</td>';
}
print "</tr>\n";
}
@ -4991,6 +5006,7 @@ abstract class CommonObject
if ($error)
{
dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR);
$this->db->rollback();
return -1;
}
@ -5978,19 +5994,29 @@ abstract class CommonObject
else
{
$csstyle='';
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : '');
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'hideobject ' : '');
if (is_array($params) && count($params)>0) {
if (array_key_exists('style',$params)) {
$csstyle=$params['style'];
}
}
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
if (empty($onetrtd))
// add html5 elements
$domData = ' data-element="extrafield"';
$domData .= ' data-targetelement="'.$this->element.'"';
$domData .= ' data-targetid="'.$this->id.'"';
$html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : '';
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.'" '.$domData.' >';
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
{
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
}
if($action == 'selectlines'){ $colspan++; }
// Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
@ -6009,16 +6035,10 @@ abstract class CommonObject
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
}
if (empty($onetrtd)) $out .= '<td>';
else $out .= '<td'.($colspan?' colspan="'.($colspan+1).'"':'').'>';
$out .= $labeltoshow;
if (empty($onetrtd)) $out .= '</td><td'.($colspan?' colspan="'.($colspan).'"':'').'>';
else $out.=' ';
$out .= '<td>'.$labeltoshow.'</td>';
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
$out .='<span id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'">';
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
switch($mode) {
case "view":
@ -6030,8 +6050,9 @@ abstract class CommonObject
}
$out .= '</td>';
$out .= '</tr>';
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
else $out .= '</tr>';
$e++;
}
}
@ -6043,7 +6064,7 @@ abstract class CommonObject
jQuery(document).ready(function() {
function showOptions(child_list, parent_list)
{
var val = $("select[name="+parent_list+"]").val();
var val = $("select[name=\"options_"+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").hide();

View File

@ -740,6 +740,7 @@ class ExtraFields
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
// Set array of label of entity
// TODO Remove completely loading of label. This should be done by presentation.
$labelmulticompany=array();
if (!empty($conf->multicompany->enabled))
{
@ -757,8 +758,7 @@ class ExtraFields
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed";
$sql.= ",entity";
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";

View File

@ -134,28 +134,29 @@ class HookManager
if (in_array(
$method,
array(
'addCalendarChoice',
'addMoreActionsButtons',
'addMoreMassActions',
'addSearchEntry',
'addCalendarChoice',
'addMoreActionsButtons',
'addMoreMassActions',
'addSearchEntry',
'addStatisticLine',
'createDictionaryFieldList',
'createDictionaryFieldlist',
'editDictionaryFieldlist',
'getFormMail',
'deleteFile',
'deleteFile',
'doActions',
'doMassActions',
'doMassActions',
'formatEvent',
'formCreateThirdpartyOptions',
'formObjectOptions',
'formattachOptions',
'formBuilddocLineOptions',
'formatNotificationMessage',
'getFormMail',
'getIdProfUrl',
'getDirList',
'formatNotificationMessage',
'getFormMail',
'getIdProfUrl',
'getDirList',
'moveUploadedFile',
'moreHtmlStatus',
'pdf_build_address',
'pdf_build_address',
'pdf_writelinedesc',
'pdf_getlinenum',
'pdf_getlineref',
@ -176,12 +177,11 @@ class HookManager
'printAddress',
'printSearchForm',
'printTabsHead',
'formatEvent',
'printObjectLine',
'printObjectSubLine',
'showLinkToObjectBlock',
'printObjectLine',
'printObjectSubLine',
'sendMail',
'sendMailAfter'
'sendMailAfter',
'showLinkToObjectBlock'
)
)) $hooktype='addreplace';

View File

@ -1703,7 +1703,10 @@ class Form
$userstatic->fetch($value['id']);
$out.= $userstatic->getNomUrl(-1);
if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; }
if ($nbassignetouser > 1 && $action != 'view') $out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
if ($nbassignetouser > 1 && $action != 'view')
{
$out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
}
// Show my availability
if ($showproperties)
{
@ -5985,9 +5988,10 @@ class Form
*
* @param CommonObject $object Object we want to show links to
* @param string $morehtmlright More html to show on right of title
* @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
* @return int <0 if KO, >=0 if OK
*/
function showLinkedObjectBlock($object, $morehtmlright='')
function showLinkedObjectBlock($object, $morehtmlright='',$compatibleImportElementsList=false)
{
global $conf,$langs,$hookmanager;
global $bc;
@ -5996,7 +6000,9 @@ class Form
// Bypass the default method
$hookmanager->initHooks(array('commonobject'));
$parameters=array();
$parameters=array(
'compatibleImportElementsList' =>& $compatibleImportElementsList,
);
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
@ -6008,7 +6014,7 @@ class Form
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder allwidth">';
print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td>';
@ -6025,7 +6031,13 @@ class Form
foreach($object->linkedObjects as $objecttype => $objects)
{
$tplpath = $element = $subelement = $objecttype;
// to display inport button on tpl
$showImportButton=false;
if(!empty($compatibleImportElementsList) && in_array($element,$compatibleImportElementsList)){
$showImportButton=true;
}
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
{
$element = $regs[1];
@ -6085,7 +6097,7 @@ class Form
global $noMoreLinkedObjectBlockAfter;
$noMoreLinkedObjectBlockAfter=1;
}
$res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
if ($res)
{
@ -6101,6 +6113,13 @@ class Form
}
print '</table>';
if(!empty($compatibleImportElementsList))
{
$res=@include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php');
}
print '</div>';
return $nbofdifferenttypes;

View File

@ -835,6 +835,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$form = new Form($db);
$optioncss = GETPOST('optioncss', 'alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST('page','int');
@ -886,7 +887,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
{
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
}
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
@ -933,9 +934,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print "\n".'<table class="tagtable liste">'."\n";
$param="socid=".$object->id;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name);
$param="socid=".urlencode($object->id);
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
@ -943,7 +947,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
$sql .= " WHERE t.fk_soc = ".$object->id;
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')";
if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder";
else $sql.= " ORDER BY $sortfield $sortorder";
@ -1107,7 +1113,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
// Edit
if ($user->rights->societe->contact->creer)
{
print '<a href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&amp;id='.$obj->rowid.'&amp;backtopage='.urlencode($backtopage).'">';
print '<a href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
print img_edit();
print '</a>';
}

View File

@ -3059,7 +3059,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
* @param int $pictoisfullpath If 1, image path is a full path
* @param boolean|int $pictoisfullpath If true or 1, image path is a full path
* @param int $srconly Return only content of the src attribute of img.
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @param string $alt Force alt for bind peoplae
@ -3071,68 +3071,124 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
{
global $conf, $langs;
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
$url = DOL_URL_ROOT;
$theme = $conf->theme;
$path = 'theme/'.$theme;
// Define fullpathpicto to use into src
if ($pictoisfullpath)
{
if ($pictoisfullpath) {
// Clean parameters
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) {
$picto .= '.png';
}
$fullpathpicto = $picto;
}
else
{
else {
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow')))
{
$fakey = $pictowithoutext; $facolor=''; $fasize='';
if ($pictowithoutext == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; }
elseif ($pictowithoutext == 'switch_on') { $fakey = 'fa-toggle-on'; $facolor='#227722'; $fasize='2em'; }
elseif ($pictowithoutext == 'off') { $fakey = 'fa-square-o'; $fasize='1.3em'; }
elseif ($pictowithoutext == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; }
elseif ($pictowithoutext == 'bank') { $fakey = 'fa-bank'; $facolor='#444'; }
elseif ($pictowithoutext == 'delete') { $fakey = 'fa-trash'; $facolor='#444'; }
elseif ($pictowithoutext == 'edit') { $fakey = 'fa-pencil'; $facolor='#444'; }
elseif ($pictowithoutext == 'printer') { $fakey = 'fa-print'; $fasize='1.2em'; $facolor='#444'; }
elseif ($pictowithoutext == 'resize') { $fakey = 'fa-crop'; $facolor='#444'; }
elseif ($pictowithoutext == 'uparrow') { $fakey = 'fa-mail-forward'; $facolor='#555'; }
elseif ($pictowithoutext == 'unlink') { $fakey = 'fa-chain-broken'; $facolor='#555'; }
elseif ($pictowithoutext == 'playdisabled') { $fakey = 'fa-play'; $facolor='#ccc'; }
else { $fakey = 'fa-'.$pictowithoutext; $facolor='#444'; }
if (empty($srconly) && in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) {
$fakey = $pictowithoutext;
$facolor = '';
$fasize = '';
if ($pictowithoutext == 'switch_off') {
$fakey = 'fa-toggle-off';
$facolor = '#999';
$fasize = '2em';
}
elseif ($pictowithoutext == 'switch_on') {
$fakey = 'fa-toggle-on';
$facolor = '#227722';
$fasize = '2em';
}
elseif ($pictowithoutext == 'off') {
$fakey = 'fa-square-o';
$fasize = '1.3em';
}
elseif ($pictowithoutext == 'on') {
$fakey = 'fa-check-square-o';
$fasize = '1.3em';
}
elseif ($pictowithoutext == 'bank') {
$fakey = 'fa-bank';
$facolor = '#444';
}
elseif ($pictowithoutext == 'delete') {
$fakey = 'fa-trash';
$facolor = '#444';
}
elseif ($pictowithoutext == 'edit') {
$fakey = 'fa-pencil';
$facolor = '#444';
}
elseif ($pictowithoutext == 'printer') {
$fakey = 'fa-print';
$fasize = '1.2em';
$facolor = '#444';
}
elseif ($pictowithoutext == 'resize') {
$fakey = 'fa-crop';
$facolor = '#444';
}
elseif ($pictowithoutext == 'uparrow') {
$fakey = 'fa-mail-forward';
$facolor = '#555';
}
elseif ($pictowithoutext == 'unlink') {
$fakey = 'fa-chain-broken';
$facolor = '#555';
}
elseif ($pictowithoutext == 'playdisabled') {
$fakey = 'fa-play';
$facolor = '#ccc';
}
else {
$fakey = 'fa-'.$pictowithoutext;
$facolor = '#444';
}
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { $morecss.=($morecss?' ':'').$reg[1]; }
$enabledisablehtml ='<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'">';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$titlealt;
$enabledisablehtml.='</span>';
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
$morecss.= ($morecss?' ':'').$reg[1];
}
$enabledisablehtml = '<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'>';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$enabledisablehtml.= $titlealt;
}
$enabledisablehtml.= '</span>';
return $enabledisablehtml;
}
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
$url = DOL_URL_ROOT;
$theme = $conf->theme;
$path = 'theme/'.$theme;
if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) {
$path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
}
else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
$path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
}
else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) {
$path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
}
// If we ask an image into $url/$mymodule/img (instead of default path)
if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs))
{
if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) {
$picto = $regs[1];
$path = $regs[2]; // $path is $mymodule
}
// Clean parameters
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) {
$picto .= '.png';
}
// If alt path are defined, define url where img file is, according to physical path
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
{
if ($type == 'main') continue;
if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded
{
$url=DOL_URL_ROOT.$conf->file->dol_url_root[$type];
// ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
foreach ($conf->file->dol_document_root as $type => $dirroot) {
if ($type == 'main') {
continue;
}
// This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded
if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) {
$url = DOL_URL_ROOT.$conf->file->dol_url_root[$type];
break;
}
}
@ -3141,15 +3197,16 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;
}
if ($srconly) return $fullpathpicto;
else
{
if ($srconly) {
return $fullpathpicto;
}
else {
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people
//$tmparray=array(0=>$titlealt);
//if (empty($notitle) && preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
//$title=$tmparray[0];
//$alt=empty($tmparray[1])?'':$tmparray[1];
$title=$titlealt;
$title = $titlealt;
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($title))?'':' title="'.dol_escape_htmltag($title).'"').($moreatt?' '.$moreatt:' class="inline-block"').'>'; // Alt is used for accessibility, title for popup
}
}
@ -6466,27 +6523,30 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
// Clean parameters
$order=strtolower($order);
$sizearray=count($array);
if (is_array($array) && $sizearray>0)
if (is_array($array))
{
$temp = array();
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
else
$sizearray=count($array);
if ($sizearray>0)
{
($case_sensitive) ? natsort($temp) : natcasesort($temp);
if($order!='asc') $temp=array_reverse($temp,TRUE);
$temp = array();
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
else
{
($case_sensitive) ? natsort($temp) : natcasesort($temp);
if($order!='asc') $temp=array_reverse($temp,TRUE);
}
$sorted = array();
foreach(array_keys($temp) as $key)
{
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
}
return $sorted;
}
$sorted = array();
foreach(array_keys($temp) as $key)
{
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
}
return $sorted;
}
return $array;
}

View File

@ -318,7 +318,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Tools
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__);

View File

@ -1439,8 +1439,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
*/
if ($mainmenu == 'tools')
{
$langs->load("mails");
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates');
if (empty($user->socid)) // limit to internal users
{
$langs->load("mails");
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates');
}
if (! empty($conf->mailing->enabled))
{

View File

@ -1313,6 +1313,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
foreach ($this->cronjobs as $key => $value)
{
$entity = isset($this->cronjobs[$key]['entity'])?$this->cronjobs[$key]['entity']:$conf->entity;
$label = isset($this->cronjobs[$key]['label'])?$this->cronjobs[$key]['label']:'';
$jobtype = isset($this->cronjobs[$key]['jobtype'])?$this->cronjobs[$key]['jobtype']:'';
$class = isset($this->cronjobs[$key]['class'])?$this->cronjobs[$key]['class']:'';
@ -1334,7 +1335,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'";
if ($command) $sql.= " AND command = '".$this->db->escape($command)."'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND entity = ".$entity; // Must be exact entity
$now=dol_now();
@ -1371,7 +1372,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
if(is_int($unitfrequency)){ $sql.= "'".$this->db->escape($unitfrequency)."', "; }
if(is_int($priority)) {$sql.= "'".$this->db->escape($priority)."', ";}
if(is_int($status)){ $sql.= "'".$this->db->escape($status)."', "; }
$sql.= $conf->entity.",";
$sql.= $entity.",";
$sql.= "'".$this->db->escape($test)."'";
$sql.= ")";

View File

@ -179,7 +179,7 @@ class CommActionRapport
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
return 1;
}
}
@ -291,7 +291,9 @@ class CommActionRapport
if ($code == 'AC_OTH_AUTO') $code='AC_AUTO';
}
$pdf->SetXY(60,$y);
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Action".$code)),32), 0, 'L', 0);
$labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code);
$labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short');
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort),32), 0, 'L', 0);
$y2 = $pdf->GetY();
// Description of event

View File

@ -95,9 +95,9 @@ class modCron extends DolibarrModules
// Cronjobs
$this->cronjobs = array(
0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>in_array($db->type, array('mysql', 'mysqli'))),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>in_array($db->type, array('mysql', 'mysqli'))),
// 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
);
// Permissions

View File

@ -0,0 +1,106 @@
<?php
/* Copyright (C) 2011-2013 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?>
<!-- START TEMPLATE IMPORT OBJECT LINKED LINES -->
<script type="text/javascript">
$(document).ready(function(){
$('.objectlinked_importbtn').click(function (e) {
e.preventDefault();
var page = $(this).attr("href");
var fromelement = $(this).attr("data-element");
var fromelementid = $(this).attr("data-id");
if( page != undefined && fromelement != undefined && fromelementid != undefined)
{
var windowWidth = $(window).width()*0.8; //retrieve current window width
var windowHeight = $(window).height()*0.8; //retrieve current window height
var htmlLines;
var formId = "ajaxloaded_tablelinesform_" + fromelement + "_" + fromelementid;
$.get(page, function (data) {
htmlLines = $(data).find('#tablelines') ;
});
var $dialog = $('<form id="' + formId + '" action="<?php print $object->getNomUrl(0,'',0,1); ?>" method="post" ></form>')
.load( page + " #tablelines", function() {
$("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute
$("#" + formId + " .linecheckbox,#" + formId + " .linecheckboxtoggle").prop("checked", true); // checked by default
// reload checkbox toggle function
$("#" + formId + " .linecheckboxtoggle").click(function(){
var checkBoxes = $("#" + formId + " .linecheckbox");
checkBoxes.prop("checked", this.checked);
});
})
.html(htmlLines)
.dialog({
autoOpen: false,
modal: true,
height: windowHeight,
width: windowWidth,
title: "<?php echo $langs->trans('LinesToImport'); ?>",
buttons: {
"<?php echo $langs->trans('Import'); ?>": function() {
$( this ).dialog( "close" );
$("#" + formId).append('<input type="hidden" name="action" value="import_lines_from_object" />');
$("#" + formId).append('<input type="hidden" name="fromelement" value="' + fromelement + '" />');
$("#" + formId).append('<input type="hidden" name="fromelementid" value="' + fromelementid + '" />');
$("#" + formId).submit();
},
"<?php echo $langs->trans('Cancel'); ?>": function() {
$( this ).dialog( "close" );
}
}
});
$dialog.dialog('open');
}
else
{
$.jnotify("<?php echo $langs->trans('ErrorNoUrl'); ?>", "error", true);
}
});
});
</script>
<style type="text/css">
.objectlinked_importbtn{
cursor:pointer;
}
</style>
<!-- END TEMPLATE IMPORT OBJECT LINKED LINES -->

View File

@ -56,10 +56,17 @@ if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
// add html5 elements
$domData = ' data-element="'.$line->element.'"';
$domData .= ' data-id="'.$line->id.'"';
$domData .= ' data-qty="'.$line->qty.'"';
$domData .= ' data-product_type="'.$line->product_type.'"';
?>
<?php $coldisplay=0; ?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; echo $domData; ?> >
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?>
@ -264,7 +271,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
<?php
if ($this->statut == 0 && ($object_rights->creer)) { ?>
if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?>
<td class="linecoledit" align="center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
<?php } else { ?>
@ -304,6 +311,9 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
<?php } else { ?>
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
<?php } ?>
<?php if($action == 'selectlines'){ ?>
<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
<?php } ?>
</tr>

View File

@ -614,6 +614,22 @@ else
print $langs->trans($object->note);
print "</td></tr>";
if (! empty($conf->multicompany->enabled))
{
print '<tr><td>';
print $langs->trans('Entity')."</td><td>";
if (! $object->entity)
{
print $langs->trans("AllEntities");
}
else
{
$mc->getInfo($obj->entity);
print $mc->label;
}
print "</td></tr>";
}
print '</table>';
print '</div>';

View File

@ -34,6 +34,7 @@ class Cronjob extends CommonObject
public $table_element='cronjob'; //!< Name of table without prefix where object is stored
public $picto = 'cron';
public $entity;
public $jobtype;
public $tms='';
public $datec='';
@ -158,7 +159,7 @@ class Cronjob extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob(";
$sql.= "entity,";
$sql.= "datec,";
$sql.= "jobtype,";
$sql.= "label,";
@ -188,6 +189,7 @@ class Cronjob extends CommonObject
$sql.= "libname,";
$sql.= "test";
$sql.= ") VALUES (";
$sql.= " ".(! isset($this->entity)?$conf->entity:$this->db->escape($this->entity)).",";
$sql.= " '".$this->db->idate($now)."',";
$sql.= " ".(! isset($this->jobtype)?'NULL':"'".$this->db->escape($this->jobtype)."'").",";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
@ -270,8 +272,8 @@ class Cronjob extends CommonObject
function fetch($id)
{
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.rowid,";
$sql.= " t.entity,";
$sql.= " t.tms,";
$sql.= " t.datec,";
$sql.= " t.jobtype,";
@ -315,7 +317,7 @@ class Cronjob extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->entity = $obj->entity;
$this->tms = $this->db->jdate($obj->tms);
$this->datec = $this->db->jdate($obj->datec);
$this->label = $obj->label;
@ -422,7 +424,7 @@ class Cronjob extends CommonObject
}
}
$sql.= " ORDER BY $sortfield $sortorder ";
$sql.= $this->db->order($sortfield,$sortorder);
if (!empty($limit) && !empty($offset)) {
$sql.= $this->db->plimit($limit + 1,$offset);
}
@ -450,7 +452,6 @@ class Cronjob extends CommonObject
$line->id = $obj->rowid;
$line->ref = $obj->rowid;
$line->entity = $obj->entity;
$line->tms = $this->db->jdate($obj->tms);
$line->datec = $this->db->jdate($obj->datec);
@ -580,7 +581,7 @@ class Cronjob extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."cronjob SET";
$sql.= " entity=".(isset($this->entity)?$this->db->escape($this->entity):$conf->entity).",";
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " jobtype=".(isset($this->jobtype)?"'".$this->db->escape($this->jobtype)."'":"null").",";
$sql.= " command=".(isset($this->command)?"'".$this->db->escape($this->command)."'":"null").",";
@ -778,7 +779,7 @@ class Cronjob extends CommonObject
{
$this->id=0;
$this->ref=0;
$this->entity=0;
$this->tms='';
$this->datec='';
$this->label='';
@ -935,6 +936,16 @@ class Cronjob extends CommonObject
return -1;
}
// Force the environment of running to the environment declared for job, so jobs launched from command line will run into correct environment
// When job is ran from GUI, the environment should already be same, except if job has entity 0 (visible into all environments)
if ($conf->entity != $this->entity && $this->entity > 0)
{
dol_syslog("We try to run a job in entity ".$this->entity." when we are in entity ".$conf->entity, LOG_WARNING);
}
$savcurrententity = $conf->entity;
$conf->entity = $this->entity;
dol_syslog(get_class($this)."::run_jobs entity for running job is ".$conf->entity);
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$user=new User($this->db);
$result=$user->fetch('',$userlogin);
@ -942,6 +953,7 @@ class Cronjob extends CommonObject
{
$this->error="User Error:".$user->error;
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
$conf->entity = $savcurrententity;
return -1;
}
else
@ -950,6 +962,7 @@ class Cronjob extends CommonObject
{
$this->error=" User user login:".$userlogin." do not exists";
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
$conf->entity = $savcurrententity;
return -1;
}
}
@ -981,6 +994,7 @@ class Cronjob extends CommonObject
$result = $this->update($user); // This include begin/commit
if ($result<0) {
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
$conf->entity = $savcurrententity;
return -1;
}
@ -1079,6 +1093,7 @@ class Cronjob extends CommonObject
{
$this->error = $langs->trans('CronCannotLoadLib') . ': ' . $libpath;
dol_syslog(get_class($this) . "::run_jobs " . $this->error, LOG_ERR);
$conf->entity = $savcurrententity;
return -1;
}
// Load langs
@ -1086,6 +1101,7 @@ class Cronjob extends CommonObject
if ($result<0)
{
dol_syslog(get_class($this) . "::run_jobs Cannot load module langs" . $langs->error, LOG_ERR);
$conf->entity = $savcurrententity;
return -1;
}
dol_syslog(get_class($this) . "::run_jobs " . $this->libname . "::" . $this->methodename."(" . $this->params . ");", LOG_DEBUG);
@ -1148,13 +1164,12 @@ class Cronjob extends CommonObject
if ($result < 0)
{
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
$conf->entity = $savcurrententity;
return -1;
}
else
{
return $error?-1:1;
}
$conf->entity = $savcurrententity;
return $error?-1:1;
}

View File

@ -245,7 +245,7 @@ $sql.= " t.nbrun,";
$sql.= " t.libname,";
$sql.= " t.test";
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
$sql.= " WHERE 1 = 1";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1');
if ($search_status == 2) $sql.= " AND t.status = 2";
//Manage filter

View File

@ -131,7 +131,9 @@ if ($resql)
//if ($page > 0) $param.= '&page='.$page;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords);
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/don/card.php?action=create">'.$langs->trans('NewDonation').'</a>';
print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords, 'title_generic.png', 0, $newcardbutton);
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';

View File

@ -148,12 +148,13 @@ if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
$maxformassaction=1000;
if (! empty($massaction) && count($toselect) < 1)
$numtoselect = (is_array($toselect)?count($toselect):0);
if (! empty($massaction) && $numtoselect < 1)
{
$error++;
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
if (! $error && $numtoselect > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
@ -264,6 +265,12 @@ if ($resql)
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
$newcardbutton='';
if ($user->rights->expedition->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create2">'.$langs->trans('NewSending').'</a>';
}
$i = 0;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -274,7 +281,7 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, '', '', $limit);
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
if ($sall)
{
@ -541,7 +548,7 @@ if ($resql)
{
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
$receiving='';
if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
if (! empty($arrayfields['l.ref']['checked']))
{

View File

@ -2090,7 +2090,7 @@ else
if (! empty($conf->projet->enabled))
{
print '<td>';
$formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1);
$formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}

View File

@ -1241,7 +1241,7 @@ class ExpenseReport extends CommonObject
$error = 0;
// date approval
$this->date_approve = $this->db->idate($now);
$this->date_approve = $now;
if ($this->fk_statut != 5)
{
$this->db->begin();

View File

@ -465,7 +465,14 @@ if ($resql)
else
{
$title = $langs->trans("ListTripsAndExpenses");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
$newcardbutton='';
if ($user->rights->expensereport->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create">'.$langs->trans('NewTrip').'</a>';
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
}
$topicmail="SendExpenseReport";

View File

@ -271,6 +271,12 @@ if ($resql)
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->ficheinter->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create">'.$langs->trans('NewIntervention').'</a>';
}
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -282,7 +288,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="Information";
$modelmail="intervention";

View File

@ -645,6 +645,12 @@ if ($resql)
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if($user->rights->fournisseur->commande->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create">'.$langs->trans('NewOrder').'</a>';
}
// Lignes des champs de filtre
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -657,8 +663,7 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendOrderRef";
$modelmail="order_supplier_send";

View File

@ -471,6 +471,12 @@ if ($resql)
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->fournisseur->facture->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create">'.$langs->trans('NewBill').'</a>';
}
$i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -483,7 +489,7 @@ if ($resql)
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
$topicmail="SendBillRef";
$modelmail="supplier_invoice_send";

View File

@ -377,7 +377,10 @@ else
$nbtotalofrecords = count($holiday->holiday);
//print $num;
//print count($holiday->holiday);
print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, '', '', $limit);
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/holiday/card.php?action=request">'.$langs->trans('MenuAddCP').'</a>';
print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, $newcardbutton, '', $limit);
$topicmail="Information";
$modelmail="leaverequest";

View File

@ -41,6 +41,11 @@ DROP TABLE llx_c_accountingaccount;
update llx_propal set fk_statut = 1 where fk_statut = -1;
ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer;
ALTER TABLE llx_inventory ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_inventory ADD COLUMN fk_user_valid integer;
ALTER TABLE llx_inventory ADD COLUMN import_key varchar(14);
-- For 8.0

View File

@ -1729,6 +1729,7 @@ MailToSendContract=To send a contract
MailToThirdparty=To send email from third party page
MailToMember=To send email from member page
MailToUser=To send email from user page
MailToProject= To send email from project page
ByDefaultInList=Show by default on list view
YouUseLastStableVersion=You use the latest stable version
TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites)

View File

@ -103,6 +103,7 @@ LT2PaymentsES=IRPF Payments
VATPayment=Sales tax payment
VATPayments=Sales tax payments
VATRefund=Sales tax refund
NewVATPayment=New sales tax payment
Refund=Refund
SocialContributionsPayments=Social/fiscal taxes payments
ShowVatPayment=Show VAT payment

View File

@ -78,6 +78,7 @@ ResultOfMailSending=Result of mass EMail sending
NbSelected=Nb selected
NbIgnored=Nb ignored
NbSent=Nb sent
SentXXXmessages=%s message(s) sent.
ConfirmUnvalidateEmailing=Are you sure you want to change email <b>%s</b> to draft status?
MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters
MailingModuleDescContactsByCompanyCategory=Contacts by third party category

View File

@ -246,3 +246,4 @@ WEBSITE_PAGEURL=URL of page
WEBSITE_TITLE=Title
WEBSITE_DESCRIPTION=Description
WEBSITE_KEYWORDS=Keywords
LinesToImport=Lines to import

View File

@ -226,3 +226,4 @@ AllowCommentOnProject=Allow user comments on projects
DontHavePermissionForCloseProject=You do not have permissions to close the project %s
DontHaveTheValidateStatus=The project %s must be open to be closed
RecordsClosed=%s project(s) closed
SendProjectRef=About project %s

View File

@ -111,6 +111,12 @@ if ($resql)
if ($search_amount) $param.="&amp;search_amount=".urlencode($search_amount_ht);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
$newcardbutton='';
if ($user->rights->loan->write)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?action=create">'.$langs->trans('NewLoan').'</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -120,7 +126,7 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";

View File

@ -211,7 +211,8 @@ foreach($object->fields as $key => $val)
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
if (! empty($extrafields->attributes[$object->element]['label']))
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
@ -242,7 +243,8 @@ foreach($object->fields as $key => $val)
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : '');
if (! empty($extrafields->attributes[$object->element]['label'])) {
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : '');
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook

View File

@ -79,7 +79,13 @@ llxHeader('', $langs->trans("OpenSurveyArea"));
$param='';
$fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname';
print load_fiche_titre($langs->trans("OpenSurveyArea"));
$newcardbutton='';
if ($user->rights->opensurvey->read)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/opensurvey/wizard/index.php">'.$langs->trans('NewSurvey').'</a>';
}
print_barre_liste($langs->trans("OpenSurveyArea"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton);
// List of surveys into database

View File

@ -77,6 +77,7 @@ $duration_unit = GETPOST('duration_unit');
if (! empty($user->societe_id)) $socid=$user->societe_id;
$object = new Product($db);
$object->type = $type; // so test later to fill $usercancxxx is correct
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels

View File

@ -185,7 +185,9 @@ foreach($object->fields as $key => $val)
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
if (! empty($extrafields->attributes[$object->element]['label'])) {
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
@ -409,12 +411,13 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
foreach ($extrafields->attributes[$object->element]['computed'] as $key => $val)
{
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
if (! empty($extrafields->attributes[$object->element]['computed'])) {
foreach ($extrafields->attributes[$object->element]['computed'] as $key => $val)
{
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}
}
// Loop on record
// --------------------------------------------------------------------
$i=0;

View File

@ -278,7 +278,9 @@ else
$sql .= ', pac.rowid prod_comb_id';
}
// Add fields from extrafields
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
if (! empty($extrafields->attributes[$object->element]['label'])) {
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
@ -335,7 +337,9 @@ else
$sql .= ', pac.rowid';
}
// Add fields from extrafields
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : '');
if (! empty($extrafields->attributes[$object->element]['label'])) {
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : '');
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook
@ -416,6 +420,16 @@ else
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
$rightskey='produit';
if($type == Product::TYPE_SERVICE) $rightskey='service';
if($user->rights->{$rightskey}->creer)
{
$label='NewProduct';
if($type == Product::TYPE_SERVICE) $label='NewService';
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/product/card.php?action=create&amp;type='.$type.'">'.$langs->trans($label).'</a>';
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -427,7 +441,7 @@ else
print '<input type="hidden" name="type" value="'.$type.'">';
if (empty($arrayfields['p.fk_product_type']['checked'])) print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, '', '', $limit);
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit);
$topicmail="Information";
$modelmail="product";

View File

@ -43,7 +43,7 @@ $sortorder = GETPOST("sortorder");
if (! $sortfield) $sortfield="e.ref";
if (! $sortorder) $sortorder="ASC";
$page = GETPOST("page");
if ($page < 0) $page = 0;
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$year = strftime("%Y",time());
@ -130,6 +130,12 @@ if ($result)
if ($search_status) $param.="&search_status=".urlencode($search_status);
if ($sall) $param.="&sall=".urlencode($sall);
$newcardbutton='';
if ($user->rights->stock->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans('MenuNewWarehouse').'</a>';
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
@ -137,7 +143,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_generic.png', 0, '', '', $limit);
print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_generic.png', 0, $newcardbutton, '', $limit);
if ($sall)
{

View File

@ -55,6 +55,7 @@ $idline = GETPOST('idline');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (!$sortfield) {
$sortfield = 'p.ref';

View File

@ -72,7 +72,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$page = GETPOST("page",'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
if ($page < 0) $page = 0;
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
if (! $sortfield) $sortfield="m.datem";
if (! $sortorder) $sortorder="DESC";

View File

@ -446,6 +446,13 @@ if (empty($reshook))
$comefromclone=true;
}
}
// Actions to send emails
$trigger_name='PROJECT_SENTBYMAIL';
$paramname='id';
$autocopy='MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add
$trackid='proj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
@ -1064,7 +1071,7 @@ elseif ($object->id > 0)
// modified by hook
if (empty($reshook))
{
if ($action != "edit" )
if ($action != "edit" && $action != 'presend' )
{
// Create event
@ -1075,6 +1082,12 @@ elseif ($object->id > 0)
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '&amp;projectid=' . $object->id . '">' . $langs->trans("AddAction") . '</a></div>';
}*/
// Send
if ($object->statut != 2)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail').'</a></div>';
}
// Modify
if ($object->statut != 2 && $user->rights->projet->creer)
{
@ -1212,6 +1225,10 @@ elseif ($object->id > 0)
print "</div>";
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
@ -1244,6 +1261,14 @@ elseif ($object->id > 0)
print '</div></div></div>';
}
// Presend form
$modelmail='project';
$defaulttopic='SendProjectRef';
$diroutput = $conf->projet->dir_output;
$trackid = 'proj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
// Hook to add more things on page
$parameters=array();
$reshook=$hookmanager->executeHooks('mainCardTabAddMore',$parameters,$object,$action); // Note that $action and $object may have been modified by hook

View File

@ -438,6 +438,12 @@ if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=arr
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->projet->creer)
{
$newcardbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/card.php?action=create">'.$langs->trans('NewProject').'</a>';
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -449,7 +455,7 @@ print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, $newcardbutton, '', $limit);
// Show description of content
print '<div class="opacitymedium">';

View File

@ -390,6 +390,12 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->projet->creer)
{
$newcardbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/tasks.php?action=create">'.$langs->trans('NewTask').'</a>';
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -401,7 +407,7 @@ print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, $newcardbutton, '', $limit);
// Show description of content
print '<div class="opacitymedium">';

View File

@ -196,7 +196,13 @@ if($ret == -1) {
dol_print_error($db,$object->error);
exit;
} else {
print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords,'title_generic.png', 0, '', '', $limit);
$newcardbutton='';
if ($user->rights->resource->write)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans('MenuResourceAdd').'</a>';
}
print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords,'title_generic.png', 0, $newcardbutton, '', $limit);
}
$moreforfilter = '';

View File

@ -1643,6 +1643,7 @@ else
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="socid" value="'.$object->id.'">';
print '<input type="hidden" name="entity" value="'.$object->entity.'">';
if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print '<input type="hidden" name="code_auto" value="1">';

View File

@ -772,9 +772,10 @@ class Societe extends CommonObject
// Clean parameters
$this->id = $id;
$this->entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity);
$this->name = $this->name?trim($this->name):trim($this->nom);
$this->nom = $this->name; // For backward compatibility
$this->name_alias = trim($this->name_alias);
$this->name_alias = trim($this->name_alias);
$this->ref_ext = trim($this->ref_ext);
$this->address = $this->address?trim($this->address):trim($this->address);
$this->zip = $this->zip?trim($this->zip):trim($this->zip);
@ -789,9 +790,9 @@ class Societe extends CommonObject
$this->fax = preg_replace("/\./","",$this->fax);
$this->email = trim($this->email);
$this->skype = trim($this->skype);
$this->url = $this->url?clean_url($this->url,0):'';
$this->note_private = trim($this->note_private);
$this->note_public = trim($this->note_public);
$this->url = $this->url?clean_url($this->url,0):'';
$this->note_private = trim($this->note_private);
$this->note_public = trim($this->note_public);
$this->idprof1 = trim($this->idprof1);
$this->idprof2 = trim($this->idprof2);
$this->idprof3 = trim($this->idprof3);
@ -896,7 +897,8 @@ class Societe extends CommonObject
dol_syslog(get_class($this)."::update verify ok or not done");
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
$sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required
$sql .= "entity = " . $this->entity;
$sql .= ",nom = '" . $this->db->escape($this->name) ."'"; // Required
$sql .= ",name_alias = '" . $this->db->escape($this->name_alias) ."'";
$sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null");
$sql .= ",address = '" . $this->db->escape($this->address) ."'";
@ -2694,21 +2696,16 @@ class Societe extends CommonObject
if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON))
{
$file='';
$res=false;
$dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
foreach ($dirsociete as $dirroot)
{
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php"))
{
$file=$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php";
break;
}
$res=dol_include_once($dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.'.php');
if ($res) break;
}
if (! empty($file))
if ($res)
{
dol_include_once($file);
$classname = $conf->global->SOCIETE_CODECOMPTA_ADDON;
$mod = new $classname;

View File

@ -569,6 +569,23 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->societe->creer)
{
$typefilter='';
$label='MenuNewThirdParty';
if(! empty($type))
{
$typefilter = '&amp;type='.$type;
if($type == 'p') $label='MenuNewProspect';
if($type == 'c') $label='MenuNewCustomer';
if($type == 'f') $label='NewSupplier';
}
$newcardbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter.'">'.$langs->trans($label).'</a>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -577,7 +594,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
$langs->load("other");
$textprofid=array();

View File

@ -386,6 +386,12 @@ if ($resql)
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if($user->rights->supplier_proposal->creer)
{
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create">'.$langs->trans('NewAskPrice').'</a>';
}
// Lignes des champs de filtre
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -396,7 +402,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendSupplierProposalRef";
$modelmail="supplier_proposal_send";

View File

@ -69,7 +69,7 @@ if (($object->id != $user->id) && (! $user->rights->user->user->lire))
accessforbidden();
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('usercard','useragenda','globalcard');
$hookmanager->initHooks(array('usercard','useragenda','globalcard'));
/*
* Actions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
@ -102,7 +102,7 @@ $extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('usercard','globalcard');
$hookmanager->initHooks(array('usercard','globalcard'));
@ -203,7 +203,7 @@ if (empty($reshook)) {
$object->office_fax = GETPOST("office_fax", 'alpha');
$object->user_mobile = GETPOST("user_mobile");
$object->skype = GETPOST("skype", 'alpha');
$object->email = GETPOST("email", 'alpha');
$object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha'));
$object->job = GETPOST("job", 'alpha');
$object->signature = GETPOST("signature");
$object->accountancy_code = GETPOST("accountancy_code");
@ -347,7 +347,7 @@ if (empty($reshook)) {
$object->office_fax = GETPOST("office_fax", 'alpha');
$object->user_mobile = GETPOST("user_mobile");
$object->skype = GETPOST("skype", 'alpha');
$object->email = GETPOST("email", 'alpha');
$object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha'));
$object->job = GETPOST("job", 'alpha');
$object->signature = GETPOST("signature");
$object->accountancy_code = GETPOST("accountancy_code");

View File

@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref))
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('usercard','userdoc','globalcard');
$hookmanager->initHooks(array('usercard','userdoc','globalcard'));
/*

View File

@ -60,7 +60,7 @@ $object->fetch($id);
$entity=$conf->entity;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks('groupperms','globalcard');
$hookmanager->initHooks(array('groupperms','globalcard'));
/**

View File

@ -85,7 +85,7 @@ if ($key != $conf->global->CRON_KEY)
// If param userlogin is reserved word 'firstadmin'
if ($userlogin == 'firstadmin')
{
$sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1';
$sql='SELECT login, entity from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1';
$resql=$db->query($sql);
if ($resql)
{
@ -93,7 +93,7 @@ if ($userlogin == 'firstadmin')
if ($obj)
{
$userlogin = $obj->login;
echo "First admin user found is login '".$userlogin."'\n";
echo "First admin user found is login '".$userlogin."', entity ".$obj->entity."\n";
}
}
else dol_print_error($db);
@ -132,7 +132,7 @@ if (! empty($id)) {
$filter['t.rowid']=$id;
}
$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter, 0);
$result = $object->fetch_all('ASC,ASC,ASC','t.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0);
if ($result<0)
{
echo "Error: ".$object->error;
@ -159,8 +159,8 @@ if(is_array($qualifiedjobs) && (count($qualifiedjobs)>0))
// Loop over job
foreach($qualifiedjobs as $line)
{
dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_DEBUG);
echo "cron_run_jobs.php cronjobid: ".$line->id."\n";
dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG);
echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label."\n";
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now))

View File

@ -465,6 +465,10 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$after=dol_string_nohtmltag($text,1);
$this->assertEquals("DEF",$after,"test7");
$text='<a href="/myurl" title="<u>A title</u>">HIJ</a>';
$after=dol_string_nohtmltag($text,0);
$this->assertEquals("HIJ",$after,"test8");
return true;
}
@ -816,13 +820,18 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$this->assertContains('theme',$s,'testImgPicto2');
$this->assertContains('style="float: right"',$s,'testImgPicto2');
$s=img_picto('title','/fullpath/img.png','',1);
$s=img_picto('title', '/fullpath/img.png', '', 1);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto3');
$s=img_picto('title','/fullpath/img.png','',true);
$s=img_picto('title', '/fullpath/img.png', '', true);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto4');
$s=img_picto('title', 'delete', '', 0, 1);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto3');
}
/**