Merge remote-tracking branch 'upstream/develop' into socialnetworks

This commit is contained in:
Frédéric FRANCE 2019-10-30 20:06:43 +01:00
commit f7747ed00a
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
340 changed files with 9300 additions and 6289 deletions

View File

@ -65,21 +65,33 @@ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; }
while ($i < $num) {
$row = $db->fetch_row($resql);
$productsid[$i] = $row[0];
$i++;
}
}
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++; }
while ($i < $num) {
$row = $db->fetch_row($resql);
$societesid[$i] = $row[0];
$i++;
}
} else { print "err"; }
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++; }
while ($i < $num) {
$row = $db->fetch_row($resql);
$commandesid[$i] = $row[0];
$i++;
}
} else { print "err"; }

View File

@ -186,7 +186,7 @@
<!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
@ -194,7 +194,7 @@
<property name="tabIndent" value="true"/>
</properties>
</rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />

View File

@ -178,7 +178,7 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
$listofval = array(-1 => $langs->trans("Undefined"));
$listofval += $adht->liste_array();
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0);
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval)>1?1:0);
print "</td></tr>\n";
// Amount

View File

@ -2177,6 +2177,10 @@ class Adherent extends CommonObject
global $langs;
$langs->load("members");
$statusType = '';
$labelstatut = '';
$labelstatutShort = '';
if ($statut == -1)
{
$statusType = 'status0';

View File

@ -140,6 +140,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
$i=0;
foreach($listofsearchfields as $key => $value)
@ -152,6 +153,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
$i++;
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}

View File

