Merge remote-tracking branch 'upstream/develop' into socialnetworks
This commit is contained in:
commit
f7747ed00a
@ -61,8 +61,8 @@ $user->getrights();
|
||||
$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++; }
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; }
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
|
||||
@ -64,22 +64,34 @@ $user->getrights();
|
||||
$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++; }
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
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"; }
|
||||
|
||||
|
||||
|
||||
@ -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" />
|
||||
|
||||
|
||||
@ -149,9 +149,9 @@ foreach ($langstrings_3d AS $filename => $file)
|
||||
$keys = array_keys($langstrings_full, $value);
|
||||
if (count($keys)>1)
|
||||
{
|
||||
foreach ($keys AS $key) {
|
||||
$dups[$value][$filename][$linenum] = trim($langstrings_3dtrans[$filename][$linenum]);
|
||||
}
|
||||
foreach ($keys AS $key) {
|
||||
$dups[$value][$filename][$linenum] = trim($langstrings_3dtrans[$filename][$linenum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -2177,6 +2177,10 @@ class Adherent extends CommonObject
|
||||
global $langs;
|
||||
$langs->load("members");
|
||||
|
||||
$statusType = '';
|
||||
$labelstatut = '';
|
||||
$labelstatutShort = '';
|
||||
|
||||
if ($statut == -1)
|
||||
{
|
||||
$statusType = 'status0';
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&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&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&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>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -148,12 +148,12 @@ if (! empty($conf->stock->enabled))
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
|
||||
print '<td colspan="2">';
|
||||
if (empty($conf->productbatch->enabled)) {
|
||||
print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1);
|
||||
print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
|
||||
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
print $langs->trans("Yes").'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';
|
||||
|
||||
@ -194,9 +194,9 @@ class Facturation
|
||||
{
|
||||
if ($poscart[$key]['id'] != $aArticle)
|
||||
{
|
||||
$newposcart[$j]=$poscart[$key];
|
||||
$newposcart[$j]['id']=$j;
|
||||
$j++;
|
||||
$newposcart[$j]=$poscart[$key];
|
||||
$newposcart[$j]['id']=$j;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
unset($poscart);
|
||||
|
||||
@ -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'] )
|
||||
$selected = 'selected';
|
||||
else
|
||||
$selected = '';
|
||||
for ($i = 0; $i < $nbtoshow; $i++)
|
||||
{
|
||||
if ($id == $tab_designations[$i]['rowid']) {
|
||||
$selected = 'selected';
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
|
||||
$label = $tab_designations[$i]['label'];
|
||||
$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";
|
||||
}
|
||||
?>
|
||||
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";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -85,7 +85,7 @@ $object->fetch($facid);
|
||||
for($i=0;$i < $tab_size;$i++)
|
||||
{
|
||||
$remise = $tab[$i]['remise'];
|
||||
?>
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $tab[$i]['ref'];?></td>
|
||||
<td><?php echo $tab[$i]['label'];?></td>
|
||||
@ -93,7 +93,7 @@ $object->fetch($facid);
|
||||
<td><?php echo $tab[$i]['remise_percent'];?></td>
|
||||
<td class="total"><?php echo price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency);?></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@ -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() ) {
|
||||
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
|
||||
{
|
||||
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.$langs->trans("NoVAT").'</td></tr>');
|
||||
}
|
||||
?>
|
||||
<?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
|
||||
{
|
||||
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' ) {
|
||||
echo ('<tr><td class="resume_label">'.$langs->trans("DateDue").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
|
||||
} 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>');
|
||||
}
|
||||
<?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 {
|
||||
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() ) {
|
||||
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>');
|
||||
}
|
||||
// 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>
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ if ($id > 0 && $action!='add') {
|
||||
$ret1 = $object->fetch_userassigned();
|
||||
}
|
||||
if ($ret < 0 || $ret1 < 0) {
|
||||
dol_print_error('', $object->error);
|
||||
dol_print_error('', $object->error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1582,19 +1582,20 @@ 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')
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -484,9 +484,9 @@ class ActionComm extends CommonObject
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1043,7 +1043,7 @@ class ActionComm extends CommonObject
|
||||
return $resarray;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ class ICal
|
||||
return $temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,14 +519,14 @@ if (! empty($actioncode))
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if (is_array($actioncode))
|
||||
{
|
||||
if (is_array($actioncode))
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", $actioncode)."')";
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1729,11 +1729,24 @@ function dol_color_minus($color, $minus, $minusunit = 16)
|
||||
*/
|
||||
function sort_events_by_date($a, $b)
|
||||
{
|
||||
if($a->datep != $b->datep)
|
||||
{
|
||||
return $a->datep - $b->datep;
|
||||
}
|
||||
if($a->datep != $b->datep)
|
||||
{
|
||||
return $a->datep - $b->datep;
|
||||
}
|
||||
|
||||
// If both events have the same start time, longest first
|
||||
return $b->datef - $a->datef;
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -41,8 +41,8 @@ $id = GETPOST('id', 'int');
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||
|
||||
@ -702,15 +702,15 @@ if ($resql)
|
||||
|
||||
// Linked object
|
||||
if (! empty($arrayfields['a.fk_element']['checked'])) {
|
||||
print '<td>';
|
||||
//var_dump($obj->fkelement.' '.$obj->elementtype);
|
||||
if ($obj->fk_element > 0 && ! empty($obj->elementtype)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1);
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
//var_dump($obj->fkelement.' '.$obj->elementtype);
|
||||
if ($obj->fk_element > 0 && ! empty($obj->elementtype)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1);
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
|
||||
@ -418,14 +418,14 @@ if (! empty($actioncode))
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if (is_array($actioncode))
|
||||
{
|
||||
if (is_array($actioncode))
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", $actioncode)."')";
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -683,16 +683,16 @@ while($currentdaytoshow<$lastdaytoshow) {
|
||||
{
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
// Get all assigned users for each event
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$event->fetch_userassigned();
|
||||
// Get all assigned users for each event
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$event->fetch_userassigned();
|
||||
$listofuserid=$event->userassigned;
|
||||
foreach($listofuserid as $userid => $tmp)
|
||||
{
|
||||
if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Use this list to have for all users */
|
||||
|
||||
@ -565,7 +565,7 @@ if ($object->id > 0)
|
||||
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'</a>';
|
||||
}
|
||||
print '</div></td></tr>';
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
@ -1297,8 +1297,8 @@ if ($object->id > 0)
|
||||
{
|
||||
if ($object->client != 0 && $object->client != 2)
|
||||
{
|
||||
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
|
||||
@ -59,13 +59,13 @@ llxHeader('', $langs->trans("Contacts"));
|
||||
|
||||
if ($type == "c" || $type == "p")
|
||||
{
|
||||
$label = $langs->trans("Customers");
|
||||
$urlfiche="card.php";
|
||||
$label = $langs->trans("Customers");
|
||||
$urlfiche="card.php";
|
||||
}
|
||||
if ($type == "f")
|
||||
{
|
||||
$label = $langs->trans("Suppliers");
|
||||
$urlfiche="card.php";
|
||||
$label = $langs->trans("Suppliers");
|
||||
$urlfiche="card.php";
|
||||
}
|
||||
|
||||
/*
|
||||
@ -88,29 +88,29 @@ if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
if (dol_strlen($stcomm))
|
||||
{
|
||||
$sql.= " AND s.fk_stcomm=".$db->escape($stcomm);
|
||||
$sql.= " AND s.fk_stcomm=".$db->escape($stcomm);
|
||||
}
|
||||
|
||||
if (! empty($search_lastname))
|
||||
{
|
||||
$sql.= " AND p.name LIKE '%".$db->escape($search_lastname)."%'";
|
||||
$sql.= " AND p.name LIKE '%".$db->escape($search_lastname)."%'";
|
||||
}
|
||||
|
||||
if (! empty($search_firstname))
|
||||
{
|
||||
$sql.= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
||||
$sql.= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
||||
}
|
||||
|
||||
if (! empty($search_company))
|
||||
{
|
||||
$sql.= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
|
||||
$sql.= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
|
||||
}
|
||||
|
||||
if (! empty($contactname)) // acces a partir du module de recherche
|
||||
{
|
||||
$sql.= " AND (p.name LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') ";
|
||||
$sortfield = "p.name";
|
||||
$sortorder = "ASC";
|
||||
$sql.= " AND (p.name LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') ";
|
||||
$sortfield = "p.name";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -851,7 +851,7 @@ else
|
||||
setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
|
||||
if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it.
|
||||
{
|
||||
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant...
|
||||
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant...
|
||||
}
|
||||
$_GET["action"]='';
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ if (is_resource($handle))
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -9,10 +9,10 @@
|
||||
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* 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) 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-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
|
||||
@ -166,7 +166,7 @@ if (empty($reshook))
|
||||
if ($object->id > 0) {
|
||||
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) {
|
||||
//Get difference between old and new delivery date and change lines according to difference
|
||||
$date_delivery = dol_mktime(12, 0, 0,
|
||||
$date_delivery = dol_mktime(12, 0, 0,
|
||||
GETPOST('date_deliverymonth', 'int'),
|
||||
GETPOST('date_deliveryday', 'int'),
|
||||
GETPOST('date_deliveryyear', 'int')
|
||||
@ -174,7 +174,7 @@ if (empty($reshook))
|
||||
if (!empty($object->date_livraison) && !empty($date_delivery))
|
||||
{
|
||||
//Attempt to get the date without possible hour rounding errors
|
||||
$old_date_delivery = dol_mktime(12, 0, 0,
|
||||
$old_date_delivery = dol_mktime(12, 0, 0,
|
||||
dol_print_date($object->date_livraison, '%m'),
|
||||
dol_print_date($object->date_livraison, '%d'),
|
||||
dol_print_date($object->date_livraison, '%Y')
|
||||
@ -459,91 +459,91 @@ if (empty($reshook))
|
||||
$id = $object->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||
|
||||
$classname = ucfirst($subelement);
|
||||
$srcobject = new $classname($db);
|
||||
$classname = ucfirst($subelement);
|
||||
$srcobject = new $classname($db);
|
||||
|
||||
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
|
||||
if ($result > 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$lines = $srcobject->lines;
|
||||
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
|
||||
{
|
||||
$srcobject->fetch_lines();
|
||||
$lines = $srcobject->lines;
|
||||
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
|
||||
{
|
||||
$srcobject->fetch_lines();
|
||||
$lines = $srcobject->lines;
|
||||
}
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
|
||||
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
|
||||
// Positive line
|
||||
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
||||
|
||||
// Date start
|
||||
$date_start = false;
|
||||
if ($lines[$i]->date_debut_prevue)
|
||||
$date_start = $lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel)
|
||||
$date_start = $lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start)
|
||||
$date_start = $lines[$i]->date_start;
|
||||
|
||||
// Date end
|
||||
$date_end = false;
|
||||
if ($lines[$i]->date_fin_prevue)
|
||||
$date_end = $lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel)
|
||||
$date_end = $lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end)
|
||||
$date_end = $lines[$i]->date_end;
|
||||
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
||||
$lines[$i]->fetch_optionals();
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$tva_tx = $lines[$i]->tva_tx;
|
||||
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
|
||||
|
||||
if ($result > 0) {
|
||||
$lineid = $result;
|
||||
} else {
|
||||
$lineid = 0;
|
||||
$error ++;
|
||||
break;
|
||||
}
|
||||
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $lines[$i]->product_type == 9) {
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
$error ++;
|
||||
} else {
|
||||
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
|
||||
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
|
||||
// Positive line
|
||||
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
||||
|
||||
// Date start
|
||||
$date_start = false;
|
||||
if ($lines[$i]->date_debut_prevue)
|
||||
$date_start = $lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel)
|
||||
$date_start = $lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start)
|
||||
$date_start = $lines[$i]->date_start;
|
||||
|
||||
// Date end
|
||||
$date_end = false;
|
||||
if ($lines[$i]->date_fin_prevue)
|
||||
$date_end = $lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel)
|
||||
$date_end = $lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end)
|
||||
$date_end = $lines[$i]->date_end;
|
||||
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
||||
$lines[$i]->fetch_optionals();
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$tva_tx = $lines[$i]->tva_tx;
|
||||
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
|
||||
|
||||
if ($result > 0) {
|
||||
$lineid = $result;
|
||||
} else {
|
||||
$lineid = 0;
|
||||
$error ++;
|
||||
break;
|
||||
}
|
||||
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $lines[$i]->product_type == 9) {
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
$error ++;
|
||||
} else {
|
||||
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
@ -920,8 +920,8 @@ if (empty($reshook))
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
@ -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);
|
||||
|
||||
@ -227,7 +227,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
$result = array();
|
||||
@ -255,7 +255,7 @@ class Proposals extends DolibarrApi
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (! $result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
|
||||
@ -1714,9 +1714,9 @@ class Propal extends CommonObject
|
||||
|
||||
// multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
}
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
@ -3403,7 +3403,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
$prodid = mt_rand(1, $num_prods);
|
||||
$line->fk_product=$prodids[$prodid];
|
||||
$line->product_ref='SPECIMEN';
|
||||
$line->product_ref='SPECIMEN';
|
||||
}
|
||||
|
||||
$this->lines[$xnbp]=$line;
|
||||
@ -3919,7 +3919,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
|
||||
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
|
||||
@ -170,20 +170,21 @@ if ($object->id > 0)
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -125,20 +125,21 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
$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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -86,20 +86,21 @@ if (! empty($conf->projet->enabled))
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -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
|
||||
@ -693,7 +695,7 @@ if ($resql)
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date cloture
|
||||
// Date cloture
|
||||
if (! empty($arrayfields['p.date_cloture']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
|
||||
@ -101,20 +101,21 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
$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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -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.'&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
|
||||
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-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);
|
||||
}
|
||||
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";
|
||||
|
||||
@ -34,8 +34,8 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||
$socid = $_GET["socid"];
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@ if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||
$socid = $_GET["socid"];
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -1315,33 +1315,33 @@ if ($resql)
|
||||
// Date ope
|
||||
if (! empty($arrayfields['b.dateo']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
|
||||
print ' ';
|
||||
print '<span class="inline-block">';
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=doprev&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=donext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_add() ."</a>";
|
||||
print '</span>';
|
||||
print "</td>\n";
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
|
||||
print ' ';
|
||||
print '<span class="inline-block">';
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=doprev&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=donext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_add() ."</a>";
|
||||
print '</span>';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date value
|
||||
if (! empty($arrayfields['b.datev']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv), "day")."</span>";
|
||||
print ' ';
|
||||
print '<span class="inline-block">';
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_add() ."</a>";
|
||||
print '</span>';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv), "day")."</span>";
|
||||
print ' ';
|
||||
print '<span class="inline-block">';
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_add() ."</a>";
|
||||
print '</span>';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Payment type
|
||||
@ -1352,7 +1352,7 @@ if ($resql)
|
||||
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
||||
else print $labeltype;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Num cheque
|
||||
|
||||
@ -1360,10 +1360,10 @@ class Account extends CommonObject
|
||||
$linkstart = '<a href="'.$url.$linkclose;
|
||||
$linkend = '</a>';
|
||||
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '';
|
||||
$linkend = '';
|
||||
}
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '';
|
||||
$linkend = '';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
@ -1600,8 +1600,8 @@ class Account extends CommonObject
|
||||
//Replace the old AccountNumber key with the new BankAccountNumber key
|
||||
$fieldlists = explode(
|
||||
' ',
|
||||
preg_replace('/ ?[^Bank]AccountNumber ?/', 'BankAccountNumber',
|
||||
$conf->global->BANK_SHOW_ORDER_OPTION)
|
||||
preg_replace('/ ?[^Bank]AccountNumber ?/', 'BankAccountNumber',
|
||||
$conf->global->BANK_SHOW_ORDER_OPTION)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print "</div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -427,19 +427,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -92,19 +92,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -61,19 +61,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -415,9 +415,9 @@ elseif ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Confirm delete trip
|
||||
*/
|
||||
/*
|
||||
* Confirm delete trip
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete");
|
||||
|
||||
@ -89,11 +89,11 @@ class Deplacement extends CommonObject
|
||||
public $statuts=array();
|
||||
public $statuts_short=array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
@ -249,13 +249,13 @@ class Deplacement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from database
|
||||
*
|
||||
* @param int $id Id of record to load
|
||||
* @param string $ref Ref of record
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
/**
|
||||
* Load an object from database
|
||||
*
|
||||
* @param int $id Id of record to load
|
||||
* @param string $ref Ref of record
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = '')
|
||||
{
|
||||
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams";
|
||||
@ -293,12 +293,12 @@ class Deplacement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param int $id Id of record to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param int $id Id of record to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$this->db->begin();
|
||||
@ -413,9 +413,9 @@ class Deplacement extends CommonObject
|
||||
*/
|
||||
public function listOfTypes($active = 1)
|
||||
{
|
||||
global $langs;
|
||||
global $langs;
|
||||
|
||||
$ret=array();
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT id, code, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees";
|
||||
|
||||
@ -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
|
||||
@ -809,14 +809,16 @@ if (empty($reshook))
|
||||
|
||||
// Total credit note and deposit
|
||||
$total_creditnote_and_deposit = 0;
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql .= " re.description, re.fk_facture_source";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
|
||||
$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;
|
||||
} else dol_print_error($db);
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql .= " re.description, re.fk_facture_source";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
|
||||
$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;
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
|
||||
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc;
|
||||
$discount->amount_tva = 0;
|
||||
@ -1516,7 +1518,7 @@ if (empty($reshook))
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
|
||||
|
||||
$result = $object->addline(
|
||||
$result = $object->addline(
|
||||
$desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except,
|
||||
'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid,
|
||||
@ -2726,7 +2728,7 @@ if ($action == 'create')
|
||||
$text.=' '.$langs->trans("ToCreateARecurringInvoiceGene", $langs->transnoentitiesnoconv("MenuFinancial"), $langs->transnoentitiesnoconv("BillsCustomers"), $langs->transnoentitiesnoconv("ListOfTemplates"));
|
||||
if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE))
|
||||
{
|
||||
$text.=' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
|
||||
$text.=' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
|
||||
}
|
||||
print info_admin($text, 0, 0, 0).'<br>';
|
||||
}
|
||||
@ -3274,12 +3276,12 @@ 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
|
||||
$paramkey='FACTURE_ADDON_PDF_'.$object->type;
|
||||
$curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF;
|
||||
}
|
||||
else{
|
||||
$curent = $conf->global->FACTURE_ADDON_PDF;
|
||||
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 {
|
||||
$curent = $conf->global->FACTURE_ADDON_PDF;
|
||||
}
|
||||
print $form->selectarray('model', $liste, $curent);
|
||||
print "</td></tr>";
|
||||
@ -3803,19 +3805,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -415,7 +415,7 @@ class Invoices extends DolibarrApi
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Delete a contact type of given invoice
|
||||
*
|
||||
* @param int $id Id of invoice to update
|
||||
@ -529,10 +529,9 @@ class Invoices extends DolibarrApi
|
||||
// update bank account
|
||||
if (!empty($this->invoice->fk_account))
|
||||
{
|
||||
if($this->invoice->setBankAccount($this->invoice->fk_account) == 0)
|
||||
{
|
||||
throw new RestException(400, $this->invoice->error);
|
||||
}
|
||||
if ($this->invoice->setBankAccount($this->invoice->fk_account) == 0) {
|
||||
throw new RestException(400, $this->invoice->error);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->invoice->update(DolibarrApiAccess::$user))
|
||||
@ -909,18 +908,18 @@ 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);
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Create a discount (credit available) for a credit note or a deposit.
|
||||
*
|
||||
* @param int $id Invoice ID
|
||||
|
||||
@ -862,10 +862,10 @@ class Facture extends CommonInvoice
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CREATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CREATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -1605,9 +1605,9 @@ class Facture extends CommonInvoice
|
||||
|
||||
// multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
}
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
@ -2545,7 +2545,7 @@ class Facture extends CommonInvoice
|
||||
if (empty($final)) $this->situation_final = 0;
|
||||
else $this->situation_final = 1;
|
||||
|
||||
$this->setFinal($user);
|
||||
$this->setFinal($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
$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);
|
||||
$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
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@ -163,20 +163,21 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
$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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -1242,19 +1242,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -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
|
||||
@ -513,68 +514,68 @@ if ($resql)
|
||||
|
||||
if (! empty($arrayfields['f.titre']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $invoicerectmp->getNomUrl(1);
|
||||
print "</a>";
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td>';
|
||||
print $invoicerectmp->getNomUrl(1);
|
||||
print "</a>";
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.total']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total';
|
||||
$totalarray['val']['f.total'] += $objp->total;
|
||||
print '<td class="right">'.price($objp->total).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total';
|
||||
$totalarray['val']['f.total'] += $objp->total;
|
||||
}
|
||||
if (! empty($arrayfields['f.tva']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total_vat).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.tva';
|
||||
$totalarray['val']['f.tva'] += $objp->total_vat;
|
||||
print '<td class="right">'.price($objp->total_vat).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.tva';
|
||||
$totalarray['val']['f.tva'] += $objp->total_vat;
|
||||
}
|
||||
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
|
||||
$totalarray['val']['f.total_ttc'] += $objp->total_ttc;
|
||||
print '<td class="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
|
||||
$totalarray['val']['f.total_ttc'] += $objp->total_ttc;
|
||||
}
|
||||
// Payment term
|
||||
if (! empty($arrayfields['f.fk_cond_reglement']['checked']))
|
||||
{
|
||||
print '<td class="right">';
|
||||
print $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td class="right">';
|
||||
print $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Payment mode
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
print '<td class="right">';
|
||||
print $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td class="right">';
|
||||
print $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['recurring']['checked']))
|
||||
{
|
||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.frequency']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($objp->frequency > 0 ? $objp->frequency : '').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center">'.($objp->frequency > 0 ? $objp->frequency : '').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.unit_frequency']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($objp->frequency > 0 ? $objp->unit_frequency : '').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center">'.($objp->frequency > 0 ? $objp->unit_frequency : '').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
||||
{
|
||||
@ -586,10 +587,10 @@ if ($resql)
|
||||
// Date last generation
|
||||
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date next generation
|
||||
if (! empty($arrayfields['f.date_when']['checked']))
|
||||
@ -611,17 +612,17 @@ if ($resql)
|
||||
}
|
||||
if (! empty($arrayfields['f.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->datec), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->datec), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->tms), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->tms), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$obj = $objp;
|
||||
@ -632,12 +633,11 @@ 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']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $invoicerectmp->getLibStatut(3, 0);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($arrayfields['status']['checked'])) {
|
||||
print '<td align="center">';
|
||||
print $invoicerectmp->getLibStatut(3, 0);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
|
||||
@ -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
|
||||
@ -1346,32 +1347,31 @@ if ($resql)
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalhtfield'])
|
||||
|| isset($totalarray['totalvatfield'])
|
||||
|| isset($totalarray['totallocaltax1field'])
|
||||
|| isset($totalarray['totallocaltax2field'])
|
||||
|| isset($totalarray['totalttcfield'])
|
||||
|| isset($totalarray['totalamfield'])
|
||||
|| isset($totalarray['totalrtpfield'])
|
||||
)
|
||||
{
|
||||
|| isset($totalarray['totalvatfield'])
|
||||
|| isset($totalarray['totallocaltax1field'])
|
||||
|| isset($totalarray['totallocaltax2field'])
|
||||
|| isset($totalarray['totalttcfield'])
|
||||
|| isset($totalarray['totalamfield'])
|
||||
|| isset($totalarray['totalrtpfield'])
|
||||
) {
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totallocaltax1field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax1']).'</td>';
|
||||
elseif ($totalarray['totallocaltax2field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax2']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
elseif ($totalarray['totalamfield'] == $i) print '<td class="right">'.price($totalarray['totalam']).'</td>';
|
||||
elseif ($totalarray['totalrtpfield'] == $i) print '<td class="right">'.price($totalarray['totalrtp']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totallocaltax1field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax1']).'</td>';
|
||||
elseif ($totalarray['totallocaltax2field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax2']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
elseif ($totalarray['totalamfield'] == $i) print '<td class="right">'.price($totalarray['totalam']).'</td>';
|
||||
elseif ($totalarray['totalrtpfield'] == $i) print '<td class="right">'.price($totalarray['totalrtp']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -189,20 +189,21 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
$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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -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')
|
||||
{
|
||||
$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')
|
||||
{
|
||||
$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>';
|
||||
//}
|
||||
// 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')
|
||||
{
|
||||
$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 '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -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,73 +36,70 @@ $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
|
||||
switch ($objectlink->type) {
|
||||
case Facture::TYPE_REPLACEMENT:
|
||||
echo $langs->trans("InvoiceReplacement");
|
||||
break;
|
||||
case Facture::TYPE_CREDIT_NOTE:
|
||||
echo $langs->trans("InvoiceAvoir");
|
||||
break;
|
||||
case Facture::TYPE_DEPOSIT:
|
||||
echo $langs->trans("InvoiceDeposit");
|
||||
break;
|
||||
case Facture::TYPE_PROFORMA:
|
||||
echo $langs->trans("InvoiceProForma");
|
||||
break;
|
||||
case Facture::TYPE_SITUATION:
|
||||
echo $langs->trans("InvoiceSituation");
|
||||
break;
|
||||
default:
|
||||
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
|
||||
if ($user->rights->facture->lire) {
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
|
||||
if ($objectlink->statut != 3) // If not abandonned
|
||||
{
|
||||
$total = $total + $sign * $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
else
|
||||
{
|
||||
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 '<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");
|
||||
break;
|
||||
case Facture::TYPE_CREDIT_NOTE:
|
||||
echo $langs->trans("InvoiceAvoir");
|
||||
break;
|
||||
case Facture::TYPE_DEPOSIT:
|
||||
echo $langs->trans("InvoiceDeposit");
|
||||
break;
|
||||
case Facture::TYPE_PROFORMA:
|
||||
echo $langs->trans("InvoiceProForma");
|
||||
break;
|
||||
case Facture::TYPE_SITUATION:
|
||||
echo $langs->trans("InvoiceSituation");
|
||||
break;
|
||||
default:
|
||||
echo $langs->trans("CustomerInvoice");
|
||||
break;
|
||||
}
|
||||
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
|
||||
$total = $total + $sign * $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
}
|
||||
}
|
||||
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";
|
||||
|
||||
@ -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,28 +36,30 @@ $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>
|
||||
<td class="linkedcol-ref" align="center"></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date_when, 'day'); ?></td>
|
||||
<td class="linkedcol-amount right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
if ($user->rights->facture->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
|
||||
<?php
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
@ -75,6 +75,5 @@ if (count($linkedObjectBlock) > 1)
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
print "<!-- END PHP TEMPLATE -->\n";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -320,323 +320,318 @@ 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>';
|
||||
print '<td class="left">'.$productcust.'</td>';
|
||||
if ($modetax != 2) print '<td class="right">'.$amountcust.'</td>';
|
||||
if ($modetax != 1) print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
print '<td class="right">'.$langs->trans("BI").'</td>';
|
||||
print '<td class="right">'.$vatcust.'</td>';
|
||||
print '</tr>';
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="left">'.$elementcust.'</td>';
|
||||
print '<td class="left">'.$productcust.'</td>';
|
||||
if ($modetax != 2) print '<td class="right">'.$amountcust.'</td>';
|
||||
if ($modetax != 1) print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
print '<td class="right">'.$langs->trans("BI").'</td>';
|
||||
print '<td class="right">'.$vatcust.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$LT=0;
|
||||
$sameLT=false;
|
||||
foreach(array_keys($x_coll) as $rate)
|
||||
$LT=0;
|
||||
$sameLT=false;
|
||||
foreach(array_keys($x_coll) as $rate)
|
||||
{
|
||||
$subtot_coll_total_ht = 0;
|
||||
$subtot_coll_vat = 0;
|
||||
|
||||
if (is_array($x_both[$rate]['coll']['detail']))
|
||||
{
|
||||
$subtot_coll_total_ht = 0;
|
||||
$subtot_coll_vat = 0;
|
||||
|
||||
if (is_array($x_both[$rate]['coll']['detail']))
|
||||
// VAT Rate
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
foreach($x_both[$rate]['coll']['detail'] as $index => $fields)
|
||||
{
|
||||
// VAT Rate
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
foreach($x_both[$rate]['coll']['detail'] as $index => $fields)
|
||||
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
|
||||
{
|
||||
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'), 'service');
|
||||
else $text = img_object($langs->trans('Product'), 'product');
|
||||
if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg))
|
||||
{
|
||||
if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||
elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||
else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'], $fields['ddate_end']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax != 2)
|
||||
{
|
||||
print '<td class="nowrap right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax != 1)
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap right">';
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
print $payment_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
{
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else {
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Total collected
|
||||
print '<td class="nowrap right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht, 'MT'));
|
||||
print '</td>';
|
||||
|
||||
// Localtax
|
||||
print '<td class="nowrap right">';
|
||||
$temp_vat= $local==1?$fields['localtax1']:$fields['localtax2'];
|
||||
print price(price2num($temp_vat, 'MT'));
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_coll_total_ht += $temp_ht;
|
||||
$subtot_coll_vat += $temp_vat;
|
||||
$x_coll_sum += $temp_vat;
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'), 'service');
|
||||
else $text = img_object($langs->trans('Product'), 'product');
|
||||
if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg))
|
||||
{
|
||||
if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||
elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||
else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'], $fields['ddate_end']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax != 2)
|
||||
{
|
||||
print '<td class="nowrap right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax != 1)
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap right">';
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
print $payment_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
{
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else {
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Total collected
|
||||
print '<td class="nowrap right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht, 'MT'));
|
||||
print '</td>';
|
||||
|
||||
// Localtax
|
||||
print '<td class="nowrap right">';
|
||||
$temp_vat= $local==1?$fields['localtax1']:$fields['localtax2'];
|
||||
print price(price2num($temp_vat, 'MT'));
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_coll_total_ht += $temp_ht;
|
||||
$subtot_coll_vat += $temp_vat;
|
||||
$x_coll_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
|
||||
// Total customers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($x_coll) == 0) // Show a total ine if nothing shown
|
||||
// Total customers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Blank line
|
||||
print '<tr><td colspan="'.($span+1).'"> </td></tr>';
|
||||
print '</table>';
|
||||
$diff=$x_coll_sum;
|
||||
//}
|
||||
if (count($x_coll) == 0) // Show a total ine if nothing shown
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
//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">';
|
||||
print '<td class="left">'.$elementsup.'</td>';
|
||||
print '<td class="left">'.$productsup.'</td>';
|
||||
if ($modetax != 1)
|
||||
// Blank line
|
||||
print '<tr><td colspan="'.($span+1).'"> </td></tr>';
|
||||
print '</table>';
|
||||
$diff=$x_coll_sum;
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
//print table headers for this quadri - expenses now
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="left">'.$elementsup.'</td>';
|
||||
print '<td class="left">'.$productsup.'</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="right">'.$amountsup.'</td>';
|
||||
print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("BI").'</td>';
|
||||
print '<td class="right">'.$vatsup.'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach(array_keys($x_paye) as $rate)
|
||||
{
|
||||
$subtot_paye_total_ht = 0;
|
||||
$subtot_paye_vat = 0;
|
||||
|
||||
if (is_array($x_both[$rate]['paye']['detail']))
|
||||
{
|
||||
print '<td class="right">'.$amountsup.'</td>';
|
||||
print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("BI").'</td>';
|
||||
print '<td class="right">'.$vatsup.'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach(array_keys($x_paye) as $rate)
|
||||
{
|
||||
$subtot_paye_total_ht = 0;
|
||||
$subtot_paye_vat = 0;
|
||||
|
||||
if (is_array($x_both[$rate]['paye']['detail']))
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
foreach($x_both[$rate]['paye']['detail'] as $index=>$fields)
|
||||
{
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
foreach($x_both[$rate]['paye']['detail'] as $index=>$fields)
|
||||
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
|
||||
{
|
||||
if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0))
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'), 'service');
|
||||
else $text = img_object($langs->trans('Product'), 'product');
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'], $fields['ddate_end']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
// Total HT
|
||||
if ($modetax != 2)
|
||||
{
|
||||
print '<td class="nowrap right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="nowrap right">';
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$paymentfourn_static->id=$fields['payment_id'];
|
||||
print $paymentfourn_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
{
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'), 'service');
|
||||
else $text = img_object($langs->trans('Product'), 'product');
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'], $fields['ddate_end']);
|
||||
print price(price2num($fields['payment_amount'], 'MT'));
|
||||
if (isset($fields['payment_amount'])) {
|
||||
print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax != 2)
|
||||
{
|
||||
print '<td class="nowrap right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="nowrap right">';
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$paymentfourn_static->id=$fields['payment_id'];
|
||||
print $paymentfourn_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
{
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
else
|
||||
{
|
||||
print price(price2num($fields['payment_amount'], 'MT'));
|
||||
if (isset($fields['payment_amount'])) {
|
||||
print ' ('.round($ratiopaymentinvoice*100, 2).'%)';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// VAT paid
|
||||
print '<td class="nowrap right">';
|
||||
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht, 'MT'), 1);
|
||||
print '</td>';
|
||||
|
||||
// Localtax
|
||||
print '<td class="nowrap right">';
|
||||
$temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_vat, 'MT'), 1);
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_paye_total_ht += $temp_ht;
|
||||
$subtot_paye_vat += $temp_vat;
|
||||
$x_paye_sum += $temp_vat;
|
||||
}
|
||||
|
||||
// VAT paid
|
||||
print '<td class="nowrap right">';
|
||||
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht, 'MT'), 1);
|
||||
print '</td>';
|
||||
|
||||
// Localtax
|
||||
print '<td class="nowrap right">';
|
||||
$temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_vat, 'MT'), 1);
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_paye_total_ht += $temp_ht;
|
||||
$subtot_paye_vat += $temp_vat;
|
||||
$x_paye_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
|
||||
// Total suppliers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($x_paye) == 0) { // Show a total line if nothing shown
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Total suppliers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
//}
|
||||
if (count($x_paye) == 0) { // Show a total line if nothing shown
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td class="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Total to pay
|
||||
print '<br><br>';
|
||||
|
||||
@ -168,20 +168,20 @@ if ($action == 'create')
|
||||
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
|
||||
|
||||
$total = $charge->amount;
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
|
||||
//Add js for AutoFill
|
||||
print ' $(document).ready(function () {';
|
||||
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
|
||||
var amount = $(this).data("value");
|
||||
document.getElementById($(this).data(\'rowid\')).value = amount ;
|
||||
});';
|
||||
print ' });'."\n";
|
||||
//Add js for AutoFill
|
||||
print ' $(document).ready(function () {';
|
||||
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
|
||||
var amount = $(this).data("value");
|
||||
document.getElementById($(this).data(\'rowid\')).value = amount ;
|
||||
});';
|
||||
print ' });'."\n";
|
||||
|
||||
print ' </script>'."\n";
|
||||
}
|
||||
print ' </script>'."\n";
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("DoPayment"));
|
||||
print "<br>\n";
|
||||
|
||||
@ -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>';*/
|
||||
|
||||
@ -1686,7 +1686,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR ='';
|
||||
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "" ) ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
@ -1718,8 +1718,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </Id>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "" ) ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135) ).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
|
||||
@ -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;
|
||||
|
||||
@ -223,7 +223,7 @@ if ($resql)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
if ($num > 0)
|
||||
|
||||
@ -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))
|
||||
$sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($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";
|
||||
|
||||
|
||||
@ -454,19 +454,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -241,165 +241,163 @@ 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)
|
||||
{
|
||||
$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>';
|
||||
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>';
|
||||
|
||||
$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.= " 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', 0) . ")";
|
||||
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
|
||||
$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.= " 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', 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) {
|
||||
$num = $db->num_rows($resql);
|
||||
$totalpermonth = array();
|
||||
while ( $obj = $db->fetch_object($resql)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
|
||||
if ($obj->product_type == 0) {
|
||||
print '<td class="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td class="left">'. $langs->trans("Service") . '</td>';
|
||||
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)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
|
||||
if ($obj->product_type == 0) {
|
||||
print '<td class="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td class="left">'. $langs->trans("Service") . '</td>';
|
||||
}
|
||||
print '<td>' .$obj->country . '</td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) $j -= 12;
|
||||
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
|
||||
print '<td class="right" width="6%">' . price($obj->$monthj) . '</td>';
|
||||
$totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
|
||||
}
|
||||
print '<td class="right" width="6%"><b>' . price($obj->total) . '</b></td>';
|
||||
$totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
|
||||
print '</tr>';
|
||||
}
|
||||
print '<td>' .$obj->country . '</td>';
|
||||
$db->free($resql);
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td class="right"></td>';
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) $j -= 12;
|
||||
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
|
||||
print '<td class="right" width="6%">' . price($obj->$monthj) . '</td>';
|
||||
$totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
|
||||
print '<td class="right" width="6%">' . price($totalpermonth[$j]) . '</td>';
|
||||
}
|
||||
print '<td class="right" width="6%"><b>' . price($obj->total) . '</b></td>';
|
||||
$totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
|
||||
print '<td class="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td class="right"></td>';
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
|
||||
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;
|
||||
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
|
||||
print '<td class="right" width="6%">' . price($totalpermonth[$j]) . '</td>';
|
||||
print '<td width="60" class="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$i++;
|
||||
}
|
||||
print '<td class="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
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 .= " 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)) {
|
||||
$sql.= " AND ff.type IN (0,1,2,5)";
|
||||
} 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";
|
||||
|
||||
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>';
|
||||
|
||||
$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)) {
|
||||
$sql.= " AND ff.type IN (0,1,2,5)";
|
||||
} 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";
|
||||
|
||||
//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)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
|
||||
if ($obj->product_type == 0) {
|
||||
print '<td class="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td class="left">'. $langs->trans("Service") . '</td>';
|
||||
//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)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
|
||||
if ($obj->product_type == 0) {
|
||||
print '<td class="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td class="left">'. $langs->trans("Service") . '</td>';
|
||||
}
|
||||
print '<td>' . $obj->country . '</td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) $j -= 12;
|
||||
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
|
||||
print '<td class="right" width="6%">' . price($obj->$monthj) . '</td>';
|
||||
$totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
|
||||
}
|
||||
print '<td class="right" width="6%"><b>' . price($obj->total) . '</b></td>';
|
||||
$totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
|
||||
print '</tr>';
|
||||
}
|
||||
print '<td>' . $obj->country . '</td>';
|
||||
$db->free($resql2);
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td class="right"></td>';
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) $j -= 12;
|
||||
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
|
||||
print '<td class="right" width="6%">' . price($obj->$monthj) . '</td>';
|
||||
$totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
|
||||
print '<td class="right" width="6%">' . price($totalpermonth[$j]) . '</td>';
|
||||
}
|
||||
print '<td class="right" width="6%"><b>' . price($obj->total) . '</b></td>';
|
||||
$totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
|
||||
print '<td class="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
$db->free($resql2);
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td class="right"></td>';
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) $j -= 12;
|
||||
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
|
||||
print '<td class="right" width="6%">' . price($totalpermonth[$j]) . '</td>';
|
||||
}
|
||||
print '<td class="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
|
||||
print '</tr>';
|
||||
} 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
|
||||
|
||||
@ -240,7 +240,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.type IN (0,1,2,3,5)";
|
||||
}
|
||||
if ($date_start && $date_end) {
|
||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
@ -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",
|
||||
|
||||
@ -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")
|
||||
{
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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'].'&action=edit&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'].'&action=edit&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'].'&action=create_user&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'].'&action=create_user&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'].'&action=delete&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'].'&action=delete&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";
|
||||
|
||||
@ -695,7 +695,7 @@ else
|
||||
print $formcompany->select_state(GETPOST("state_id", 'alpha')?GETPOST("state_id", 'alpha'):$object->state_id, $object->country_code, 'state_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
|
||||
@ -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, '', ' ', 'phone');
|
||||
if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $this->country_code, $this->id, 0, '', ' ', 'mobile');
|
||||
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $this->country_code, $this->id, 0, '', ' ', 'phone');
|
||||
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.implode(' ', $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);
|
||||
}
|
||||
|
||||
@ -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)."%'";
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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 : '');
|
||||
@ -680,9 +680,9 @@ if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
if (! empty($arrayfields['p.priv']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
|
||||
print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
|
||||
print '</td>';
|
||||
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
|
||||
print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
@ -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']))
|
||||
@ -911,9 +913,9 @@ while ($i < min($num, $limit))
|
||||
print '<td>';
|
||||
if ($obj->socid)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($obj->socid);
|
||||
print $objsoc->getNomUrl(1);
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($obj->socid);
|
||||
print $objsoc->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
print ' ';
|
||||
|
||||
@ -164,19 +164,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -445,13 +444,13 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
|
||||
if (!empty($date_start) && !empty($date_end) && $date_start > $date_end)
|
||||
{
|
||||
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
|
||||
if (!empty($date_start) && !empty($date_end) && $date_start > $date_end)
|
||||
{
|
||||
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -532,7 +531,7 @@ if (empty($reshook))
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat/100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat/100)), 'MU');
|
||||
}
|
||||
}
|
||||
@ -728,9 +727,9 @@ if (empty($reshook))
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
|
||||
if ($fk_unit > 0) {
|
||||
$objectline->fk_unit = GETPOST('unit');
|
||||
$objectline->fk_unit = GETPOST('unit');
|
||||
} else {
|
||||
$objectline->fk_unit = null;
|
||||
$objectline->fk_unit = null;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
@ -1419,19 +1418,20 @@ 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&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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
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.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -861,9 +861,9 @@ class Contrat extends CommonObject
|
||||
|
||||
// multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
}
|
||||
|
||||
$this->lines[$pos] = $line;
|
||||
|
||||
@ -705,17 +705,18 @@ while ($i < min($num, $limit))
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td class="right">';
|
||||
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
||||
{
|
||||
print $contractstatic->LibStatut(0, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0);
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td class="right">';
|
||||
if ($obj->cstatut == 0)
|
||||
{
|
||||
// If contract is draft, we say line is also draft
|
||||
print $contractstatic->LibStatut(0, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0);
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
|
||||
@ -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,28 +43,29 @@ 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>
|
||||
<td></td>
|
||||
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
||||
<td class="right"><?php
|
||||
// Price of contract is not shown by default because a contract is a list of service with
|
||||
// start and end date that change with time andd that may be different that the period of reference for price.
|
||||
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
||||
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
|
||||
{
|
||||
$totalcontrat = 0;
|
||||
foreach ($objectlink->lines as $linecontrat) {
|
||||
$totalcontrat = $totalcontrat + $linecontrat->total_ht;
|
||||
$total = $total + $linecontrat->total_ht;
|
||||
}
|
||||
echo price($totalcontrat);
|
||||
} ?></td>
|
||||
// Price of contract is not shown by default because a contract is a list of service with
|
||||
// start and end date that change with time andd that may be different that the period of reference for price.
|
||||
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
||||
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
|
||||
{
|
||||
$totalcontrat = 0;
|
||||
foreach ($objectlink->lines as $linecontrat) {
|
||||
$totalcontrat = $totalcontrat + $linecontrat->total_ht;
|
||||
$total = $total + $linecontrat->total_ht;
|
||||
}
|
||||
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";
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -57,12 +57,12 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
// Special case to force bank account
|
||||
//if (property_exists($object, 'fk_bank'))
|
||||
//{
|
||||
if (GETPOST('fk_bank', 'int')) {
|
||||
// this field may come from an external module
|
||||
$object->fk_bank = GETPOST('fk_bank', 'int');
|
||||
} elseif (! empty($object->fk_account)) {
|
||||
$object->fk_bank = $object->fk_account;
|
||||
}
|
||||
if (GETPOST('fk_bank', 'int')) {
|
||||
// this field may come from an external module
|
||||
$object->fk_bank = GETPOST('fk_bank', 'int');
|
||||
} elseif (! empty($object->fk_account)) {
|
||||
$object->fk_bank = $object->fk_account;
|
||||
}
|
||||
//}
|
||||
|
||||
$outputlangs = $langs;
|
||||
|
||||
@ -81,78 +81,79 @@ elseif (GETPOST('linkit', 'none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
// Delete file/link
|
||||
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
|
||||
$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
|
||||
$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.
|
||||
{
|
||||
$urlfile=basename($urlfile);
|
||||
$file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile;
|
||||
if (! empty($upload_dirold)) $fileold = $upload_dirold . "/" . $urlfile;
|
||||
}
|
||||
$linkid = GETPOST('linkid', 'int');
|
||||
|
||||
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)
|
||||
|
||||
$ret = dol_delete_file($file, 0, 0, 0, (is_object($object)?$object:null));
|
||||
if (! empty($fileold)) dol_delete_file($fileold, 0, 0, 0, (is_object($object)?$object:null)); // Delete file using old path
|
||||
|
||||
// Si elle existe, on efface la vignette
|
||||
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs))
|
||||
{
|
||||
$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.
|
||||
{
|
||||
$urlfile=basename($urlfile);
|
||||
$file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile;
|
||||
if (! empty($upload_dirold)) $fileold = $upload_dirold . "/" . $urlfile;
|
||||
}
|
||||
$linkid = GETPOST('linkid', 'int');
|
||||
|
||||
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)
|
||||
|
||||
$ret = dol_delete_file($file, 0, 0, 0, (is_object($object)?$object:null));
|
||||
if (! empty($fileold)) dol_delete_file($fileold, 0, 0, 0, (is_object($object)?$object:null)); // Delete file using old path
|
||||
|
||||
// Si elle existe, on efface la vignette
|
||||
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs))
|
||||
$photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
|
||||
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
|
||||
{
|
||||
$photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
|
||||
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
|
||||
{
|
||||
dol_delete_file($dirthumb.$photo_vignette);
|
||||
}
|
||||
|
||||
$photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
|
||||
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
|
||||
{
|
||||
dol_delete_file($dirthumb.$photo_vignette);
|
||||
}
|
||||
dol_delete_file($dirthumb.$photo_vignette);
|
||||
}
|
||||
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
|
||||
$photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
|
||||
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
|
||||
{
|
||||
dol_delete_file($dirthumb.$photo_vignette);
|
||||
}
|
||||
}
|
||||
elseif ($linkid) // delete of external link
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||
$link = new Link($db);
|
||||
$link->fetch($linkid);
|
||||
$res = $link->delete($user);
|
||||
|
||||
$langs->load('link');
|
||||
if ($res > 0) {
|
||||
setEventMessages($langs->trans("LinkRemoved", $link->label), null, 'mesgs');
|
||||
if ($ret) {
|
||||
setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
|
||||
}
|
||||
}
|
||||
elseif ($linkid) // delete of external link
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||
$link = new Link($db);
|
||||
$link->fetch($linkid);
|
||||
$res = $link->delete($user);
|
||||
|
||||
$langs->load('link');
|
||||
if ($res > 0) {
|
||||
setEventMessages($langs->trans("LinkRemoved", $link->label), null, 'mesgs');
|
||||
} else {
|
||||
if (count($link->errors)) {
|
||||
setEventMessages('', $link->errors, 'errors');
|
||||
} else {
|
||||
if (count($link->errors)) {
|
||||
setEventMessages('', $link->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFailedToDeleteLink", $link->label), null, 'errors');
|
||||
}
|
||||
setEventMessages($langs->trans("ErrorFailedToDeleteLink", $link->label), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($object) && $object->id > 0)
|
||||
{
|
||||
if ($backtopage)
|
||||
{
|
||||
header('Location: ' . $backtopage);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha')?'§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')):'').(!empty($withproject)?'&withproject=1':''));
|
||||
exit;
|
||||
}
|
||||
if (is_object($object) && $object->id > 0) {
|
||||
if ($backtopage) {
|
||||
header('Location: ' . $backtopage);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha')?'§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')):'').(!empty($withproject)?'&withproject=1':''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha'))
|
||||
{
|
||||
|
||||
@ -1085,7 +1085,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
|
||||
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
182
htdocs/core/boxes/box_boms.php
Normal file
182
htdocs/core/boxes/box_boms.php
Normal 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);
|
||||
}
|
||||
}
|
||||
@ -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';
|
||||
|
||||
@ -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;
|
||||
|
||||
182
htdocs/core/boxes/box_mos.php
Normal file
182
htdocs/core/boxes/box_mos.php
Normal 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);
|
||||
}
|
||||
}
|
||||
@ -54,12 +54,12 @@ class Canvas
|
||||
public $control; // Initialized by getCanvas with controller instance
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
|
||||
*/
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
|
||||
*/
|
||||
public function __construct($db, $actiontype = 'view')
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
@ -171,16 +171,16 @@ class Ccountry // extends CommonObject
|
||||
public function fetch($id, $code = '', $code_iso = '')
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.code_iso,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
elseif ($code_iso) $sql.= " WHERE t.code_iso = '".$this->db->escape($code_iso)."'";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
elseif ($code_iso) $sql.= " WHERE t.code_iso = '".$this->db->escape($code_iso)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -154,7 +154,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
@ -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,259 +4612,258 @@ 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'));
|
||||
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs)?$outputlangs->defaultlang:'null'));
|
||||
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
|
||||
// If selected model is a filename template (then $modele="modelname" or "modelname:filename")
|
||||
$tmp=explode(':', $modele, 2);
|
||||
if (! empty($tmp[1]))
|
||||
{
|
||||
$modele=$tmp[0];
|
||||
$srctemplatepath=$tmp[1];
|
||||
}
|
||||
// If selected model is a filename template (then $modele="modelname" or "modelname:filename")
|
||||
$tmp=explode(':', $modele, 2);
|
||||
if (! empty($tmp[1]))
|
||||
{
|
||||
$modele=$tmp[0];
|
||||
$srctemplatepath=$tmp[1];
|
||||
}
|
||||
|
||||
// Search template files
|
||||
$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)
|
||||
{
|
||||
foreach(array('doc','pdf') as $prefix)
|
||||
{
|
||||
if (in_array(get_class($this), array('Adherent'))) $file = $prefix."_".$modele.".class.php"; // Member module use prefix_module.class.php
|
||||
else $file = $prefix."_".$modele.".modules.php";
|
||||
// Search template files
|
||||
$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)
|
||||
{
|
||||
foreach(array('doc','pdf') as $prefix)
|
||||
{
|
||||
if (in_array(get_class($this), array('Adherent'))) $file = $prefix."_".$modele.".class.php"; // Member module use prefix_module.class.php
|
||||
else $file = $prefix."_".$modele.".modules.php";
|
||||
|
||||
// On verifie l'emplacement du modele
|
||||
$file=dol_buildpath($reldir.$modelspath.$file, 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($filefound) break;
|
||||
}
|
||||
// On verifie l'emplacement du modele
|
||||
$file=dol_buildpath($reldir.$modelspath.$file, 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($filefound) break;
|
||||
}
|
||||
|
||||
// If generator was found
|
||||
if ($filefound)
|
||||
{
|
||||
global $db; // Required to solve a conception default making an include of code using $db instead of $this->db just after.
|
||||
// If generator was found
|
||||
if ($filefound)
|
||||
{
|
||||
global $db; // Required to solve a conception default making an include of code using $db instead of $this->db just after.
|
||||
|
||||
require_once $file;
|
||||
require_once $file;
|
||||
|
||||
$obj = new $classname($this->db);
|
||||
$obj = new $classname($this->db);
|
||||
|
||||
// If generator is ODT, we must have srctemplatepath defined, if not we set it.
|
||||
if ($obj->type == 'odt' && empty($srctemplatepath))
|
||||
{
|
||||
$varfortemplatedir=$obj->scandir;
|
||||
if ($varfortemplatedir && ! empty($conf->global->$varfortemplatedir))
|
||||
{
|
||||
$dirtoscan=$conf->global->$varfortemplatedir;
|
||||
// If generator is ODT, we must have srctemplatepath defined, if not we set it.
|
||||
if ($obj->type == 'odt' && empty($srctemplatepath))
|
||||
{
|
||||
$varfortemplatedir=$obj->scandir;
|
||||
if ($varfortemplatedir && ! empty($conf->global->$varfortemplatedir))
|
||||
{
|
||||
$dirtoscan=$conf->global->$varfortemplatedir;
|
||||
|
||||
$listoffiles=array();
|
||||
$listoffiles=array();
|
||||
|
||||
// Now we add first model found in directories scanned
|
||||
$listofdir=explode(',', $dirtoscan);
|
||||
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))
|
||||
{
|
||||
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0);
|
||||
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
|
||||
}
|
||||
}
|
||||
// Now we add first model found in directories scanned
|
||||
$listofdir=explode(',', $dirtoscan);
|
||||
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))
|
||||
{
|
||||
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0);
|
||||
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($listoffiles))
|
||||
{
|
||||
foreach($listoffiles as $record)
|
||||
{
|
||||
$srctemplatepath=$record['fullname'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($listoffiles))
|
||||
{
|
||||
foreach($listoffiles as $record)
|
||||
{
|
||||
$srctemplatepath=$record['fullname'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($srctemplatepath))
|
||||
{
|
||||
$this->error='ErrorGenerationAskedForOdtTemplateWithSrcFileNotDefined';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (empty($srctemplatepath))
|
||||
{
|
||||
$this->error='ErrorGenerationAskedForOdtTemplateWithSrcFileNotDefined';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($obj->type == 'odt' && ! empty($srctemplatepath))
|
||||
{
|
||||
if (! dol_is_file($srctemplatepath))
|
||||
{
|
||||
$this->error='ErrorGenerationAskedForOdtTemplateWithSrcFileNotFound';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ($obj->type == 'odt' && ! empty($srctemplatepath))
|
||||
{
|
||||
if (! dol_is_file($srctemplatepath))
|
||||
{
|
||||
$this->error='ErrorGenerationAskedForOdtTemplateWithSrcFileNotFound';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
|
||||
if (in_array(get_class($this), array('Adherent')))
|
||||
{
|
||||
$arrayofrecords = array(); // The write_file of templates of adherent class need this var
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams);
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
|
||||
if (in_array(get_class($this), array('Adherent')))
|
||||
{
|
||||
$arrayofrecords = array(); // The write_file of templates of adherent class need this var
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams);
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
|
||||
|
||||
if ($resultwritefile > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
if ($resultwritefile > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
|
||||
// We delete old preview
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_delete_preview($this);
|
||||
// We delete old preview
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_delete_preview($this);
|
||||
|
||||
// Index file in database
|
||||
if (! empty($obj->result['fullpath']))
|
||||
{
|
||||
$destfull = $obj->result['fullpath'];
|
||||
$upload_dir = dirname($destfull);
|
||||
$destfile = basename($destfull);
|
||||
$rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $upload_dir);
|
||||
// Index file in database
|
||||
if (! empty($obj->result['fullpath']))
|
||||
{
|
||||
$destfull = $obj->result['fullpath'];
|
||||
$upload_dir = dirname($destfull);
|
||||
$destfile = basename($destfull);
|
||||
$rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $upload_dir);
|
||||
|
||||
if (! preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir
|
||||
{
|
||||
$filename = basename($destfile);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
if (! preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir
|
||||
{
|
||||
$filename = basename($destfile);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
||||
|
||||
// Set the public "share" key
|
||||
$setsharekey = false;
|
||||
if ($this->element == 'propal')
|
||||
{
|
||||
$useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
|
||||
if ($useonlinesignature) $setsharekey=true;
|
||||
if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
}
|
||||
if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey=true;
|
||||
}
|
||||
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey=true;
|
||||
}
|
||||
if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey=true;
|
||||
}
|
||||
// Set the public "share" key
|
||||
$setsharekey = false;
|
||||
if ($this->element == 'propal')
|
||||
{
|
||||
$useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
|
||||
if ($useonlinesignature) $setsharekey=true;
|
||||
if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
}
|
||||
if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey=true;
|
||||
}
|
||||
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey=true;
|
||||
}
|
||||
if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey=true;
|
||||
}
|
||||
|
||||
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';
|
||||
$ecmfile->share = getRandomPassword(true);
|
||||
}
|
||||
}
|
||||
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';
|
||||
$ecmfile->share = getRandomPassword(true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ecmfile->entity = $conf->entity;
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$ecmfile->src_object_type = $this->table_element;
|
||||
$ecmfile->src_object_id = $this->id;
|
||||
if ($result > 0)
|
||||
{
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ecmfile->entity = $conf->entity;
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$ecmfile->src_object_type = $this->table_element;
|
||||
$ecmfile->src_object_id = $this->id;
|
||||
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
/*$this->result['fullname']=$destfull;
|
||||
$this->result['filepath']=$ecmfile->filepath;
|
||||
$this->result['filename']=$ecmfile->filename;*/
|
||||
//var_dump($obj->update_main_doc_field);exit;
|
||||
/*$this->result['fullname']=$destfull;
|
||||
$this->result['filepath']=$ecmfile->filepath;
|
||||
$this->result['filename']=$ecmfile->filename;*/
|
||||
//var_dump($obj->update_main_doc_field);exit;
|
||||
|
||||
// Update the last_main_doc field into main object (if documenent generator has property ->update_main_doc_field set)
|
||||
$update_main_doc_field=0;
|
||||
if (! empty($obj->update_main_doc_field)) $update_main_doc_field=1;
|
||||
if ($update_main_doc_field && ! empty($this->table_element))
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath.'/'.$ecmfile->filename)."'";
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
// Update the last_main_doc field into main object (if documenent generator has property ->update_main_doc_field set)
|
||||
$update_main_doc_field=0;
|
||||
if (! empty($obj->update_main_doc_field)) $update_main_doc_field=1;
|
||||
if ($update_main_doc_field && ! empty($this->table_element))
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath.'/'.$ecmfile->filename)."'";
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) dol_print_error($this->db);
|
||||
else
|
||||
{
|
||||
$this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
dol_print_error($this->db);
|
||||
} else {
|
||||
$this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
|
||||
}
|
||||
|
||||
// Success in building document. We build meta file.
|
||||
dol_meta_create($this);
|
||||
// Success in building document. We build meta file.
|
||||
dol_meta_create($this);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file);
|
||||
dol_print_error('', $this->error);
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file);
|
||||
dol_print_error('', $this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else return $reshook;
|
||||
}
|
||||
@ -6070,18 +6069,19 @@ 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;
|
||||
}
|
||||
|
||||
if (! empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName . ':' . $obj->{$parentField};
|
||||
}
|
||||
|
||||
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
}
|
||||
|
||||
if (! empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName . ':' . $obj->{$parentField};
|
||||
}
|
||||
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
}
|
||||
|
||||
$i ++;
|
||||
|
||||
@ -182,16 +182,16 @@ abstract class CommonStickerGenerator
|
||||
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
|
||||
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
||||
if($j<=($x2-1)) {
|
||||
$pdf->Line($j, $y1, $j+1, $y1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($j, $y2, $j+1, $y2); // on trace le pointill? du bas, point par point
|
||||
$pdf->Line($j, $y1, $j+1, $y1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($j, $y2, $j+1, $y2); // on trace le pointill? du bas, point par point
|
||||
}
|
||||
}
|
||||
}
|
||||
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
|
||||
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
||||
if($j<=($y2-1)) {
|
||||
$pdf->Line($x1, $j, $x1, $j+1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($x2, $j, $x2, $j+1); // on trace le pointill? du bas, point par point
|
||||
$pdf->Line($x1, $j, $x1, $j+1); // on trace le pointill? du haut, point par point
|
||||
$pdf->Line($x2, $j, $x2, $j+1); // on trace le pointill? du bas, point par point
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,10 +392,10 @@ class CoreObject extends CommonObject
|
||||
*/
|
||||
public function setDate($field, $date)
|
||||
{
|
||||
if (empty($date))
|
||||
{
|
||||
$this->{$field} = 0;
|
||||
}
|
||||
if (empty($date))
|
||||
{
|
||||
$this->{$field} = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
@ -252,7 +252,7 @@ class Ctyperesource
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -157,7 +157,7 @@ class DolEditor
|
||||
$fullpage=false;
|
||||
if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT))
|
||||
{
|
||||
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
|
||||
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
|
||||
}
|
||||
|
||||
$found=0;
|
||||
|
||||
@ -944,9 +944,9 @@ class DolGraph
|
||||
if (! empty($this->title)) $this->stringtoshow.='<div class="center dolgraphtitle'.(empty($this->cssprefix)?'':' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
|
||||
if (! empty($this->shownographyet))
|
||||
{
|
||||
$this->stringtoshow.='<div style="width:'.$this->width.'px;height:'.$this->height.'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow.='<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
return;
|
||||
$this->stringtoshow.='<div style="width:'.$this->width.'px;height:'.$this->height.'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow.='<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
return;
|
||||
}
|
||||
$this->stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($this->cssprefix)?'':' dolgraph'.$this->cssprefix).' center"></div>'."\n";
|
||||
|
||||
|
||||
@ -248,12 +248,12 @@ class Fiscalyear extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param int $id Id of record to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param int $id Id of record to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -227,14 +227,14 @@ class Form
|
||||
}
|
||||
elseif (preg_match('/^select;/', $typeofdata))
|
||||
{
|
||||
$arraydata=explode(',', preg_replace('/^select;/', '', $typeofdata));
|
||||
foreach($arraydata as $val)
|
||||
{
|
||||
$tmp=explode(':', $val);
|
||||
$tmpkey=str_replace('|', ':', $tmp[0]);
|
||||
$arraylist[$tmpkey]=$tmp[1];
|
||||
}
|
||||
$ret.=$this->selectarray($htmlname, $arraylist, $value);
|
||||
$arraydata=explode(',', preg_replace('/^select;/', '', $typeofdata));
|
||||
foreach($arraydata as $val)
|
||||
{
|
||||
$tmp=explode(':', $val);
|
||||
$tmpkey=str_replace('|', ':', $tmp[0]);
|
||||
$arraylist[$tmpkey]=$tmp[1];
|
||||
}
|
||||
$ret.=$this->selectarray($htmlname, $arraylist, $value);
|
||||
}
|
||||
elseif (preg_match('/^ckeditor/', $typeofdata))
|
||||
{
|
||||
@ -5458,9 +5458,9 @@ class Form
|
||||
dateFormat: '".$langs->trans("FormatDateShortJQueryInput")."',
|
||||
autoclose: true,
|
||||
todayHighlight: true,";
|
||||
if (! empty($conf->dol_use_jmobile))
|
||||
{
|
||||
$retstring.="
|
||||
if (! empty($conf->dol_use_jmobile))
|
||||
{
|
||||
$retstring.="
|
||||
beforeShow: function (input, datePicker) {
|
||||
input.disabled = true;
|
||||
},
|
||||
@ -5468,16 +5468,16 @@ class Form
|
||||
this.disabled = false;
|
||||
},
|
||||
";
|
||||
}
|
||||
// Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php
|
||||
if (empty($conf->global->MAIN_POPUP_CALENDAR_ON_FOCUS))
|
||||
{
|
||||
}
|
||||
// Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php
|
||||
if (empty($conf->global->MAIN_POPUP_CALENDAR_ON_FOCUS))
|
||||
{
|
||||
$retstring.="
|
||||
showOn: 'button',
|
||||
buttonImage: '".DOL_URL_ROOT."/theme/".$conf->theme."/img/object_calendarday.png',
|
||||
buttonImageOnly: true";
|
||||
}
|
||||
$retstring.="
|
||||
}
|
||||
$retstring.="
|
||||
}) });";
|
||||
$retstring.="</script>";
|
||||
}
|
||||
@ -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)
|
||||
{
|
||||
$objectdesc=$classname.':'.$classpath.':'.$addcreatebuttonornot.':'.$filter;
|
||||
// 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
|
||||
{
|
||||
@ -6563,19 +6572,19 @@ class Form
|
||||
|
||||
foreach($array as $key => $val)
|
||||
{
|
||||
/* var_dump($val);
|
||||
/* var_dump($val);
|
||||
var_dump(array_key_exists('enabled', $val));
|
||||
var_dump(!$val['enabled']);*/
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled'])
|
||||
{
|
||||
unset($array[$key]); // We don't want this field
|
||||
continue;
|
||||
}
|
||||
if ($val['label'])
|
||||
{
|
||||
$lis.='<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
|
||||
$listcheckedstring.=(empty($val['checked'])?'':$key.',');
|
||||
}
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled'])
|
||||
{
|
||||
unset($array[$key]); // We don't want this field
|
||||
continue;
|
||||
}
|
||||
if ($val['label'])
|
||||
{
|
||||
$lis.='<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
|
||||
$listcheckedstring.=(empty($val['checked'])?'':$key.',');
|
||||
}
|
||||
}
|
||||
|
||||
$out ='<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
|
||||
@ -6970,7 +6979,7 @@ class Form
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<!-- Add js to show linkto box -->
|
||||
print '<!-- Add js to show linkto box -->
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".linkto").click(function() {
|
||||
@ -6980,7 +6989,7 @@ class Form
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
';
|
||||
}
|
||||
|
||||
return $linktoelem;
|
||||
@ -7017,7 +7026,7 @@ class Form
|
||||
$resultyesno .= '<option value="'.$no.'">'.$langs->trans("No").'</option>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$selected=(($useempty && $value != '0' && $value != 'no')?'':' selected');
|
||||
$resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n";
|
||||
$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
|
||||
|
||||
@ -45,11 +45,11 @@ class FormAccounting extends Form
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user