@ -214,15 +214,17 @@ asort($orders);
//var_dump($modules);
unset($objMod);
$i=0;
foreach($orders as $tmpkey => $tmpvalue)
{
$objMod = $modules[$tmpkey];
if ($objMod->numero == $id)
$tmpMod = $modules[$tmpkey];
if ($tmpMod->numero == $id)
{
$key = $i;
$modName = $filename[$tmpkey];
$dirofmodule = $dirmod[$tmpkey];
$objMod = $tmpMod;
break;
}
$i++;
@ -233,25 +235,7 @@ $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
$head[$h][1] = $langs->trans("Description");
$head[$h][2] = 'desc';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
$head[$h][2] = 'feature';
$h++;
if ($objMod->isCoreOrExternalModule() == 'external')
{
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=changelog';
$head[$h][1] = $langs->trans("ChangeLog");
$head[$h][2] = 'changelog';
$h++;
}
$head = modulehelp_prepare_head($objMod);
// Check filters
$modulename=$objMod->getName();

View File

@ -70,7 +70,7 @@ function printBookmarksList()
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
$ret.= ' data-html="'.dol_escape_htmltag('<span class="fa fa-star-o"></span> '.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
$ret.= ' data-html="'.dol_escape_htmltag('<span class="fas fa-star"></span> '.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
$ret.= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
// Url to go on create new bookmark page
if (! empty($user->rights->bookmark->creer))
@ -78,7 +78,7 @@ function printBookmarksList()
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
$ret.= ' data-html="'.dol_escape_htmltag('<span class="fa fa-star-o"></span> '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
$ret.= ' data-html="'.dol_escape_htmltag('<span class="fas fa-star"></span> '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
}
// Menu with all bookmarks
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
@ -201,7 +201,7 @@ function printDropdownBookmarksList()
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$newbtn.= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
$newbtn.= '<span class="fa fa-star-o"></span> '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
$newbtn.= '<span class="fas fa-star"></span> '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
}

View File

@ -56,30 +56,33 @@ $langs->loadLangs(array("main","bills","cashdesk"));
</td>
<td class="select_design maxwidthonsmartphone">
<select id="selProduit" class="maxwidthonsmartphone" name="selProduit" onchange="javascript: setSource('LISTE');">
<?php
print '<option value="0">'.$top_liste_produits.'</option>'."\n";
<?php
print '<option value="0">'.$top_liste_produits.'</option>'."\n";
$id = $obj_facturation->id();
$id = $obj_facturation->id();
// Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
// Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
$nbtoshow = $nbr_enreg;
if (! empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes;
$nbtoshow = $nbr_enreg;
if (! empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes;
for ($i = 0; $i < $nbtoshow; $i++)
{
if ( $id == $tab_designations[$i]['rowid'] )
for ($i = 0; $i < $nbtoshow; $i++)
{
if ($id == $tab_designations[$i]['rowid']) {
$selected = 'selected';
else
} else {
$selected = '';
}
$label = $tab_designations[$i]['label'];
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'], 16).' - '.dol_trunc($label, 35, 'middle');
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
print '</option>'."\n";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) {
print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
}
?>
print '</option>'."\n";
}
?>
</select>
</td>
</tr>

View File

@ -36,16 +36,16 @@ $langs->loadLangs(array("main","bills","banks"));
<tr><td class="resume_label"><?php echo $langs->trans("Invoice"); ?></td><td><?php echo $obj_facturation->numInvoice(); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("TotalHT"); ?></td><td><?php echo price(price2num($obj_facturation->prixTotalHt(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<?php
// Affichage de la tva par taux
if ( $obj_facturation->montantTva() ) {
<?php
// Affichage de la tva par taux
if ( $obj_facturation->montantTva() ) {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
else
{
}
else
{
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.$langs->trans("NoVAT").'</td></tr>');
}
?>
}
?>
<tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price(price2num($obj_facturation->prixTotalTtc(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("PaymentMode"); ?> </td><td>
<?php
@ -82,20 +82,20 @@ $langs->loadLangs(array("main","bills","banks"));
?>
</td></tr>
<?php
// Affichage des infos en fonction du mode de paiement
if ( $obj_facturation->getsetPaymentMode() == 'DIF' ) {
<?php
// Affichage des infos en fonction du mode de paiement
if ( $obj_facturation->getsetPaymentMode() == 'DIF' ) {
echo ('<tr><td class="resume_label">'.$langs->trans("DateDue").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
} else {
} else {
echo ('<tr><td class="resume_label">'.$langs->trans("Received").'</td><td>'.price(price2num($obj_facturation->montantEncaisse(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
}
// Affichage du montant rendu (reglement en especes)
if ( $obj_facturation->montantRendu() ) {
// Affichage du montant rendu (reglement en especes)
if ( $obj_facturation->montantRendu() ) {
echo ('<tr><td class="resume_label">'.$langs->trans("Change").'</td><td>'.price(price2num($obj_facturation->montantRendu(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
}
?>
?>
</table>

View File

@ -1582,8 +1582,9 @@ if ($id > 0)
if ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -1735,5 +1735,18 @@ function sort_events_by_date($a, $b)
}
// If both events have the same start time, longest first
if(! is_numeric($b->datef))
{
// when event B have no end timestamp, event B should sort be before event A (All day events on top)
return 1;
}
if(! is_numeric($a->datef))
{
// when event A have no end timestamp , event A should sort be before event B (All day events on top)
return -1;
}
return $b->datef - $a->datef;
}

View File

@ -12,7 +12,7 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -1325,17 +1325,17 @@ if (empty($reshook))
$object->setProject(GETPOST('projectid', 'int'));
}
// Delai de livraison
// Delivery time
elseif ($action == 'setavailability' && $usercancreate) {
$result = $object->set_availability($user, GETPOST('availability_id', 'int'));
}
// Origine de la propale
// Origin of the commercial proposal
elseif ($action == 'setdemandreason' && $usercancreate) {
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int'));
}
// Conditions de reglement
// Terms of payment
elseif ($action == 'setconditions' && $usercancreate) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
}
@ -1348,7 +1348,7 @@ if (empty($reshook))
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
}
// Mode de reglement
// Payment choice
elseif ($action == 'setmode' && $usercancreate) {
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
}
@ -1413,7 +1413,7 @@ if (empty($reshook))
}
}
// Bascule du statut d'un contact
// Toggle the status of a contact
elseif ($action == 'swapstatut') {
if ($object->fetch($id) > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
@ -1422,7 +1422,7 @@ if (empty($reshook))
}
}
// Efface un contact
// Delete a contact
elseif ($action == 'deletecontact') {
$object->fetch($id);
$result = $object->delete_contact($lineid);
@ -1600,7 +1600,7 @@ if ($action == 'create')
$form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
print '</td></tr>';
// Ligne info remises tiers
// Third party discounts info line
print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
$absolute_discount = $soc->getAvailableDiscounts();
@ -1787,7 +1787,7 @@ if ($action == 'create')
/*
* Combobox pour la fonction de copie
* Combobox for copy function
*/
if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print '<input type="hidden" name="createmode" value="empty">';
@ -1884,7 +1884,7 @@ if ($action == 'create')
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) {
$formquestion[] = array('type' => 'date','name' => 'date_delivery','label' => $langs->trans("DeliveryDate"),'value' => $object->date_livraison);
}
// Paiement incomplet. On demande si motif = escompte ou autre
// Incomplete payment. We ask if reason = discount or other
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
@ -1927,7 +1927,7 @@ if ($action == 'create')
elseif ($action == 'validate') {
$error = 0;
// We verifie whether the object is provisionally numbering
// We verify whether the object is provisionally numbering
$ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') {
$numref = $object->getNextNumRef($soc);

View File

@ -170,9 +170,10 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -125,9 +125,10 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -86,9 +86,10 @@ if (! empty($conf->projet->enabled))
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -139,6 +139,7 @@ $fieldstosearchall = array(
'p.ref_client'=>'CustomerRef',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
's.name_alias'=>"AliasNameShort",
'p.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
@ -279,8 +280,9 @@ $sql.= ' u.login';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label']))
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook

View File

@ -101,9 +101,10 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->propal->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
$morehtmlref.=' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -29,11 +29,8 @@ if (empty($conf) || ! is_object($conf)) {
exit;
}
?>
<!-- BEGIN PHP TEMPLATE -->
<?php
print "<!-- BEGIN PHP TEMPLATE -->\n";
global $user;
@ -45,51 +42,46 @@ $langs->load("propal");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0; $ilink=0;
$total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<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"); ?>
<?php
if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
print '<td class="linkedcol-element" >'.$langs->trans("Proposal");
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
{
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
}
?>
</td>
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-amount right"><?php
print '</td>';
print '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
print '<td class="linkedcol-ref" >'.$objectlink->ref_client.'</td>';
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
print '<td class="linkedcol-amount right">';
if ($user->rights->propale->lire) {
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
} ?></td>
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action 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
}
print '</td>';
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n";
}
if (count($linkedObjectBlock) > 1)
{
?>
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<td><?php echo $langs->trans("Total"); ?></td>
<td></td>
<td class="center"></td>
<td class="center"></td>
<td class="right"><?php echo price($total); ?></td>
<td class="right"></td>
<td class="right"></td>
</tr>
<?php
print '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td></td>';
print '<td class="center"></td>';
print '<td class="center"></td>';
print '<td class="right">'.price($total).'</td>';
print '<td class="right"></td>';
print '<td class="right"></td>';
print "</tr>\n";
}
?>
<!-- END PHP TEMPLATE -->
print "<!-- END PHP TEMPLATE -->\n";

View File

@ -120,6 +120,7 @@ $fieldstosearchall = array(
'c.ref_client'=>'RefCustomerOrder',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
's.name_alias'=>"AliasNameShort",
'c.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";

View File

@ -306,7 +306,7 @@ else
$log="graph.php: min=".$min." max=".$max;
dol_syslog($log);
// CRED PART
// CRED PART
// Chargement du tableau des années
$tblyear[0] = array();
$tblyear[1] = array();
@ -393,7 +393,7 @@ else
unset($tblyear[1]);
unset($tblyear[2]);
// DEDBT PART
// DEDBT PART
// Chargement du tableau des années
$tblyear[0] = array();
$tblyear[1] = array();

View File

@ -427,8 +427,9 @@ if ($id)
$morehtmlref.=$langs->trans('Project') . ' ';
if ($user->rights->banque->modifier)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -92,8 +92,9 @@ if ($object->id)
$morehtmlref.=$langs->trans('Project') . ' : ';
if ($user->rights->banque->modifier && 0)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -61,8 +61,9 @@ if (! empty($conf->projet->enabled))
$morehtmlref.=$langs->trans('Project') . ' : ';
if ($user->rights->banque->modifier && 0)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -14,7 +14,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -815,7 +815,9 @@ if (empty($reshook))
$sql .= " WHERE fk_facture = " . $object->id;
$resql = $db->query($sql);
if (!empty($resql)) {
while ($obj = $db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc;
while ($obj = $db->fetch_object($resql)) {
$total_creditnote_and_deposit += $obj->amount_ttc;
}
} else dol_print_error($db);
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc;
@ -3274,11 +3276,11 @@ if ($action == 'create')
print '<td colspan="2">';
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
$liste = ModelePDFFactures::liste_modeles($db);
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){ // Hidden conf
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){
// Hidden conf
$paramkey='FACTURE_ADDON_PDF_'.$object->type;
$curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF;
}
else{
} else {
$curent = $conf->global->FACTURE_ADDON_PDF;
}
print $form->selectarray('model', $liste, $curent);
@ -3803,8 +3805,9 @@ elseif ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($usercancreate)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -529,8 +529,7 @@ class Invoices extends DolibarrApi
// update bank account
if (!empty($this->invoice->fk_account))
{
if($this->invoice->setBankAccount($this->invoice->fk_account) == 0)
{
if ($this->invoice->setBankAccount($this->invoice->fk_account) == 0) {
throw new RestException(400, $this->invoice->error);
}
}
@ -909,11 +908,11 @@ class Invoices extends DolibarrApi
$result = $this->invoice->fetch($id);
if( ! $result ) {
if (! $result) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
if (! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

View File

@ -2587,10 +2587,12 @@ class Facture extends CommonInvoice
$next_invoice->brouillon = 1;
foreach ($next_invoice->lines as $line)
{
$result = $next_invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent,
$result = $next_invoice->updateline(
$line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent,
$line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type,
$line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent,
$line->fk_unit);
$line->fk_unit
);
if ($result < 0)
{

View File

@ -163,9 +163,10 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -1242,8 +1242,9 @@ else
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -223,8 +223,9 @@ $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,
$sql.= " f.datec, f.tms,";
$sql.= " f.fk_cond_reglement, f.fk_mode_reglement";
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label']))
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
@ -632,8 +633,7 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
if (! empty($arrayfields['status']['checked']))
{
if (! empty($arrayfields['status']['checked'])) {
print '<td align="center">';
print $invoicerectmp->getLibStatut(3, 0);
print '</td>';

View File

@ -400,8 +400,9 @@ $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label']))
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -1352,8 +1353,7 @@ if ($resql)
|| isset($totalarray['totalttcfield'])
|| isset($totalarray['totalamfield'])
|| isset($totalarray['totalrtpfield'])
)
{
) {
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])

View File

@ -189,9 +189,10 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -233,48 +233,45 @@ foreach ($tmp_companies as $value) {
print '<div class="fichecenter"><div class="fichethirdleft">';
//if (empty($socid))
//{
// Show filter box
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, 'style="width: 95%"', 0, 0, 0, '', '', 1);
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td></tr>';
// Status
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
if ($mode == 'customer')
{
// Show filter box
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, 'style="width: 95%"', 0, 0, 0, '', '', 1);
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td></tr>';
// Status
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
if ($mode == 'customer')
{
$liststatus=array('0'=>$langs->trans("BillStatusDraft"), '1'=>$langs->trans("BillStatusNotPaid"), '2'=>$langs->trans("BillStatusPaid"), '3'=>$langs->trans("BillStatusCanceled"));
print $form->selectarray('object_status', $liststatus, $object_status, 1);
}
if ($mode == 'supplier')
{
}
if ($mode == 'supplier')
{
$liststatus=array('0'=>$langs->trans("BillStatusDraft"),'1'=>$langs->trans("BillStatusNotPaid"), '2'=>$langs->trans("BillStatusPaid"));
print $form->selectarray('object_status', $liststatus, $object_status, 1);
}
print '</td></tr>';
// Year
print '<tr><td>'.$langs->trans("Year").'</td><td>';
if (! in_array($year, $arrayyears)) $arrayyears[$year]=$year;
if (! in_array($nowyear, $arrayyears)) $arrayyears[$nowyear]=$nowyear;
arsort($arrayyears);
print $form->selectarray('year', $arrayyears, $year, 0);
print '</td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
print '</table>';
print '</form>';
print '<br><br>';
//}
}
print '</td></tr>';
// Year
print '<tr><td>'.$langs->trans("Year").'</td><td>';
if (! in_array($year, $arrayyears)) $arrayyears[$year]=$year;
if (! in_array($nowyear, $arrayyears)) $arrayyears[$nowyear]=$nowyear;
arsort($arrayyears);
print $form->selectarray('year', $arrayyears, $year, 0);
print '</td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
print '</table>';
print '</form>';
print '<br><br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';

View File

@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf))
exit;
}
?>
<!-- BEGIN PHP TEMPLATE -->
<?php
print "<!-- BEGIN PHP TEMPLATE -->\n";
global $user;
global $noMoreLinkedObjectBlockAfter;
@ -40,16 +36,16 @@ $langs->load("bills");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0; $ilink=0;
$total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element"><?php
print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
print '<td class="linkedcol-element">';
switch ($objectlink->type) {
case Facture::TYPE_REPLACEMENT:
echo $langs->trans("InvoiceReplacement");
@ -70,16 +66,16 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo $langs->trans("CustomerInvoice");
break;
}
?></td>
<td class="linkedcol-name nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref left"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-amount right"><?php
print '</td>';
print '<td class="linkedcol-name nowraponall">'.$objectlink->getNomUrl(1).'</td>';
print '<td class="linkedcol-ref left">'.$objectlink->ref_client.'</td>';
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
print '<td class="linkedcol-amount right">';
if ($user->rights->facture->lire) {
$sign = 1;
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
if ($objectlink->statut != 3) // If not abandonned
{
if ($objectlink->statut != 3) {
// If not abandonned
$total = $total + $sign * $objectlink->total_ht;
echo price($objectlink->total_ht);
}
@ -87,26 +83,23 @@ foreach($linkedObjectBlock as $key => $objectlink)
{
echo '<strike>'.price($objectlink->total_ht).'</strike>';
}
} ?></td>
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action 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
}
print '</td>';
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n";
}
if (count($linkedObjectBlock) > 1)
{
?>
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<td><?php echo $langs->trans("Total"); ?></td>
<td></td>
<td class="center"></td>
<td class="center"></td>
<td class="right"><?php echo price($total); ?></td>
<td class="right"></td>
<td class="right"></td>
</tr>
<?php
print '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td></td>';
print '<td class="center"></td>';
print '<td class="center"></td>';
print '<td class="right">'.price($total).'</td>';
print '<td class="right"></td>';
print '<td class="right"></td>';
print '</tr>';
}
?>
<!-- END PHP TEMPLATE -->
print "<!-- END PHP TEMPLATE -->\n";

View File

@ -24,11 +24,9 @@ if (empty($conf) || ! is_object($conf))
exit;
}
?>
<!-- BEGIN PHP TEMPLATE -->
print "<!-- BEGIN PHP TEMPLATE -->\n";
<?php
global $user;
global $noMoreLinkedObjectBlockAfter;
@ -38,14 +36,15 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("bills");
$total=0; $ilink=0;
$total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
?>
<tr class="<?php echo $trclass; ?>" >
<td class="linkedcol-element"><?php echo $langs->trans("RepeatableInvoice"); ?></td>
<td class="linkedcol-name"><!-- nowraponall because ref is a label --><?php echo $objectlink->getNomUrl(1); ?></td>
@ -55,11 +54,12 @@ foreach($linkedObjectBlock as $key => $objectlink)
if ($user->rights->facture->lire) {
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
} ?></td>
}
?></td>
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action 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
<?php
}
if (count($linkedObjectBlock) > 1)
{
@ -75,6 +75,5 @@ if (count($linkedObjectBlock) > 1)
</tr>
<?php
}
?>
<!-- END PHP TEMPLATE -->
print "<!-- END PHP TEMPLATE -->\n";

View File

@ -115,6 +115,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
$i=0;
foreach($listofsearchfields as $key => $value)
@ -127,6 +128,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
$i++;
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}
@ -165,6 +167,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("CustomersDraftInvoices").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
@ -216,7 +219,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
}
print "</table><br>";
print "</table></div><br>";
$db->free($resql);
}
else
@ -251,6 +254,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{
$num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("SuppliersDraftInvoices").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
@ -303,7 +307,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
}
print "</table><br>";
print "</table></div><br>";
$db->free($resql);
}
else

View File

@ -320,8 +320,6 @@ else
$span=$columns;
if ($modetax != 1) $span+=2;
//if ($modetax == 0 || $modetax == 2)
//{
// Customers invoices
print '<tr class="liste_titre">';
print '<td class="left">'.$elementcust.'</td>';
@ -481,9 +479,7 @@ else
print '<tr><td colspan="'.($span+1).'">&nbsp;</td></tr>';
print '</table>';
$diff=$x_coll_sum;
//}
//if($conf->global->$calc ==0 || $conf->global->$calc == 1){
echo '<table class="noborder" width="100%">';
//print table headers for this quadri - expenses now
print '<tr class="liste_titre">';
@ -636,7 +632,6 @@ else
}
print '</table>';
//}
// Total to pay
print '<br><br>';

View File

@ -271,7 +271,7 @@ if ($id > 0 || $ref)
print '<tr class="oddeven"><td>'.$langs->trans("TransMetod").'</td><td>';
print $form->selectarray("methode", $object->methodes_trans);
print '</td></tr>';
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
/*print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
print '<input class="flat" type="file" name="userfile"><br>';
print '</td></tr>';*/

View File

@ -1887,15 +1887,15 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' <BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
$XML_SEPA_INFO .= ' </CdtrAgt>'.$CrLf;
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;
*/ $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;

View File

@ -749,17 +749,17 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
$sql.= " AND fk_statut in (1,2)";
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
}
elseif ($modecompta == 'RECETTES-DEPENSES') {
} elseif ($modecompta == 'RECETTES-DEPENSES') {
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
$sql.= " AND fk_statut >= 2";
if (! empty($date_start) && ! empty($date_end))
if (! empty($date_start) && ! empty($date_end)) {
$sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'";
}
}
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";

View File

@ -454,8 +454,9 @@ if ($id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->tax->charges->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -241,47 +241,45 @@ if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
}
if ($modecompta == 'CREANCES-DETTES')
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("TurnoverbyVatrate") . '</td>';
print '<td class="left">' . $langs->trans("ProductOrService") . '</td>';
print '<td class="left">' . $langs->trans("Country") . '</td>';
$i=0;
while($i < 12)
{
if ($modecompta == 'CREANCES-DETTES') {
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("TurnoverbyVatrate") . '</td>';
print '<td class="left">' . $langs->trans("ProductOrService") . '</td>';
print '<td class="left">' . $langs->trans("Country") . '</td>';
$i=0;
while($i < 12) {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
print '<td width="60" class="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
$i++;
}
print '<td width="60" class="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
}
print '<td width="60" class="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
$sql = "SELECT fd.tva_tx AS vatrate,";
$sql .= " fd.product_type AS product_type,";
$sql .= " cc.label AS country,";
for ($i = 1; $i <= 12; $i ++) {
$sql = "SELECT fd.tva_tx AS vatrate,";
$sql .= " fd.product_type AS product_type,";
$sql .= " cc.label AS country,";
for ($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
$sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
$sql .= " WHERE f.datef >= '" . $db->idate($date_start) . "'";
$sql .= " AND f.datef <= '" . $db->idate($date_end) . "'";
$sql.= " AND f.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
}
$sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
$sql .= " WHERE f.datef >= '" . $db->idate($date_start) . "'";
$sql .= " AND f.datef <= '" . $db->idate($date_end) . "'";
$sql.= " AND f.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (0,1,2,5)";
} else {
} else {
$sql.= " AND f.type IN (0,1,2,3,5)";
}
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")";
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
}
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")";
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$totalpermonth = array();
while ( $obj = $db->fetch_object($resql)) {
@ -317,50 +315,50 @@ if ($resql) {
}
print '<td class="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
print '</tr>';
} else {
} else {
print $db->lasterror(); // Show last sql error
}
}
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("PurchasebyVatrate") . '</td>';
print '<td class="left">' . $langs->trans("ProductOrService") . '</td>';
print '<td class="left">' . $langs->trans("Country") . '</td>';
$i=0;
while($i < 12)
{
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("PurchasebyVatrate") . '</td>';
print '<td class="left">' . $langs->trans("ProductOrService") . '</td>';
print '<td class="left">' . $langs->trans("Country") . '</td>';
$i=0;
while($i < 12)
{
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
print '<td width="60" class="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
$i++;
}
print '<td width="60" class="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
}
print '<td width="60" class="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
$sql2 = "SELECT ffd.tva_tx AS vatrate,";
$sql2 .= " ffd.product_type AS product_type,";
$sql2 .= " cc.label AS country,";
for($i = 1; $i <= 12; $i ++) {
$sql2 = "SELECT ffd.tva_tx AS vatrate,";
$sql2 .= " ffd.product_type AS product_type,";
$sql2 .= " cc.label AS country,";
for($i = 1; $i <= 12; $i ++) {
$sql2 .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
$sql2 .= " SUM(ffd.total_ht) as total";
$sql2 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = ff.fk_soc";
$sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
$sql2 .= " WHERE ff.datef >= '" . $db->idate($date_start) . "'";
$sql2 .= " AND ff.datef <= '" . $db->idate($date_end) . "'";
$sql.= " AND ff.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
}
$sql2 .= " SUM(ffd.total_ht) as total";
$sql2 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = ff.fk_soc";
$sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
$sql2 .= " WHERE ff.datef >= '" . $db->idate($date_start) . "'";
$sql2 .= " AND ff.datef <= '" . $db->idate($date_end) . "'";
$sql.= " AND ff.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND ff.type IN (0,1,2,5)";
} else {
} else {
$sql.= " AND ff.type IN (0,1,2,3,5)";
}
$sql2 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")";
$sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label";
}
$sql2 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")";
$sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label";
//print $sql2;
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
$resql2 = $db->query($sql2);
if ($resql2) {
//print $sql2;
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
$resql2 = $db->query($sql2);
if ($resql2) {
$num = $db->num_rows($resql2);
$totalpermonth = array();
while ( $obj = $db->fetch_object($resql2)) {
@ -396,10 +394,10 @@ if ($resql2) {
}
print '<td class="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
print '</tr>';
} else {
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
}
print "</table>\n";
} else {
// $modecompta != 'CREANCES-DETTES'
// "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an

View File

@ -326,7 +326,7 @@ if ($modecompta == 'CREANCES-DETTES')
// Array header
print "<tr class=\"liste_titre\">";
print_liste_field_titre(
print_liste_field_titre(
$langs->trans("Product"),
$_SERVER["PHP_SELF"],
"ref",
@ -336,7 +336,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
print_liste_field_titre(
print_liste_field_titre(
$langs->trans('Quantity'),
$_SERVER["PHP_SELF"],
"qty",
@ -346,7 +346,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
print_liste_field_titre(
print_liste_field_titre(
$langs->trans("Percentage"),
$_SERVER["PHP_SELF"],
"qty",
@ -356,7 +356,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
print_liste_field_titre(
print_liste_field_titre(
$langs->trans('AmountHT'),
$_SERVER["PHP_SELF"],
"amount",
@ -366,7 +366,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
print_liste_field_titre(
print_liste_field_titre(
$langs->trans("AmountTTC"),
$_SERVER["PHP_SELF"],
"amount_ttc",
@ -376,7 +376,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
print_liste_field_titre(
print_liste_field_titre(
$langs->trans("Percentage"),
$_SERVER["PHP_SELF"],
"amount_ttc",

View File

@ -172,7 +172,7 @@ if ($modecompta == 'CREANCES-DETTES')
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
else $sql.= " AND f.type IN (0,1,2,3,5)";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
}
elseif ($modecompta=="RECETTES-DEPENSES")
{
@ -187,7 +187,7 @@ elseif ($modecompta=="RECETTES-DEPENSES")
$sql.= " WHERE p.rowid = pf.fk_paiement";
$sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
}
elseif ($modecompta=="BOOKKEEPING")
{

View File

@ -135,13 +135,15 @@ echo $this->control->tpl['ajax_selectcountry'];
<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
</tr>
<?php if (! empty($this->control->tpl['contact_element'])) { ?>
<?php foreach ($this->control->tpl['contact_element'] as $element) { ?>
<tr>
<td><?php echo $element['linked_element_label']; ?></td>
<td colspan="3"><?php echo $element['linked_element_value']; ?></td>
</tr>
<?php } } ?>
<?php
if (! empty($this->control->tpl['contact_element'])) {
foreach ($this->control->tpl['contact_element'] as $element) {
print '<tr>';
print '<td>'.$element['linked_element_label'].'</td>';
print '<td colspan="3">'.$element['linked_element_value'].'</td>';
print '</tr>';
}
} ?>
<tr>
<td><?php echo $langs->trans("DolibarrLogin"); ?></td>

View File

@ -24,17 +24,14 @@ if (empty($conf) || ! is_object($conf))
$contact = $GLOBALS['objcanvas']->control->object;
?>
<!-- BEGIN PHP TEMPLATE CONTACTCARD_VIEW.TPL.PHP DEFAULT -->
<?php echo $this->control->tpl['showhead']; ?>
print "<!-- BEGIN PHP TEMPLATE CONTACTCARD_VIEW.TPL.PHP DEFAULT -->\n";
echo $this->control->tpl['showhead'];
<?php
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
?>
<?php if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
<?php if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<table class="border allwidth">
@ -134,29 +131,27 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
</table>
<?php echo $this->control->tpl['showend']; ?>
<?php echo $this->control->tpl['showend'];
<?php if (empty($user->societe_id)) { ?>
<div class="tabsAction">
if (empty($user->societe_id)) {
print '<div class="tabsAction">';
if ($user->rights->societe->contact->creer) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
}
<?php if ($user->rights->societe->contact->creer) { ?>
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Modify'); ?></a>
<?php } ?>
if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
}
<?php if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { ?>
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas; ?>"><?php echo $langs->trans("CreateDolibarrLogin"); ?></a>
<?php } ?>
if ($user->rights->societe->contact->supprimer) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
}
<?php if ($user->rights->societe->contact->supprimer) { ?>
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
<?php } ?>
</div><br>
<?php }
print '</div><br>';
}
echo $this->control->tpl['actionstodo'];
echo $this->control->tpl['actionsdone'];
?>
<!-- END PHP TEMPLATE -->
print "<!-- END PHP TEMPLATE -->\n";

View File

@ -1003,7 +1003,7 @@ else
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
}
print $formcompany->select_state($object->state_id, isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id, 'state_id');
print $formcompany->select_state(GETPOSTISSET('state_id')?GETPOST('state_id', 'alpha'):$object->state_id, $object->country_code, 'state_id');
print '</td></tr>';
}

View File

@ -1218,11 +1218,11 @@ class Contact extends CommonObject
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
$phonelist=array();
if ($this->phone_pro) $phonelist[]=$this->phone_pro;
if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
if ($this->phone_perso) $phonelist[]=$this->phone_perso;
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ', $phonelist);
$phonelist = array();
if ($this->phone_pro) $phonelist[] = dol_print_phone($this->phone_pro, $this->country_code, $this->id, 0, '', '&nbsp;', 'phone');
if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $this->country_code, $this->id, 0, '', '&nbsp;', 'mobile');
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $this->country_code, $this->id, 0, '', '&nbsp;', 'phone');
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.implode('&nbsp;', $phonelist);
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id;
@ -1320,23 +1320,24 @@ class Contact extends CommonObject
// phpcs:enable
global $langs;
if (empty($this->status) || empty($this->statusshort))
{
$this->labelstatus[0] = 'ActivityCeased';
$this->labelstatusshort[0] = 'ActivityCeased';
$this->labelstatus[5] = 'ActivityCeased';
$this->labelstatusshort[5] = 'ActivityCeased';
$this->labelstatus[1] = 'InActivity';
$this->labelstatusshort[1] = 'InActivity';
$this->labelstatus[4] = 'InActivity';
$this->labelstatusshort[4] = 'InActivity';
}
$labelstatus = array(
0 => 'ActivityCeased',
1 => 'InActivity',
4 => 'InActivity',
5 => 'ActivityCeased',
);
$labelstatusshort = array(
0 => 'ActivityCeased',
1 => 'InActivity',
4 => 'InActivity',
5 => 'ActivityCeased',
);
$statusType = 'status4';
if ($status==0 || $status==5) $statusType = 'status5';
$label = $langs->trans($this->labelstatus[$status]);
$labelshort = $langs->trans($this->labelstatusshort[$status]);
$label = $langs->trans($labelstatus[$status]);
$labelshort = $langs->trans($labelstatusshort[$status]);
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
}

View File

@ -151,7 +151,7 @@ if ($object->thirdparty->fournisseur)
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders');
// There no contact type for supplier proposals
// if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
// if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
}
print '</table>';
@ -298,7 +298,7 @@ if (!empty($sql_select))
$sql.= " ";
if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label";
$sql.= " FROM "/*.MAIN_DB_PREFIX."societe as s, "*/.$tables_from;
// if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
// if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
$sql.= $where;
$sql.= dolSqlDateFilter($dateprint, 0, $month, $year);
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";

View File

@ -63,8 +63,8 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; }
if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; }
if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; }
if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; }
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";

View File

@ -292,7 +292,7 @@ $sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town,
// socialnetworks->>'$.facebook' as facebook
$sql.= " p.socialnetworks,";
$sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
$sql.= " co.code as country_code";
$sql.= " co.label as country, co.code as country_code";
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
@ -799,6 +799,8 @@ while ($i < min($num, $limit))
$contactstatic->zip=$obj->zip;
$contactstatic->town=$obj->town;
$contactstatic->socialnetworks = $arraysocialnetworks;
$contactstatic->country = $obj->country;
$contactstatic->country_code = $obj->country_code;
// ID
if (! empty($arrayfields['p.rowid']['checked']))

View File

@ -164,8 +164,9 @@ if ($id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->contrat->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -331,9 +331,8 @@ if (empty($reshook))
// Extrafields
$array_options = array();
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
// trigger used
{
// For avoid conflicts if trigger used
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options;
}
@ -1419,8 +1418,9 @@ else
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->contrat->creer)
{
if ($action != 'classify')
if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
@ -2254,7 +2254,7 @@ $db->close();
if (! empty($conf->margin->enabled) && $action == 'editline')
{
// TODO Why this ? To manage margin on contracts ?
?>
?>
<script type="text/javascript">
$(document).ready(function() {
var idprod = $("input[name='idprod']").val();
@ -2309,5 +2309,5 @@ $(document).ready(function() {
}
});
</script>
<?php
<?php
}

View File

@ -9,7 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -706,8 +706,9 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['status']['checked']))
{
print '<td class="right">';
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
if ($obj->cstatut == 0)
{
// If contract is draft, we say line is also draft
print $contractstatic->LibStatut(0, 5);
}
else

View File

@ -23,11 +23,9 @@ if (empty($conf) || ! is_object($conf))
exit;
}
?>
<!-- BEGIN PHP TEMPLATE -->
print "<!-- BEGIN PHP TEMPLATE -->\n";
<?php
global $user;
global $noMoreLinkedObjectBlockAfter;
@ -45,7 +43,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
?>
<tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("Contract"); ?></td>
<td><?php echo $objectlink->getNomUrl(1); ?></td>
@ -65,8 +63,9 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($totalcontrat);
} ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td class="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="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php } ?>
<?php
}
<!-- END PHP TEMPLATE -->
print "<!-- END PHP TEMPLATE -->\n";

View File

@ -108,7 +108,6 @@ if ($action == 'update' && ! empty($permissiontoadd))
{
if (! GETPOSTISSET($key)) continue; // The field was not submited to be edited
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
var_dump($object->fields[$key]['type']);
// Set value to update
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
$value = GETPOST($key, 'none');

View File

@ -82,8 +82,8 @@ elseif (GETPOST('linkit', 'none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
$urlfile = GETPOST('urlfile', 'alpha', 0, null, null, 1); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
if (GETPOST('section', 'alpha')) // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir
{
if (GETPOST('section', 'alpha')) {
// For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir
$file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile;
}
else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
@ -94,8 +94,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
}
$linkid = GETPOST('linkid', 'int');
if ($urlfile) // delete of a file
{
if ($urlfile) {
// delete of a file
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette (if file is an image)
@ -118,8 +118,11 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
}
}
if ($ret) setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
}
}
elseif ($linkid) // delete of external link
{
@ -140,10 +143,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
}
}
if (is_object($object) && $object->id > 0)
{
if ($backtopage)
{
if (is_object($object) && $object->id > 0) {
if ($backtopage) {
header('Location: ' . $backtopage);
exit;
}

View File

@ -0,0 +1,182 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_boms.php
* \ingroup bom
* \brief Widget for latest modified BOM
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last orders
*/
class box_boms extends ModeleBoxes
{
public $boxcode="lastboms";
public $boximg="object_bom";
public $boxlabel="BoxTitleLatestModifiedBoms";
public $depends = array("bom");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param)
{
global $user;
$this->db = $db;
$this->hidden = ! ($user->rights->bom->read);
}
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$bomstatic = new Bom($this->db);
$productstatic = new Product($this->db);
$userstatic = new User($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatestModifiedBoms", $max));
if ($user->rights->bom->read)
{
$sql = "SELECT p.ref as product_ref";
$sql.= ", c.rowid";
$sql.= ", c.date_creation";
$sql.= ", c.tms";
$sql.= ", c.ref";
$sql.= ", c.status";
$sql.= ", c.fk_user_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ", ".MAIN_DB_PREFIX."bom_bom as c";
$sql.= " WHERE c.fk_product = p.rowid";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " ORDER BY c.tms DESC, c.ref DESC";
$sql.= " ".$this->db->plimit($max, 0);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$datem=$this->db->jdate($objp->tms);
$bomstatic->id = $objp->rowid;
$bomstatic->ref = $objp->ref;
$bomstatic->id = $objp->socid;
$bomstatic->status = $objp->status;
$productstatic->ref = $objp->product_ref;
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $bomstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $productstatic->getNomUrl(1),
'asis' => 1,
);
if (! empty($conf->global->BOM_BOX_LAST_BOMS_SHOW_VALIDATE_USER)) {
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
'asis' => 1,
);
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($datem, 'day'),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $bomstatic->LibStatut($objp->status, 3),
);
$line++;
}
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedOrders"));
$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/core/boxes/box_commandes.php
* \ingroup commande
* \brief Module de generation de l'affichage de la box commandes
* \brief Widget for latest sale orders
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';

View File

@ -86,7 +86,9 @@ class box_contacts extends ModeleBoxes
$sql.= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile, sp.email as spemail";
$sql.= ", s.nom as socname, s.name_alias, s.email as semail";
$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
$sql.= ", co.label as country, co.code as country_code";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON sp.fk_pays = co.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
@ -121,6 +123,8 @@ class box_contacts extends ModeleBoxes
$contactstatic->address = $objp->address;
$contactstatic->zip = $objp->zip;
$contactstatic->town = $objp->town;
$contactstatic->country = $objp->country;
$contactstatic->country_code = $objp->country_code;
$societestatic->id = $objp->fk_soc;
$societestatic->name = $objp->socname;

View File

@ -0,0 +1,182 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_mos.php
* \ingroup mrp
* \brief Widget for latest modified MOs
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last orders
*/
class box_mos extends ModeleBoxes
{
public $boxcode="lastmos";
public $boximg="object_mrp";
public $boxlabel="BoxTitleLatestModifiedMos";
public $depends = array("mrp");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param)
{
global $user;
$this->db = $db;
$this->hidden = ! ($user->rights->bom->read);
}
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$mostatic = new Mo($this->db);
$productstatic = new Product($this->db);
$userstatic = new User($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatestModifiedMos", $max));
if ($user->rights->mrp->read)
{
$sql = "SELECT p.ref as product_ref";
$sql.= ", c.rowid";
$sql.= ", c.date_creation";
$sql.= ", c.tms";
$sql.= ", c.ref";
$sql.= ", c.status";
//$sql.= ", c.fk_user_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ", ".MAIN_DB_PREFIX."mrp_mo as c";
$sql.= " WHERE c.fk_product = p.rowid";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " ORDER BY c.tms DESC, c.ref DESC";
$sql.= " ".$this->db->plimit($max, 0);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$datem=$this->db->jdate($objp->tms);
$mostatic->id = $objp->rowid;
$mostatic->ref = $objp->ref;
$mostatic->id = $objp->socid;
$mostatic->status = $objp->status;
$productstatic->ref = $objp->product_ref;
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $mostatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $productstatic->getNomUrl(1),
'asis' => 1,
);
if (! empty($conf->global->MRP_BOX_LAST_MOS_SHOW_VALIDATE_USER)) {
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
'asis' => 1,
);
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($datem, 'day'),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $mostatic->LibStatut($objp->status, 3),
);
$line++;
}
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedOrders"));
$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -12,7 +12,7 @@
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
* This program is free software; you can redistribute it and/or modify
@ -4612,14 +4612,14 @@ abstract class CommonObject
*/
protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams = null)
{
global $conf, $langs, $user, $hookmanager;
global $conf, $langs, $user, $hookmanager, $action;
$srctemplatepath='';
$parameters = array('modelspath'=>$modelspath,'modele'=>$modele,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'hidedesc'=>$hidedesc,'hideref'=>$hideref, 'moreparams'=>$moreparams);
$reshook = $hookmanager->executeHooks('commonGenerateDocument', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if(empty($reshook))
if (empty($reshook))
{
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs)?$outputlangs->defaultlang:'null'));
@ -4638,7 +4638,9 @@ abstract class CommonObject
}
// Search template files
$file=''; $classname=''; $filefound=0;
$file='';
$classname='';
$filefound=0;
$dirmodels=array('/');
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels, $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
@ -4778,8 +4780,7 @@ abstract class CommonObject
$setsharekey=true;
}
if ($setsharekey)
{
if ($setsharekey) {
if (empty($ecmfile->share)) // Because object not found or share not set yet
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
@ -4795,8 +4796,7 @@ abstract class CommonObject
$ecmfile->description = ''; // indexed content
$ecmfile->keyword = ''; // keyword content
$result = $ecmfile->update($user);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
}
}
@ -4814,8 +4814,7 @@ abstract class CommonObject
$ecmfile->src_object_id = $this->id;
$result = $ecmfile->create($user);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
}
}
@ -4834,9 +4833,9 @@ abstract class CommonObject
$sql.= ' WHERE rowid = '.$this->id;
$resql = $this->db->query($sql);
if (! $resql) dol_print_error($this->db);
else
{
if (! $resql) {
dol_print_error($this->db);
} else {
$this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename;
}
}
@ -6070,8 +6069,9 @@ abstract class CommonObject
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
}
}
if (empty($labeltoshow))
if (empty($labeltoshow)) {
$labeltoshow = '(not defined)';
}
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
$data[$obj->rowid]=$labeltoshow;

View File

@ -5835,10 +5835,11 @@ class Form
* @param string $moreparams More params provided to ajax call
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param int $disabled 1=Html component is disabled
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @return string Return HTML string
* @see selectForFormsList() select_thirdparty
*/
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0)
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '')
{
global $conf, $user;
@ -5870,20 +5871,28 @@ class Form
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
$out='';
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->$confkeyforautocompletemode) && ! $forcecombo)
{
// No immediate load of all database
$placeholder='';
if ($preselectedvalue && empty($selected_input_value))
{
$objecttmp->fetch($preselectedvalue);
$selected_input_value=($prefixforautocompletemode == 'company' ? $objecttmp->name : $objecttmp->ref);
//unset($objecttmp);
}
$objectdesc=$classname.':'.$classpath.':'.$addcreatebuttonornot.':'.$filter;
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
// No immediate load of all database
$urloption='htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.($moreparams?$moreparams:'');
$urloption='htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter).($moreparams?$moreparams:'');
// Activate the auto complete using ajax call.
$out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
$out.= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
if ($placeholder) $placeholder=' placeholder="'.$placeholder.'"';
$out.= '<input type="text" class="'.$morecss.'"'.($disabled?' disabled="disabled"':'').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
$out.= '<input type="text" class="'.$morecss.'"'.($disabled?' disabled="disabled"':'').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
}
else
{

View File

@ -76,10 +76,9 @@ class FormContract
if ($socid > 0)
{
// CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY))
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
$sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all')
{
} elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') {
$sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") ";
$sql.= " OR c.fk_soc IS NULL)";
}

View File

@ -41,9 +41,21 @@ class FormMail extends Form
*/
public $db;
public $withform; // 1=Include HTML form tag and show submit button, 0=Do not include form tag and submit button, -1=Do not include form tag but include submit button
/**
* @var int 1 = Include HTML form tag and show submit button
* 0 = Do not include form tag and submit button
* -1 = Do not include form tag but include submit button
*/
public $withform;
/**
* @var string name from
*/
public $fromname;
/**
* @var string email from
*/
public $frommail;
/**
@ -52,10 +64,15 @@ class FormMail extends Form
public $fromtype;
/**
* @var int ID
* @var int from ID
*/
public $fromid;
/**
* @var int also from robot
*/
public $fromalsorobot;
/**
* @var string thirdparty etc
*/
@ -66,10 +83,29 @@ class FormMail extends Form
*/
public $toid;
/**
* @var string replyto name
*/
public $replytoname;
/**
* @var string replyto email
*/
public $replytomail;
/**
* @var string to name
*/
public $toname;
/**
* @var string to email
*/
public $tomail;
/**
* @var string trackid
*/
public $trackid;
public $withsubstit; // Show substitution array

View File

@ -139,8 +139,7 @@ class Menubase
{
$sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
$resqlrowid=$this->db->query($sql);
if ($resqlrowid)
{
if ($resqlrowid) {
$obj=$this->db->fetch_object($resqlrowid);
$maxrowid=$obj->maxrowid;

View File

@ -220,8 +220,7 @@ class DoliDBMssql extends DoliDB
*/
public function close()
{
if ($this->db)
{
if ($this->db) {
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR);
$this->connected=false;
return mssql_close($this->db);

View File

@ -1135,13 +1135,16 @@ class DoliDBPgsql extends DoliDB
$sql .= " ".$field_desc['attribute'];
if (preg_match("/^[^\s]/i", $field_desc['null']))
$sql .= " ".$field_desc['null'];
if (preg_match("/^[^\s]/i", $field_desc['default']))
if (preg_match("/null/i", $field_desc['default']))
if (preg_match("/^[^\s]/i", $field_desc['default'])) {
if (preg_match("/null/i", $field_desc['default'])) {
$sql .= " default ".$field_desc['default'];
else
} else {
$sql .= " default '".$field_desc['default']."'";
if (preg_match("/^[^\s]/i", $field_desc['extra']))
}
}
if (preg_match("/^[^\s]/i", $field_desc['extra'])) {
$sql .= " ".$field_desc['extra'];
}
$sql .= " ".$field_position;
dol_syslog($sql, LOG_DEBUG);

View File

@ -1081,7 +1081,7 @@ function price2numjs(amount) {
<?php
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && ! defined('DISABLE_JQUERY_JNOTIFY')) {
?>
?>
// Defined properties for JNotify
$(document).ready(function() {
if (typeof $.jnotify == 'function')

View File

@ -670,7 +670,45 @@ function security_prepare_head()
return $head;
}
/**
* Prepare array with list of tabs
* @param object $object descriptor class
* @return array Array of tabs to show
*/
function modulehelp_prepare_head($object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
// FIX for compatibity habitual tabs
$object->id = $object->numero;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$object->id.'&mode=desc';
$head[$h][1] = $langs->trans("Description");
$head[$h][2] = 'desc';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$object->id.'&mode=feature';
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
$head[$h][2] = 'feature';
$h++;
if ($object->isCoreOrExternalModule() == 'external')
{
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$object->id.'&mode=changelog';
$head[$h][1] = $langs->trans("ChangeLog");
$head[$h][2] = 'changelog';
$h++;
}
complete_head_from_modules($conf, $langs, null, $head, $h, 'modulehelp_admin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'modulehelp_admin', 'remove');
return $head;
}
/**
* Prepare array with list of tabs
*

View File

@ -237,6 +237,7 @@ function show_array_actions_to_do($max = 5)
{
$num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo", $max).'</th>';
print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>';
@ -292,7 +293,7 @@ function show_array_actions_to_do($max = 5)
$i++;
}
print "</table><br>";
print "</table></div><br>";
$db->free($resql);
}
@ -334,6 +335,7 @@ function show_array_last_actions_done($max = 5)
{
$num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks", $max).'</th>';
print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>';
@ -380,7 +382,7 @@ function show_array_last_actions_done($max = 5)
}
// TODO Ajouter rappel pour "il y a des contrats a mettre en service"
// TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration"
print "</table><br>";
print "</table></div><br>";
$db->free($resql);
}

View File

@ -31,7 +31,7 @@
*
* @param string $selected Preselected value
* @param string $htmlname HTML name of input field
* @param string $url Url for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
* @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
* @param string $urloption More parameters on URL request
* @param int $minLength Minimum number of chars to trigger that Ajax search
* @param int $autoselect Automatic selection if just one value

View File

@ -1848,11 +1848,16 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
$count = $image->getNumberImages();
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
{
try {
$ret = $image->writeImages($fileoutput, true);
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_WARNING);
}
}
else
{
dol_syslog("Warning: Failed to write cache preview file '.$fileoutput.'. Check permission on file/dir", LOG_ERR);

View File

@ -835,7 +835,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$start = "{user_extra_";
$end = "\}";
$extra= get_string_between($mask, "user_extra_", "}");
if(!empty($user->array_options['options_'.$extra])){
if (!empty($user->array_options['options_'.$extra])) {
$mask = preg_replace('#('.$start.')(.*?)('.$end.')#si', $user->array_options['options_'.$extra], $mask);
}
}

View File

@ -137,7 +137,7 @@ function invoice_admin_prepare_head()
$head[$h][2] = 'payment';
$h++;
if($conf->global->INVOICE_USE_SITUATION){
if ($conf->global->INVOICE_USE_SITUATION) {
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';

View File

@ -1417,7 +1417,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
//print '>'.$outputlangs->charset_output.','.$period;
if(!empty($conf->global->ADD_HTML_FORMATING_INTO_DESC_DOC)){
$libelleproduitservice.= '<b style="color:#333666;" ><em>'."__N__</b> ".$period.'</em>';
}else{
} else {
$libelleproduitservice.="__N__".$period;
}
//print $libelleproduitservice;

View File

@ -313,8 +313,14 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
{
if (empty($user->rights->$feature->$subfeature->creer)
&& empty($user->rights->$feature->$subfeature->write)
&& empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
else { $createok=1; break; } // Break to bypass second test if the first is ok
&& empty($user->rights->$feature->$subfeature->create)) {
$createok=0;
$nbko++;
} else {
$createok=1;
// Break to bypass second test if the first is ok
break;
}
}
}
elseif (! empty($feature)) // This is for permissions on 2 levels ('creer' or 'write')
@ -322,7 +328,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
if (empty($user->rights->$feature->creer)
&& empty($user->rights->$feature->write)
&& empty($user->rights->$feature->create)) { $createok=0; $nbko++; }
&& empty($user->rights->$feature->create)) {
$createok=0;
$nbko++;
}
}
}

View File

@ -690,10 +690,10 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out.=$actionstatic->getNomUrl(1, -1).' ';
}
// if ($user->rights->agenda->allactions->read || $actionstatic->authorid == $user->id)
// {
// $out.='<a href="'.$url.'" class="timeline-btn" title="'.$langs->trans('Show').'" ><i class="fa fa-calendar" ></i>'.$langs->trans('Show').'</a>';
// }
//if ($user->rights->agenda->allactions->read || $actionstatic->authorid == $user->id)
//{
// $out.='<a href="'.$url.'" class="timeline-btn" title="'.$langs->trans('Show').'" ><i class="fa fa-calendar" ></i>'.$langs->trans('Show').'</a>';
//}
if ($user->rights->agenda->allactions->create ||
@ -723,10 +723,8 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out.="</span>\n";
// Ref
$out.='<h3 class="timeline-header">';
// Author of event
$out.='<span class="messaging-author">';
if ($histo[$key]['userid'] > 0)
@ -739,11 +737,9 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
}
$out.='</span>';
// Title
$out .= ' <span class="messaging-title">';
if($actionstatic->code == 'TICKET_MSG') {
$out .= $langs->trans('TicketNewMessage');
}

View File

@ -240,7 +240,6 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
// Load translation files required by the page
$langs->loadLangs(array('main', 'other', 'errors'));
;
$_SESSION["dol_loginmesg"]=($ldap->error?$ldap->error:$langs->trans("ErrorBadLoginPassword"));
}

View File

@ -307,10 +307,12 @@ class MenuManager
print $val2['titre'];
if ($relurl2)
{
if ($val2['enabled']) // Allowed
if ($val2['enabled']) {
// Allowed
print '</a>';
else
} else {
print '</a>';
}
}
print '</li>'."\n";
}
@ -448,7 +450,7 @@ class MenuManager
unset($this->menu->liste);
}
}
/*
/*
if ($mode == 'jmobile')
{
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
@ -506,7 +508,7 @@ class MenuManager
break; // Only first menu entry (so home)
}
}
*/
*/
unset($this->menu);
return $res;

View File

@ -49,7 +49,10 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $code_auto; // Automatic Numbering
/**
* @var int Automatic numbering
*/
public $code_auto;
public $searchcode; // Search string

View File

@ -0,0 +1,518 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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 <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
* \ingroup bom
* \brief File of class to build ODT documents for BOMs
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/bom/modules_bom.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
/**
* Class to build documents using ODF templates generator
*/
class doc_generic_bom_odt extends ModelePDFBOMs
{
/**
* Issuer
* @var Societe
*/
public $emetteur;
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.5 = array(5, 5)
*/
public $phpmin = array(5, 5);
/**
* @var string Dolibarr version of the loaded document
*/
public $version = 'dolibarr';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $conf, $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT templates";
$this->description = $langs->trans("DocumentModelOdt");
$this->scandir = 'BOM_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
// Page size for A4 format
$this->type = 'odt';
$this->page_largeur = 0;
$this->page_hauteur = 0;
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=0;
$this->marge_droite=0;
$this->marge_haute=0;
$this->marge_basse=0;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
// Recupere emetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
}
/**
* Return description of a module
*
* @param Translate $langs Lang object to use for output
* @return string Description
*/
public function info($langs)
{
global $conf,$langs;
// Load translation files required by the page
$langs->loadLangs(array("errors","companies"));
$form = new Form($this->db);
$texte = $this->description.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="BOM_ADDON_PDF_ODT_PATH">';
$texte.= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte.= '<tr><td>';
$texttitle=$langs->trans("ListOfDirectories");
$listofdir=explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->BOM_ADDON_PDF_ODT_PATH)));
$listoffiles=array();
foreach($listofdir as $key=>$tmpdir)
{
$tmpdir=trim($tmpdir);
$tmpdir=preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (! $tmpdir) {
unset($listofdir[$key]); continue;
}
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
else
{
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
}
}
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
// Add list of substitution keys
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->BOM_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '<br></div></div>';
// Scan directories
$nbofiles=count($listoffiles);
if (! empty($conf->global->BOM_ADDON_PDF_ODT_PATH))
{
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$texte.=count($listoffiles);
//$texte.=$nbofiles?'</a>':'';
$texte.='</b>';
}
if ($nbofiles)
{
$texte.='<div id="div_'.get_class($this).'" class="hidden">';
foreach($listoffiles as $file)
{
$texte.=$file['name'].'<br>';
}
$texte.='<div id="div_'.get_class($this).'">';
}
$texte.= '</td>';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
$texte.= '</table>';
$texte.= '</form>';
return $texte;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
* @param Commande $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
return -1;
}
// Add odtgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
if ($conf->commande->dir_output)
{
// If $object is id instead of object
if (! is_object($object))
{
$id = $object;
$object = new Commande($this->db);
$result=$object->fetch($id);
if ($result < 0)
{
dol_print_error($this->db, $object->error);
return -1;
}
}
$dir = $conf->commande->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref);
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
if (file_exists($dir))
{
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
$newfiletmp=preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp=preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp=preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp=$objectref.'_'.$newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
}
else
{
$filename=$newfiletmp.'.'.$newfileformat;
}
$file=$dir.'/'.$filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
dol_mkdir($conf->bom->dir_temp);
// If CUSTOMER contact defined on order, we use it
$usecontact=false;
$arrayidcontact=$object->getIdContact('external', 'CUSTOMER');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
$contactobject=null;
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{
$socobject=$object->thirdparty;
}
// Make substitution
$substitutionarray=array(
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Line of free text
$newfreetext='';
$paramfreetext='ORDER_FREE_TEXT';
if (! empty($conf->global->$paramfreetext))
{
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray);
}
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
$odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->commande->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
)
);
}
catch(Exception $e)
{
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
// After construction $odfHandler->contentXml contains content and
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
// [!-- BEGIN lines --]*[!-- END lines --]
//print html_entity_decode($odfHandler->__toString());
//print exit;
// Make substitutions into odt of freetext
try {
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
// Define substitution array
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
$array_objet=$this->get_substitutionarray_object($object, $outputlangs);
$array_user=$this->get_substitutionarray_user($user, $outputlangs);
$array_soc=$this->get_substitutionarray_mysoc($mysoc, $outputlangs);
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject, $outputlangs);
$array_other=$this->get_substitutionarray_other($outputlangs);
// retrieve contact information for use in object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
$tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key=>$value)
{
try {
if (preg_match('/logo$/', $key)) // Image
{
if (file_exists($value)) $odfHandler->setImage($key, $value);
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
else // Text
{
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
// Replace tags of lines
try
{
$foundtagforlines = 1;
try {
$listlines = $odfHandler->setSegment('lines');
}
catch(OdfException $e)
{
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
if ($foundtagforlines)
{
foreach ($object->lines as $line)
{
$tmparray=$this->get_substitutionarray_lines($line, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
// Call the ODTSubstitutionLine hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key => $val)
{
try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
catch(SegmentException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
}
}
catch(OdfException $e)
{
$this->error=$e->getMessage();
dol_syslog($this->error, LOG_WARNING);
return -1;
}
// Replace labels translated
$tmparray=$outputlangs->get_translations_for_substitutions();
foreach($tmparray as $key=>$value)
{
try {
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
// Call the beforeODTSave hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Write new file
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
try {
$odfHandler->exportAsAttachedPDF($file);
}catch (Exception $e){
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
else {
try {
$odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file);
return 1; // Success
}
else
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
return -1;
}
}

View File

@ -23,7 +23,7 @@
/**
* \file htdocs/core/modules/bom/mod_bom_advanced.php
* \ingroup bom
* \brief File containing class for numbering model of bom advanced
* \brief File containing class for numbering model of BOMs advanced
*/
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php';

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/core/modules/bom/mod_bom_standard.php
* \ingroup bom
* \brief File of class to manage customer order numbering rules standard
* \brief File of class to manage BOMs numbering rules standard
*/
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php';

View File

@ -52,7 +52,7 @@ abstract class ModelePDFBoms extends CommonDocGenerator
// phpcs:enable
global $conf;
$type = 'order';
$type = 'bom';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

View File

@ -952,8 +952,6 @@ class pdf_einstein extends ModelePDFCommandes
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);

View File

@ -7,7 +7,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -1107,7 +1107,6 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($tvakey!=0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@ -1139,8 +1138,6 @@ class pdf_eratosthene extends ModelePDFCommandes
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);

View File

@ -53,6 +53,9 @@ class mod_contract_magre extends ModelNumRefContracts
*/
public $name='Magre';
/**
* @var int Automatic numbering
*/
public $code_auto=1;
/**

View File

@ -58,7 +58,10 @@ class mod_contract_olive extends ModelNumRefContracts
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $code_auto = 0; // Numerotation automatique
/**
* @var int Automatic numbering
*/
public $code_auto = 0;
/**

View File

@ -53,6 +53,9 @@ class mod_contract_serpis extends ModelNumRefContracts
*/
public $name='Serpis';
/**
* @var int Automatic numbering
*/
public $code_auto=1;

View File

@ -324,8 +324,7 @@ class html_cerfafr extends ModeleDon
if ($unite[$i]==1) {
$secon[$i]='vingt et';
$prim[$i]=$chif[$unite[$i]];
}
else {
} else {
$secon[$i]='vingt';
$prim[$i]=$chif[$unite[$i]];
}
@ -334,8 +333,7 @@ class html_cerfafr extends ModeleDon
if ($unite[$i]==1) {
$secon[$i]='trente et';
$prim[$i]=$chif[$unite[$i]];
}
else {
} else {
$secon[$i]='trente';
$prim[$i]=$chif[$unite[$i]];
}

View File

@ -218,10 +218,9 @@ class pdf_rouget extends ModelePdfExpedition
$realpath='';
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
{
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
{
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) {
// If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
if ($obj['photo_vignette'])
{
$filename= $obj['photo_vignette'];

View File

@ -139,19 +139,19 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
$result = $db->query($sql);
if($db->num_rows($result) > 0):
if ($db->num_rows($result) > 0) {
$objp = $db->fetch_object($result);
$newref = $objp->max;
$newref++;
while(strlen($newref) < $num_car):
while (strlen($newref) < $num_car) {
$newref = "0".$newref;
endwhile;
else:
}
} else {
$newref = 1;
while(strlen($newref) < $num_car):
while (strlen($newref) < $num_car) {
$newref = "0".$newref;
endwhile;
endif;
}
}
$ref_number_int = ($newref+1)-1;

View File

@ -1271,8 +1271,7 @@ class pdf_crabe extends ModelePDFFactures
//Local tax 1 after VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
foreach($this->localtax1 as $localtax_type => $localtax_rate)
{
foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
foreach($localtax_rate as $tvakey => $tvaval)

View File

@ -371,7 +371,7 @@ class pdf_sponge extends ModelePDFFactures
// Does we have at least one line with discount $this->atleastonediscount
foreach ($object->lines as $line) {
if ($line->remise_percent){
if ($line->remise_percent) {
$this->atleastonediscount = true;
break;
}
@ -769,10 +769,12 @@ class pdf_sponge extends ModelePDFFactures
}
// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0)
if ($localtax1_type && $localtax1ligne != 0) {
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2_type && $localtax2ligne != 0)
}
if ($localtax2_type && $localtax2ligne != 0) {
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
@ -781,8 +783,7 @@ class pdf_sponge extends ModelePDFFactures
$nexY = max($nexY, $posYAfterImage);
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
{
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
//$pdf->SetDrawColor(190,190,200);
@ -793,11 +794,9 @@ class pdf_sponge extends ModelePDFFactures
$nexY+=2; // Add space between lines
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
while ($pagenb < $pageposafter) {
$pdf->setPage($pagenb);
if ($pagenb == $pageposbeforeprintlines)
{
if ($pagenb == $pageposbeforeprintlines) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
}
else
@ -811,10 +810,8 @@ class pdf_sponge extends ModelePDFFactures
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == $pageposafter)
{
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) {
if ($pagenb == $pageposafter) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
}
else
@ -1266,14 +1263,11 @@ class pdf_sponge extends ModelePDFFactures
$deja_paye = 0;
$i = 1;
if(!empty($TPreviousIncoice)){
if (!empty($TPreviousIncoice)) {
$pdf->setY($tab2_top);
$posy = $pdf->GetY();
foreach ($TPreviousIncoice as &$fac){
foreach ($TPreviousIncoice as &$fac) {
if($posy > $this->page_hauteur - 4 ) {
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage();
@ -1290,7 +1284,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col2x, $posy);
$facSign = '';
if($i>1){
if ($i>1) {
$facSign = $fac->total_ht>=0?'+':'';
}
@ -1312,11 +1306,11 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col2x, $posy);
$facSign = '';
if($i>1){
if ($i>1) {
$facSign = $object->total_ht>=0?'+':''; // management of a particular customer case
}
if($fac->type === facture::TYPE_CREDIT_NOTE){
if ($fac->type === facture::TYPE_CREDIT_NOTE) {
$facSign = '-'; // les avoirs
}
@ -1453,8 +1447,6 @@ class pdf_sponge extends ModelePDFFactures
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@ -1473,7 +1465,6 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
// VAT

View File

@ -502,7 +502,7 @@ class pdf_soleil extends ModelePDFFicheinter
$default_font_size = pdf_getPDFFontSize($outputlangs);
/*
/*
$pdf->SetXY($this->marge_gauche, $tab_top);
$pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0);
$pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8);
@ -526,7 +526,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY);
$pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
*/
*/
// Output Rect
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+1, 0, 0); // Rect takes a length in 3rd parameter and 4th parameter

View File

@ -53,6 +53,9 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
*/
public $name='Immaculate';
/**
* @var int Automatic numbering
*/
public $code_auto=1;
/**

View File

@ -54,6 +54,9 @@ class mod_holiday_madonna extends ModelNumRefHolidays
*/
public $name='Madonna';
/**
* @var int Automatic numbering
*/
public $code_auto=1;

View File

@ -255,7 +255,9 @@ class mailing_fraise extends MailingTargets
$sql.= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$this->db->escape($mailing_id).")";
// Filter on status
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') {
$sql.= " AND a.statut=-1";
}
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND a.statut=0";

View File

@ -291,8 +291,7 @@ class mailing_thirdparties extends MailingTargets
$s.= $langs->trans('ProspectCustomer');
$s.=': <select name="filter_client" class="flat">';
$s.= '<option value="-1">&nbsp;</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$s.= '<option value="2">'.$langs->trans('Prospect').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
@ -303,14 +302,14 @@ class mailing_thirdparties extends MailingTargets
}
$s.= '<option value="0">'.$langs->trans('NorProspectNorCustomer').'</option>';
$s.='</select> ';
$s.= '</select> ';
$s.=$langs->trans("Status");
$s.=': <select name="filter_status" class="flat">';
$s.='<option value="-1">&nbsp;</option>';
$s.='<option value="1" selected>'.$langs->trans("Enabled").'</option>';
$s.='<option value="0">'.$langs->trans("Disabled").'</option>';
$s.='</select>';
$s.= $langs->trans("Status");
$s.= ': <select name="filter_status" class="flat">';
$s.= '<option value="-1">&nbsp;</option>';
$s.= '<option value="1" selected>'.$langs->trans("Enabled").'</option>';
$s.= '<option value="0">'.$langs->trans("Disabled").'</option>';
$s.= '</select>';
return $s;
}

Some files were not shown because too many files have changed in this diff Show More