Merge remote-tracking branch 'upstream/develop' into socialnetworks
This commit is contained in:
commit
f7747ed00a
@ -65,21 +65,33 @@ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; }
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$productsid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
while ($i < $num) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++; }
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$societesid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
} else { print "err"; }
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
while ($i < $num) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++; }
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
} else { print "err"; }
|
||||
|
||||
|
||||
|
||||
@ -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" />
|
||||
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -68,15 +68,18 @@ $langs->loadLangs(array("main","bills","cashdesk"));
|
||||
|
||||
for ($i = 0; $i < $nbtoshow; $i++)
|
||||
{
|
||||
if ( $id == $tab_designations[$i]['rowid'] )
|
||||
if ($id == $tab_designations[$i]['rowid']) {
|
||||
$selected = 'selected';
|
||||
else
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
|
||||
$label = $tab_designations[$i]['label'];
|
||||
|
||||
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'], 16).' - '.dol_trunc($label, 35, 'middle');
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
|
||||
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";
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1582,8 +1582,9 @@ if ($id > 0)
|
||||
if ($user->rights->agenda->allactions->create ||
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -1735,5 +1735,18 @@ function sort_events_by_date($a, $b)
|
||||
}
|
||||
|
||||
// If both events have the same start time, longest first
|
||||
|
||||
if(! is_numeric($b->datef))
|
||||
{
|
||||
// when event B have no end timestamp, event B should sort be before event A (All day events on top)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(! is_numeric($a->datef))
|
||||
{
|
||||
// when event A have no end timestamp , event A should sort be before event B (All day events on top)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $b->datef - $a->datef;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1325,17 +1325,17 @@ if (empty($reshook))
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
|
||||
// Delai de livraison
|
||||
// Delivery time
|
||||
elseif ($action == 'setavailability' && $usercancreate) {
|
||||
$result = $object->set_availability($user, GETPOST('availability_id', 'int'));
|
||||
}
|
||||
|
||||
// Origine de la propale
|
||||
// Origin of the commercial proposal
|
||||
elseif ($action == 'setdemandreason' && $usercancreate) {
|
||||
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int'));
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
// Terms of payment
|
||||
elseif ($action == 'setconditions' && $usercancreate) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ if (empty($reshook))
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
// Mode de reglement
|
||||
// Payment choice
|
||||
elseif ($action == 'setmode' && $usercancreate) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
}
|
||||
@ -1413,7 +1413,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Bascule du statut d'un contact
|
||||
// Toggle the status of a contact
|
||||
elseif ($action == 'swapstatut') {
|
||||
if ($object->fetch($id) > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
@ -1422,7 +1422,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
// Delete a contact
|
||||
elseif ($action == 'deletecontact') {
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
@ -1600,7 +1600,7 @@ if ($action == 'create')
|
||||
$form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
|
||||
print '</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
// Third party discounts info line
|
||||
print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
|
||||
|
||||
$absolute_discount = $soc->getAvailableDiscounts();
|
||||
@ -1787,7 +1787,7 @@ if ($action == 'create')
|
||||
|
||||
|
||||
/*
|
||||
* Combobox pour la fonction de copie
|
||||
* Combobox for copy function
|
||||
*/
|
||||
|
||||
if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print '<input type="hidden" name="createmode" value="empty">';
|
||||
@ -1884,7 +1884,7 @@ if ($action == 'create')
|
||||
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) {
|
||||
$formquestion[] = array('type' => 'date','name' => 'date_delivery','label' => $langs->trans("DeliveryDate"),'value' => $object->date_livraison);
|
||||
}
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
// Incomplete payment. We ask if reason = discount or other
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
@ -1927,7 +1927,7 @@ if ($action == 'create')
|
||||
elseif ($action == 'validate') {
|
||||
$error = 0;
|
||||
|
||||
// We verifie whether the object is provisionally numbering
|
||||
// We verify whether the object is provisionally numbering
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV') {
|
||||
$numref = $object->getNextNumRef($soc);
|
||||
|
||||
@ -170,9 +170,10 @@ if ($object->id > 0)
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -125,9 +125,10 @@ if ($object->id > 0)
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -86,9 +86,10 @@ if (! empty($conf->projet->enabled))
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -101,9 +101,10 @@ if ($id > 0 || ! empty($ref))
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -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
|
||||
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
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
|
||||
print '<td class="linkedcol-ref" >'.$objectlink->ref_client.'</td>';
|
||||
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
|
||||
print '<td class="linkedcol-amount right">';
|
||||
if ($user->rights->propale->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
|
||||
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
?>
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td class="center"></td>
|
||||
<td class="center"></td>
|
||||
<td class="right"><?php echo price($total); ?></td>
|
||||
<td class="right"></td>
|
||||
<td class="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
print '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="center"></td>';
|
||||
print '<td class="center"></td>';
|
||||
print '<td class="right">'.price($total).'</td>';
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
print "<!-- END PHP TEMPLATE -->\n";
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -427,8 +427,9 @@ if ($id)
|
||||
$morehtmlref.=$langs->trans('Project') . ' ';
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -92,8 +92,9 @@ if ($object->id)
|
||||
$morehtmlref.=$langs->trans('Project') . ' : ';
|
||||
if ($user->rights->banque->modifier && 0)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -61,8 +61,9 @@ if (! empty($conf->projet->enabled))
|
||||
$morehtmlref.=$langs->trans('Project') . ' : ';
|
||||
if ($user->rights->banque->modifier && 0)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -815,7 +815,9 @@ if (empty($reshook))
|
||||
$sql .= " WHERE fk_facture = " . $object->id;
|
||||
$resql = $db->query($sql);
|
||||
if (!empty($resql)) {
|
||||
while ($obj = $db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc;
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$total_creditnote_and_deposit += $obj->amount_ttc;
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
|
||||
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc;
|
||||
@ -3274,11 +3276,11 @@ if ($action == 'create')
|
||||
print '<td colspan="2">';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
$liste = ModelePDFFactures::liste_modeles($db);
|
||||
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){ // Hidden conf
|
||||
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){
|
||||
// Hidden conf
|
||||
$paramkey='FACTURE_ADDON_PDF_'.$object->type;
|
||||
$curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$curent = $conf->global->FACTURE_ADDON_PDF;
|
||||
}
|
||||
print $form->selectarray('model', $liste, $curent);
|
||||
@ -3803,8 +3805,9 @@ elseif ($id > 0 || ! empty($ref))
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($usercancreate)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -529,8 +529,7 @@ class Invoices extends DolibarrApi
|
||||
// update bank account
|
||||
if (!empty($this->invoice->fk_account))
|
||||
{
|
||||
if($this->invoice->setBankAccount($this->invoice->fk_account) == 0)
|
||||
{
|
||||
if ($this->invoice->setBankAccount($this->invoice->fk_account) == 0) {
|
||||
throw new RestException(400, $this->invoice->error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2587,10 +2587,12 @@ class Facture extends CommonInvoice
|
||||
$next_invoice->brouillon = 1;
|
||||
foreach ($next_invoice->lines as $line)
|
||||
{
|
||||
$result = $next_invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent,
|
||||
$result = $next_invoice->updateline(
|
||||
$line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent,
|
||||
$line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type,
|
||||
$line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent,
|
||||
$line->fk_unit);
|
||||
$line->fk_unit
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@ -163,9 +163,10 @@ if ($id > 0 || ! empty($ref))
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -1242,8 +1242,9 @@ else
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -223,8 +223,9 @@ $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,
|
||||
$sql.= " f.datec, f.tms,";
|
||||
$sql.= " f.fk_cond_reglement, f.fk_mode_reglement";
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label']))
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
@ -632,8 +633,7 @@ if ($resql)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (! empty($arrayfields['status']['checked'])) {
|
||||
print '<td align="center">';
|
||||
print $invoicerectmp->getLibStatut(3, 0);
|
||||
print '</td>';
|
||||
|
||||
@ -400,8 +400,9 @@ $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label']))
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -1352,8 +1353,7 @@ if ($resql)
|
||||
|| isset($totalarray['totalttcfield'])
|
||||
|| isset($totalarray['totalamfield'])
|
||||
|| isset($totalarray['totalrtpfield'])
|
||||
)
|
||||
{
|
||||
) {
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
|
||||
@ -189,9 +189,10 @@ if ($object->id > 0)
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -233,8 +233,6 @@ 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.'">';
|
||||
@ -274,7 +272,6 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
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,16 +36,16 @@ $langs->load("bills");
|
||||
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$total=0;
|
||||
$ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||
<td class="linkedcol-element"><?php
|
||||
print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
|
||||
print '<td class="linkedcol-element">';
|
||||
switch ($objectlink->type) {
|
||||
case Facture::TYPE_REPLACEMENT:
|
||||
echo $langs->trans("InvoiceReplacement");
|
||||
@ -70,16 +66,16 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
echo $langs->trans("CustomerInvoice");
|
||||
break;
|
||||
}
|
||||
?></td>
|
||||
<td class="linkedcol-name nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref left"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
|
||||
<td class="linkedcol-amount right"><?php
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-name nowraponall">'.$objectlink->getNomUrl(1).'</td>';
|
||||
print '<td class="linkedcol-ref left">'.$objectlink->ref_client.'</td>';
|
||||
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
|
||||
print '<td class="linkedcol-amount right">';
|
||||
if ($user->rights->facture->lire) {
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
|
||||
if ($objectlink->statut != 3) // If not abandonned
|
||||
{
|
||||
if ($objectlink->statut != 3) {
|
||||
// If not abandonned
|
||||
$total = $total + $sign * $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
@ -87,26 +83,23 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
}
|
||||
} ?></td>
|
||||
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
|
||||
print '<td class="linkedcol-action right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
?>
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td class="center"></td>
|
||||
<td class="center"></td>
|
||||
<td class="right"><?php echo price($total); ?></td>
|
||||
<td class="right"></td>
|
||||
<td class="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
print '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="center"></td>';
|
||||
print '<td class="center"></td>';
|
||||
print '<td class="right">'.price($total).'</td>';
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
print "<!-- END PHP TEMPLATE -->\n";
|
||||
|
||||
@ -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,7 +36,8 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$total=0;
|
||||
$ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
@ -55,7 +54,8 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
if ($user->rights->facture->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
}
|
||||
?></td>
|
||||
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
@ -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,8 +320,6 @@ else
|
||||
$span=$columns;
|
||||
if ($modetax != 1) $span+=2;
|
||||
|
||||
//if ($modetax == 0 || $modetax == 2)
|
||||
//{
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="left">'.$elementcust.'</td>';
|
||||
@ -481,9 +479,7 @@ else
|
||||
print '<tr><td colspan="'.($span+1).'"> </td></tr>';
|
||||
print '</table>';
|
||||
$diff=$x_coll_sum;
|
||||
//}
|
||||
|
||||
//if($conf->global->$calc ==0 || $conf->global->$calc == 1){
|
||||
echo '<table class="noborder" width="100%">';
|
||||
//print table headers for this quadri - expenses now
|
||||
print '<tr class="liste_titre">';
|
||||
@ -636,7 +632,6 @@ else
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
//}
|
||||
|
||||
// Total to pay
|
||||
print '<br><br>';
|
||||
|
||||
@ -1894,8 +1894,8 @@ class BonPrelevement extends CommonObject
|
||||
$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;
|
||||
|
||||
@ -749,17 +749,17 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$sql.= " AND fk_statut in (1,2)";
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
|
||||
$sql.= " AND fk_statut >= 2";
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
if (! empty($date_start) && ! empty($date_end)) {
|
||||
$sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
||||
|
||||
|
||||
@ -454,8 +454,9 @@ if ($id > 0)
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -241,15 +241,13 @@ if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||
}
|
||||
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
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)
|
||||
{
|
||||
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>';
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
|
||||
@ -1219,10 +1219,10 @@ class Contact extends CommonObject
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ $sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town,
|
||||
// socialnetworks->>'$.facebook' as facebook
|
||||
$sql.= " p.socialnetworks,";
|
||||
$sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||
$sql.= " co.code as country_code";
|
||||
$sql.= " co.label as country, co.code as country_code";
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
@ -799,6 +799,8 @@ while ($i < min($num, $limit))
|
||||
$contactstatic->zip=$obj->zip;
|
||||
$contactstatic->town=$obj->town;
|
||||
$contactstatic->socialnetworks = $arraysocialnetworks;
|
||||
$contactstatic->country = $obj->country;
|
||||
$contactstatic->country_code = $obj->country_code;
|
||||
|
||||
// ID
|
||||
if (! empty($arrayfields['p.rowid']['checked']))
|
||||
|
||||
@ -164,8 +164,9 @@ if ($id > 0)
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -331,9 +331,8 @@ if (empty($reshook))
|
||||
|
||||
// Extrafields
|
||||
$array_options = array();
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
||||
// trigger used
|
||||
{
|
||||
// For avoid conflicts if trigger used
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
||||
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
@ -1419,8 +1418,9 @@ else
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -706,8 +706,9 @@ while ($i < min($num, $limit))
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td class="right">';
|
||||
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
||||
if ($obj->cstatut == 0)
|
||||
{
|
||||
// If contract is draft, we say line is also draft
|
||||
print $contractstatic->LibStatut(0, 5);
|
||||
}
|
||||
else
|
||||
|
||||
@ -23,11 +23,9 @@ if (empty($conf) || ! is_object($conf))
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
print "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
@ -65,8 +63,9 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
echo price($totalcontrat);
|
||||
} ?></td>
|
||||
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
|
||||
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
print "<!-- END PHP TEMPLATE -->\n";
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -82,8 +82,8 @@ elseif (GETPOST('linkit', 'none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
$urlfile = GETPOST('urlfile', 'alpha', 0, null, null, 1); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
if (GETPOST('section', 'alpha')) // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir
|
||||
{
|
||||
if (GETPOST('section', 'alpha')) {
|
||||
// For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir
|
||||
$file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile;
|
||||
}
|
||||
else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
|
||||
@ -94,8 +94,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
}
|
||||
$linkid = GETPOST('linkid', 'int');
|
||||
|
||||
if ($urlfile) // delete of a file
|
||||
{
|
||||
if ($urlfile) {
|
||||
// delete of a file
|
||||
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
|
||||
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette (if file is an image)
|
||||
|
||||
@ -118,8 +118,11 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
}
|
||||
}
|
||||
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
|
||||
if ($ret) {
|
||||
setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
|
||||
}
|
||||
}
|
||||
elseif ($linkid) // delete of external link
|
||||
{
|
||||
@ -140,10 +143,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($object) && $object->id > 0)
|
||||
{
|
||||
if ($backtopage)
|
||||
{
|
||||
if (is_object($object) && $object->id > 0) {
|
||||
if ($backtopage) {
|
||||
header('Location: ' . $backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -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,7 +4612,7 @@ 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='';
|
||||
|
||||
@ -4638,7 +4638,9 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$file='';
|
||||
$classname='';
|
||||
$filefound=0;
|
||||
$dirmodels=array('/');
|
||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels, $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
@ -4778,8 +4780,7 @@ abstract class CommonObject
|
||||
$setsharekey=true;
|
||||
}
|
||||
|
||||
if ($setsharekey)
|
||||
{
|
||||
if ($setsharekey) {
|
||||
if (empty($ecmfile->share)) // Because object not found or share not set yet
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
@ -4795,8 +4796,7 @@ abstract class CommonObject
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
@ -4814,8 +4814,7 @@ abstract class CommonObject
|
||||
$ecmfile->src_object_id = $this->id;
|
||||
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
@ -4834,9 +4833,9 @@ abstract class CommonObject
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) dol_print_error($this->db);
|
||||
else
|
||||
{
|
||||
if (! $resql) {
|
||||
dol_print_error($this->db);
|
||||
} else {
|
||||
$this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename;
|
||||
}
|
||||
}
|
||||
@ -6070,8 +6069,9 @@ abstract class CommonObject
|
||||
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
|
||||
}
|
||||
}
|
||||
if (empty($labeltoshow))
|
||||
if (empty($labeltoshow)) {
|
||||
$labeltoshow = '(not defined)';
|
||||
}
|
||||
|
||||
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
|
||||
@ -5835,10 +5835,11 @@ class Form
|
||||
* @param string $moreparams More params provided to ajax call
|
||||
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
||||
* @param int $disabled 1=Html component is disabled
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @return string Return HTML string
|
||||
* @see selectForFormsList() select_thirdparty
|
||||
*/
|
||||
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0)
|
||||
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '')
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
@ -5870,20 +5871,28 @@ class Form
|
||||
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
|
||||
|
||||
$out='';
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->$confkeyforautocompletemode) && ! $forcecombo)
|
||||
{
|
||||
// No immediate load of all database
|
||||
$placeholder='';
|
||||
if ($preselectedvalue && empty($selected_input_value))
|
||||
{
|
||||
$objecttmp->fetch($preselectedvalue);
|
||||
$selected_input_value=($prefixforautocompletemode == 'company' ? $objecttmp->name : $objecttmp->ref);
|
||||
//unset($objecttmp);
|
||||
}
|
||||
|
||||
$objectdesc=$classname.':'.$classpath.':'.$addcreatebuttonornot.':'.$filter;
|
||||
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
|
||||
|
||||
// No immediate load of all database
|
||||
$urloption='htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.($moreparams?$moreparams:'');
|
||||
$urloption='htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter).($moreparams?$moreparams:'');
|
||||
// Activate the auto complete using ajax call.
|
||||
$out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
||||
$out.= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
||||
if ($placeholder) $placeholder=' placeholder="'.$placeholder.'"';
|
||||
$out.= '<input type="text" class="'.$morecss.'"'.($disabled?' disabled="disabled"':'').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
|
||||
$out.= '<input type="text" class="'.$morecss.'"'.($disabled?' disabled="disabled"':'').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -76,10 +76,9 @@ class FormContract
|
||||
if ($socid > 0)
|
||||
{
|
||||
// CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
||||
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY))
|
||||
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
|
||||
$sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
|
||||
elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all')
|
||||
{
|
||||
} elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') {
|
||||
$sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") ";
|
||||
$sql.= " OR c.fk_soc IS NULL)";
|
||||
}
|
||||
|
||||
@ -41,9 +41,21 @@ class FormMail extends Form
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $withform; // 1=Include HTML form tag and show submit button, 0=Do not include form tag and submit button, -1=Do not include form tag but include submit button
|
||||
/**
|
||||
* @var int 1 = Include HTML form tag and show submit button
|
||||
* 0 = Do not include form tag and submit button
|
||||
* -1 = Do not include form tag but include submit button
|
||||
*/
|
||||
public $withform;
|
||||
|
||||
/**
|
||||
* @var string name from
|
||||
*/
|
||||
public $fromname;
|
||||
|
||||
/**
|
||||
* @var string email from
|
||||
*/
|
||||
public $frommail;
|
||||
|
||||
/**
|
||||
@ -52,10 +64,15 @@ class FormMail extends Form
|
||||
public $fromtype;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
* @var int from ID
|
||||
*/
|
||||
public $fromid;
|
||||
|
||||
/**
|
||||
* @var int also from robot
|
||||
*/
|
||||
public $fromalsorobot;
|
||||
|
||||
/**
|
||||
* @var string thirdparty etc
|
||||
*/
|
||||
@ -66,10 +83,29 @@ class FormMail extends Form
|
||||
*/
|
||||
public $toid;
|
||||
|
||||
/**
|
||||
* @var string replyto name
|
||||
*/
|
||||
public $replytoname;
|
||||
|
||||
/**
|
||||
* @var string replyto email
|
||||
*/
|
||||
public $replytomail;
|
||||
|
||||
/**
|
||||
* @var string to name
|
||||
*/
|
||||
public $toname;
|
||||
|
||||
/**
|
||||
* @var string to email
|
||||
*/
|
||||
public $tomail;
|
||||
|
||||
/**
|
||||
* @var string trackid
|
||||
*/
|
||||
public $trackid;
|
||||
|
||||
public $withsubstit; // Show substitution array
|
||||
|
||||
@ -139,8 +139,7 @@ class Menubase
|
||||
{
|
||||
$sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
|
||||
$resqlrowid=$this->db->query($sql);
|
||||
if ($resqlrowid)
|
||||
{
|
||||
if ($resqlrowid) {
|
||||
$obj=$this->db->fetch_object($resqlrowid);
|
||||
$maxrowid=$obj->maxrowid;
|
||||
|
||||
|
||||
@ -220,8 +220,7 @@ class DoliDBMssql extends DoliDB
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
if ($this->db)
|
||||
{
|
||||
if ($this->db) {
|
||||
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR);
|
||||
$this->connected=false;
|
||||
return mssql_close($this->db);
|
||||
|
||||
@ -1135,13 +1135,16 @@ class DoliDBPgsql extends DoliDB
|
||||
$sql .= " ".$field_desc['attribute'];
|
||||
if (preg_match("/^[^\s]/i", $field_desc['null']))
|
||||
$sql .= " ".$field_desc['null'];
|
||||
if (preg_match("/^[^\s]/i", $field_desc['default']))
|
||||
if (preg_match("/null/i", $field_desc['default']))
|
||||
if (preg_match("/^[^\s]/i", $field_desc['default'])) {
|
||||
if (preg_match("/null/i", $field_desc['default'])) {
|
||||
$sql .= " default ".$field_desc['default'];
|
||||
else
|
||||
} else {
|
||||
$sql .= " default '".$field_desc['default']."'";
|
||||
if (preg_match("/^[^\s]/i", $field_desc['extra']))
|
||||
}
|
||||
}
|
||||
if (preg_match("/^[^\s]/i", $field_desc['extra'])) {
|
||||
$sql .= " ".$field_desc['extra'];
|
||||
}
|
||||
$sql .= " ".$field_position;
|
||||
|
||||
dol_syslog($sql, LOG_DEBUG);
|
||||
|
||||
@ -670,7 +670,45 @@ function security_prepare_head()
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
* @param object $object descriptor class
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function modulehelp_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
// FIX for compatibity habitual tabs
|
||||
$object->id = $object->numero;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$object->id.'&mode=desc';
|
||||
$head[$h][1] = $langs->trans("Description");
|
||||
$head[$h][2] = 'desc';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$object->id.'&mode=feature';
|
||||
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
|
||||
$head[$h][2] = 'feature';
|
||||
$h++;
|
||||
|
||||
if ($object->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$object->id.'&mode=changelog';
|
||||
$head[$h][1] = $langs->trans("ChangeLog");
|
||||
$head[$h][2] = 'changelog';
|
||||
$h++;
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'modulehelp_admin');
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'modulehelp_admin', 'remove');
|
||||
|
||||
|
||||
return $head;
|
||||
}
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
|
||||
@ -237,6 +237,7 @@ function show_array_actions_to_do($max = 5)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo", $max).'</th>';
|
||||
print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=todo">'.$langs->trans("FullList").'</a></th>';
|
||||
@ -292,7 +293,7 @@ function show_array_actions_to_do($max = 5)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
print "</table></div><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
@ -334,6 +335,7 @@ function show_array_last_actions_done($max = 5)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks", $max).'</th>';
|
||||
print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?status=done">'.$langs->trans("FullList").'</a></th>';
|
||||
@ -380,7 +382,7 @@ function show_array_last_actions_done($max = 5)
|
||||
}
|
||||
// TODO Ajouter rappel pour "il y a des contrats a mettre en service"
|
||||
// TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration"
|
||||
print "</table><br>";
|
||||
print "</table></div><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*
|
||||
* @param string $selected Preselected value
|
||||
* @param string $htmlname HTML name of input field
|
||||
* @param string $url Url for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
|
||||
* @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
|
||||
* @param string $urloption More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
|
||||
@ -1848,11 +1848,16 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
|
||||
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
|
||||
|
||||
$count = $image->getNumberImages();
|
||||
|
||||
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
|
||||
{
|
||||
try {
|
||||
$ret = $image->writeImages($fileoutput, true);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Warning: Failed to write cache preview file '.$fileoutput.'. Check permission on file/dir", LOG_ERR);
|
||||
|
||||
@ -313,8 +313,14 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
{
|
||||
if (empty($user->rights->$feature->$subfeature->creer)
|
||||
&& empty($user->rights->$feature->$subfeature->write)
|
||||
&& empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
|
||||
else { $createok=1; break; } // Break to bypass second test if the first is ok
|
||||
&& empty($user->rights->$feature->$subfeature->create)) {
|
||||
$createok=0;
|
||||
$nbko++;
|
||||
} else {
|
||||
$createok=1;
|
||||
// Break to bypass second test if the first is ok
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (! empty($feature)) // This is for permissions on 2 levels ('creer' or 'write')
|
||||
@ -322,7 +328,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
|
||||
if (empty($user->rights->$feature->creer)
|
||||
&& empty($user->rights->$feature->write)
|
||||
&& empty($user->rights->$feature->create)) { $createok=0; $nbko++; }
|
||||
&& empty($user->rights->$feature->create)) {
|
||||
$createok=0;
|
||||
$nbko++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -723,10 +723,8 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$out.="</span>\n";
|
||||
|
||||
// Ref
|
||||
|
||||
$out.='<h3 class="timeline-header">';
|
||||
|
||||
|
||||
// Author of event
|
||||
$out.='<span class="messaging-author">';
|
||||
if ($histo[$key]['userid'] > 0)
|
||||
@ -739,11 +737,9 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
}
|
||||
$out.='</span>';
|
||||
|
||||
|
||||
// Title
|
||||
$out .= ' <span class="messaging-title">';
|
||||
|
||||
|
||||
if($actionstatic->code == 'TICKET_MSG') {
|
||||
$out .= $langs->trans('TicketNewMessage');
|
||||
}
|
||||
|
||||
@ -240,7 +240,6 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('main', 'other', 'errors'));
|
||||
;
|
||||
$_SESSION["dol_loginmesg"]=($ldap->error?$ldap->error:$langs->trans("ErrorBadLoginPassword"));
|
||||
}
|
||||
|
||||
|
||||
@ -307,10 +307,12 @@ class MenuManager
|
||||
print $val2['titre'];
|
||||
if ($relurl2)
|
||||
{
|
||||
if ($val2['enabled']) // Allowed
|
||||
if ($val2['enabled']) {
|
||||
// Allowed
|
||||
print '</a>';
|
||||
else
|
||||
} else {
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
print '</li>'."\n";
|
||||
}
|
||||
|
||||
@ -49,7 +49,10 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
public $code_auto; // Automatic Numbering
|
||||
/**
|
||||
* @var int Automatic numbering
|
||||
*/
|
||||
public $code_auto;
|
||||
|
||||
public $searchcode; // Search string
|
||||
|
||||
|
||||
518
htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
Normal file
518
htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
Normal file
@ -0,0 +1,518 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
|
||||
* \ingroup bom
|
||||
* \brief File of class to build ODT documents for BOMs
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/bom/modules_bom.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to build documents using ODF templates generator
|
||||
*/
|
||||
class doc_generic_bom_odt extends ModelePDFBOMs
|
||||
{
|
||||
/**
|
||||
* Issuer
|
||||
* @var Societe
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
/**
|
||||
* @var array Minimum version of PHP required by module.
|
||||
* e.g.: PHP ≥ 5.5 = array(5, 5)
|
||||
*/
|
||||
public $phpmin = array(5, 5);
|
||||
|
||||
/**
|
||||
* @var string Dolibarr version of the loaded document
|
||||
*/
|
||||
public $version = 'dolibarr';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("main","companies"));
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "ODT templates";
|
||||
$this->description = $langs->trans("DocumentModelOdt");
|
||||
$this->scandir = 'BOM_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
|
||||
|
||||
// Page size for A4 format
|
||||
$this->type = 'odt';
|
||||
$this->page_largeur = 0;
|
||||
$this->page_hauteur = 0;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=0;
|
||||
$this->marge_droite=0;
|
||||
$this->marge_haute=0;
|
||||
$this->marge_basse=0;
|
||||
|
||||
$this->option_logo = 1; // Affiche logo
|
||||
$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
|
||||
$this->option_modereg = 0; // Affiche mode reglement
|
||||
$this->option_condreg = 0; // Affiche conditions reglement
|
||||
$this->option_codeproduitservice = 0; // Affiche code produit-service
|
||||
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||
$this->option_escompte = 0; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 0; // Support credit notes
|
||||
$this->option_freetext = 1; // Support add of a personalised text
|
||||
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
|
||||
|
||||
// Recupere emetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return description of a module
|
||||
*
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @return string Description
|
||||
*/
|
||||
public function info($langs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors","companies"));
|
||||
|
||||
$form = new Form($this->db);
|
||||
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte.= '<input type="hidden" name="param1" value="BOM_ADDON_PDF_ODT_PATH">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
// List of directories area
|
||||
$texte.= '<tr><td>';
|
||||
$texttitle=$langs->trans("ListOfDirectories");
|
||||
$listofdir=explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->BOM_ADDON_PDF_ODT_PATH)));
|
||||
$listoffiles=array();
|
||||
foreach($listofdir as $key=>$tmpdir)
|
||||
{
|
||||
$tmpdir=trim($tmpdir);
|
||||
$tmpdir=preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
|
||||
if (! $tmpdir) {
|
||||
unset($listofdir[$key]); continue;
|
||||
}
|
||||
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
|
||||
else
|
||||
{
|
||||
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
|
||||
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
|
||||
}
|
||||
}
|
||||
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
|
||||
// Add list of substitution keys
|
||||
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
|
||||
$texte.= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
|
||||
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
|
||||
$texte.= '<textarea class="flat" cols="60" name="value1">';
|
||||
$texte.=$conf->global->BOM_ADDON_PDF_ODT_PATH;
|
||||
$texte.= '</textarea>';
|
||||
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
$nbofiles=count($listoffiles);
|
||||
if (! empty($conf->global->BOM_ADDON_PDF_ODT_PATH))
|
||||
{
|
||||
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
|
||||
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
|
||||
$texte.=count($listoffiles);
|
||||
//$texte.=$nbofiles?'</a>':'';
|
||||
$texte.='</b>';
|
||||
}
|
||||
|
||||
if ($nbofiles)
|
||||
{
|
||||
$texte.='<div id="div_'.get_class($this).'" class="hidden">';
|
||||
foreach($listoffiles as $file)
|
||||
{
|
||||
$texte.=$file['name'].'<br>';
|
||||
}
|
||||
$texte.='<div id="div_'.get_class($this).'">';
|
||||
}
|
||||
|
||||
$texte.= '</td>';
|
||||
|
||||
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
|
||||
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';
|
||||
|
||||
$texte.= '</table>';
|
||||
$texte.= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
* @param Commande $object Object source to build document
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||
|
||||
if (empty($srctemplatepath))
|
||||
{
|
||||
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
$outputlangs->charset_output='UTF-8';
|
||||
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
// If $object is id instead of object
|
||||
if (! is_object($object))
|
||||
{
|
||||
$id = $object;
|
||||
$object = new Commande($this->db);
|
||||
$result=$object->fetch($id);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($this->db, $object->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$dir = $conf->commande->multidir_output[$object->entity];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".odt";
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
//print "srctemplatepath=".$srctemplatepath; // Src filename
|
||||
$newfile=basename($srctemplatepath);
|
||||
$newfiletmp=preg_replace('/\.od(t|s)/i', '', $newfile);
|
||||
$newfiletmp=preg_replace('/template_/i', '', $newfiletmp);
|
||||
$newfiletmp=preg_replace('/modele_/i', '', $newfiletmp);
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
|
||||
// Get extension (ods or odt)
|
||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||
{
|
||||
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||
$filename=$newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$newfiletmp.'.'.$newfileformat;
|
||||
}
|
||||
$file=$dir.'/'.$filename;
|
||||
//print "newdir=".$dir;
|
||||
//print "newfile=".$newfile;
|
||||
//print "file=".$file;
|
||||
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
|
||||
|
||||
dol_mkdir($conf->bom->dir_temp);
|
||||
|
||||
|
||||
// If CUSTOMER contact defined on order, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external', 'CUSTOMER');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
$contactobject=null;
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->name,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Line of free text
|
||||
$newfreetext='';
|
||||
$paramfreetext='ORDER_FREE_TEXT';
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray);
|
||||
}
|
||||
|
||||
// Open and load template
|
||||
require_once ODTPHP_PATH.'odf.php';
|
||||
try {
|
||||
$odfHandler = new odf(
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->commande->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
)
|
||||
);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
// After construction $odfHandler->contentXml contains content and
|
||||
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
|
||||
// [!-- BEGIN lines --]*[!-- END lines --]
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
try {
|
||||
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object, $outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user, $outputlangs);
|
||||
$array_soc=$this->get_substitutionarray_mysoc($mysoc, $outputlangs);
|
||||
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject, $outputlangs);
|
||||
$array_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in object as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
|
||||
|
||||
$tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/', $key)) // Image
|
||||
{
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line, $outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Replace labels translated
|
||||
$tmparray=$outputlangs->get_translations_for_substitutions();
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
try {
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
}catch (Exception $e){
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$odfHandler->saveToDisk($file);
|
||||
} catch (Exception $e) {
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@
|
||||
/**
|
||||
* \file htdocs/core/modules/bom/mod_bom_advanced.php
|
||||
* \ingroup bom
|
||||
* \brief File containing class for numbering model of bom advanced
|
||||
* \brief File containing class for numbering model of BOMs advanced
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php';
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/core/modules/bom/mod_bom_standard.php
|
||||
* \ingroup bom
|
||||
* \brief File of class to manage customer order numbering rules standard
|
||||
* \brief File of class to manage BOMs numbering rules standard
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php';
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ abstract class ModelePDFBoms extends CommonDocGenerator
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'order';
|
||||
$type = 'bom';
|
||||
$list = array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
@ -952,8 +952,6 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1107,7 +1107,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
if ($tvakey!=0) // On affiche pas taux 0
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
@ -1139,8 +1138,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
|
||||
@ -53,6 +53,9 @@ class mod_contract_magre extends ModelNumRefContracts
|
||||
*/
|
||||
public $name='Magre';
|
||||
|
||||
/**
|
||||
* @var int Automatic numbering
|
||||
*/
|
||||
public $code_auto=1;
|
||||
|
||||
/**
|
||||
|
||||
@ -58,7 +58,10 @@ class mod_contract_olive extends ModelNumRefContracts
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
public $code_auto = 0; // Numerotation automatique
|
||||
/**
|
||||
* @var int Automatic numbering
|
||||
*/
|
||||
public $code_auto = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -53,6 +53,9 @@ class mod_contract_serpis extends ModelNumRefContracts
|
||||
*/
|
||||
public $name='Serpis';
|
||||
|
||||
/**
|
||||
* @var int Automatic numbering
|
||||
*/
|
||||
public $code_auto=1;
|
||||
|
||||
|
||||
|
||||
@ -324,8 +324,7 @@ class html_cerfafr extends ModeleDon
|
||||
if ($unite[$i]==1) {
|
||||
$secon[$i]='vingt et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$secon[$i]='vingt';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
@ -334,8 +333,7 @@ class html_cerfafr extends ModeleDon
|
||||
if ($unite[$i]==1) {
|
||||
$secon[$i]='trente et';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$secon[$i]='trente';
|
||||
$prim[$i]=$chif[$unite[$i]];
|
||||
}
|
||||
|
||||
@ -218,10 +218,9 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
|
||||
$realpath='';
|
||||
|
||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
|
||||
{
|
||||
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
|
||||
{
|
||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
|
||||
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) {
|
||||
// If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename= $obj['photo_vignette'];
|
||||
|
||||
@ -139,19 +139,19 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if($db->num_rows($result) > 0):
|
||||
if ($db->num_rows($result) > 0) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$newref = $objp->max;
|
||||
$newref++;
|
||||
while(strlen($newref) < $num_car):
|
||||
while (strlen($newref) < $num_car) {
|
||||
$newref = "0".$newref;
|
||||
endwhile;
|
||||
else:
|
||||
}
|
||||
} else {
|
||||
$newref = 1;
|
||||
while(strlen($newref) < $num_car):
|
||||
while (strlen($newref) < $num_car) {
|
||||
$newref = "0".$newref;
|
||||
endwhile;
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
$ref_number_int = ($newref+1)-1;
|
||||
|
||||
|
||||
@ -1271,8 +1271,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
//Local tax 1 after VAT
|
||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
||||
//{
|
||||
foreach($this->localtax1 as $localtax_type => $localtax_rate)
|
||||
{
|
||||
foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
|
||||
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
|
||||
|
||||
foreach($localtax_rate as $tvakey => $tvaval)
|
||||
|
||||
@ -769,10 +769,12 @@ class pdf_sponge extends ModelePDFFactures
|
||||
}
|
||||
|
||||
// retrieve global local tax
|
||||
if ($localtax1_type && $localtax1ligne != 0)
|
||||
if ($localtax1_type && $localtax1ligne != 0) {
|
||||
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
|
||||
if ($localtax2_type && $localtax2ligne != 0)
|
||||
}
|
||||
if ($localtax2_type && $localtax2ligne != 0) {
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
}
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
|
||||
@ -781,8 +783,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
@ -793,11 +794,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$nexY+=2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
{
|
||||
while ($pagenb < $pageposafter) {
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == $pageposbeforeprintlines)
|
||||
{
|
||||
if ($pagenb == $pageposbeforeprintlines) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
@ -811,10 +810,8 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||
{
|
||||
if ($pagenb == $pageposafter)
|
||||
{
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) {
|
||||
if ($pagenb == $pageposafter) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
|
||||
}
|
||||
else
|
||||
@ -1270,9 +1267,6 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->setY($tab2_top);
|
||||
$posy = $pdf->GetY();
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($TPreviousIncoice as &$fac) {
|
||||
if($posy > $this->page_hauteur - 4 ) {
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
@ -1453,8 +1447,6 @@ class pdf_sponge extends ModelePDFFactures
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
@ -1473,7 +1465,6 @@ class pdf_sponge extends ModelePDFFactures
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
// VAT
|
||||
|
||||
@ -53,6 +53,9 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
|
||||
*/
|
||||
public $name='Immaculate';
|
||||
|
||||
/**
|
||||
* @var int Automatic numbering
|
||||
*/
|
||||
public $code_auto=1;
|
||||
|
||||
/**
|
||||
|
||||
@ -54,6 +54,9 @@ class mod_holiday_madonna extends ModelNumRefHolidays
|
||||
*/
|
||||
public $name='Madonna';
|
||||
|
||||
/**
|
||||
* @var int Automatic numbering
|
||||
*/
|
||||
public $code_auto=1;
|
||||
|
||||
|
||||
|
||||
@ -255,7 +255,9 @@ class mailing_fraise extends MailingTargets
|
||||
$sql.= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
|
||||
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$this->db->escape($mailing_id).")";
|
||||
// Filter on status
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') {
|
||||
$sql.= " AND a.statut=-1";
|
||||
}
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND a.statut=0";
|
||||
|
||||
@ -291,8 +291,7 @@ class mailing_thirdparties extends MailingTargets
|
||||
$s.= $langs->trans('ProspectCustomer');
|
||||
$s.=': <select name="filter_client" class="flat">';
|
||||
$s.= '<option value="-1"> </option>';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
|
||||
$s.= '<option value="2">'.$langs->trans('Prospect').'</option>';
|
||||
}
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
|
||||
|
||||
@ -189,9 +189,7 @@ class modBom extends DolibarrModules
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in bom/core/boxes that contains class to show a widget.
|
||||
$this->boxes = array(
|
||||
//0=>array('file'=>'bomwidget1.php@bom','note'=>'Widget provided by Bom','enabledbydefaulton'=>'Home'),
|
||||
//1=>array('file'=>'bomwidget2.php@bom','note'=>'Widget provided by Bom'),
|
||||
//2=>array('file'=>'bomwidget3.php@bom','note'=>'Widget provided by Bom')
|
||||
0=>array('file'=>'box_boms.php','note'=>'','enabledbydefaulton'=>'Home')
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -72,7 +72,8 @@ class modComptabilite extends DolibarrModules
|
||||
$this->const = array();
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array("/comptabilite/temp",
|
||||
$this->dirs = array(
|
||||
"/comptabilite/temp",
|
||||
"/comptabilite/rapport",
|
||||
"/comptabilite/export",
|
||||
"/comptabilite/bordereau"
|
||||
|
||||
@ -298,8 +298,7 @@ class modExpedition extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extraprod ON p.rowid = extraprod.fk_object';
|
||||
if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT))
|
||||
{
|
||||
if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) {
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object';
|
||||
|
||||
@ -206,12 +206,7 @@ class modMrp extends DolibarrModules
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in mrp/core/boxes that contains a class to show a widget.
|
||||
$this->boxes = array(
|
||||
// 0 => array(
|
||||
// 'file' => 'mrpwidget1.php@mrp',
|
||||
// 'note' => 'Widget provided by Mrp',
|
||||
// 'enabledbydefaulton' => 'Home',
|
||||
// ),
|
||||
// ...
|
||||
0 => array('file' => 'box_mos.php', 'note' => '', 'enabledbydefaulton' => 'Home')
|
||||
);
|
||||
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
@ -223,8 +223,7 @@ class modReception extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch_extrafields as extra2 ON ed.rowid = extra2.fk_object';
|
||||
$this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid';
|
||||
if ($idcontacts && ! empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT))
|
||||
{
|
||||
if ($idcontacts && ! empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) {
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object';
|
||||
|
||||
@ -82,8 +82,8 @@ class modStripe extends DolibarrModules
|
||||
// New pages on tabs
|
||||
$this->tabs = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(); // List of boxes
|
||||
// List of boxes
|
||||
$this->boxes = array();
|
||||
$r=0;
|
||||
|
||||
// Permissions
|
||||
|
||||
@ -81,8 +81,6 @@ class modTicket extends DolibarrModules
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory
|
||||
'triggers' => 1,
|
||||
// Set this to 1 if module has its own models directory
|
||||
'models' => 1,
|
||||
);
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
|
||||
@ -185,14 +185,12 @@ class modWebsite extends DolibarrModules
|
||||
dol_mkdir($destroot);
|
||||
|
||||
$docs=dol_dir_list($srcroot, 'files', 0, 'website_.*(\.zip|\.jpg)$');
|
||||
foreach($docs as $cursorfile)
|
||||
{
|
||||
foreach($docs as $cursorfile) {
|
||||
$src=$srcroot.'/'.$cursorfile['name'];
|
||||
$dest=$destroot.'/'.$cursorfile['name'];
|
||||
|
||||
$result=dol_copy($src, $dest, 0, 0);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||
}
|
||||
|
||||
518
htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
Normal file
518
htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
Normal file
@ -0,0 +1,518 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
|
||||
* \ingroup mrp
|
||||
* \brief File of class to build ODT documents for MOs
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/bom/modules_bom.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to build documents using ODF templates generator
|
||||
*/
|
||||
class doc_generic_mo_odt extends ModelePDFMOs
|
||||
{
|
||||
/**
|
||||
* Issuer
|
||||
* @var Societe
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
/**
|
||||
* @var array Minimum version of PHP required by module.
|
||||
* e.g.: PHP ≥ 5.5 = array(5, 5)
|
||||
*/
|
||||
public $phpmin = array(5, 5);
|
||||
|
||||
/**
|
||||
* @var string Dolibarr version of the loaded document
|
||||
*/
|
||||
public $version = 'dolibarr';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("main","companies"));
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "ODT templates";
|
||||
$this->description = $langs->trans("DocumentModelOdt");
|
||||
$this->scandir = 'MRP_MO_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
|
||||
|
||||
// Page size for A4 format
|
||||
$this->type = 'odt';
|
||||
$this->page_largeur = 0;
|
||||
$this->page_hauteur = 0;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=0;
|
||||
$this->marge_droite=0;
|
||||
$this->marge_haute=0;
|
||||
$this->marge_basse=0;
|
||||
|
||||
$this->option_logo = 1; // Affiche logo
|
||||
$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
|
||||
$this->option_modereg = 0; // Affiche mode reglement
|
||||
$this->option_condreg = 0; // Affiche conditions reglement
|
||||
$this->option_codeproduitservice = 0; // Affiche code produit-service
|
||||
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||
$this->option_escompte = 0; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 0; // Support credit notes
|
||||
$this->option_freetext = 1; // Support add of a personalised text
|
||||
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
|
||||
|
||||
// Recupere emetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return description of a module
|
||||
*
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @return string Description
|
||||
*/
|
||||
public function info($langs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors","companies"));
|
||||
|
||||
$form = new Form($this->db);
|
||||
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte.= '<input type="hidden" name="param1" value="MRP_MO_ADDON_PDF_ODT_PATH">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
// List of directories area
|
||||
$texte.= '<tr><td>';
|
||||
$texttitle=$langs->trans("ListOfDirectories");
|
||||
$listofdir=explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MRP_MO_ADDON_PDF_ODT_PATH)));
|
||||
$listoffiles=array();
|
||||
foreach($listofdir as $key=>$tmpdir)
|
||||
{
|
||||
$tmpdir=trim($tmpdir);
|
||||
$tmpdir=preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
|
||||
if (! $tmpdir) {
|
||||
unset($listofdir[$key]); continue;
|
||||
}
|
||||
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
|
||||
else
|
||||
{
|
||||
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
|
||||
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
|
||||
}
|
||||
}
|
||||
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
|
||||
// Add list of substitution keys
|
||||
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
|
||||
$texte.= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
|
||||
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
|
||||
$texte.= '<textarea class="flat" cols="60" name="value1">';
|
||||
$texte.=$conf->global->MRP_MO_ADDON_PDF_ODT_PATH;
|
||||
$texte.= '</textarea>';
|
||||
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
$nbofiles=count($listoffiles);
|
||||
if (! empty($conf->global->MRP_MO_ADDON_PDF_ODT_PATH))
|
||||
{
|
||||
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
|
||||
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
|
||||
$texte.=count($listoffiles);
|
||||
//$texte.=$nbofiles?'</a>':'';
|
||||
$texte.='</b>';
|
||||
}
|
||||
|
||||
if ($nbofiles)
|
||||
{
|
||||
$texte.='<div id="div_'.get_class($this).'" class="hidden">';
|
||||
foreach($listoffiles as $file)
|
||||
{
|
||||
$texte.=$file['name'].'<br>';
|
||||
}
|
||||
$texte.='<div id="div_'.get_class($this).'">';
|
||||
}
|
||||
|
||||
$texte.= '</td>';
|
||||
|
||||
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
|
||||
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';
|
||||
|
||||
$texte.= '</table>';
|
||||
$texte.= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
* @param Commande $object Object source to build document
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||
|
||||
if (empty($srctemplatepath))
|
||||
{
|
||||
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
$outputlangs->charset_output='UTF-8';
|
||||
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
// If $object is id instead of object
|
||||
if (! is_object($object))
|
||||
{
|
||||
$id = $object;
|
||||
$object = new Commande($this->db);
|
||||
$result=$object->fetch($id);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($this->db, $object->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$dir = $conf->commande->multidir_output[$object->entity];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".odt";
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
//print "srctemplatepath=".$srctemplatepath; // Src filename
|
||||
$newfile=basename($srctemplatepath);
|
||||
$newfiletmp=preg_replace('/\.od(t|s)/i', '', $newfile);
|
||||
$newfiletmp=preg_replace('/template_/i', '', $newfiletmp);
|
||||
$newfiletmp=preg_replace('/modele_/i', '', $newfiletmp);
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
|
||||
// Get extension (ods or odt)
|
||||
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||
{
|
||||
$format=$conf->global->MAIN_DOC_USE_TIMING;
|
||||
if ($format == '1') $format='%Y%m%d%H%M%S';
|
||||
$filename=$newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$newfiletmp.'.'.$newfileformat;
|
||||
}
|
||||
$file=$dir.'/'.$filename;
|
||||
//print "newdir=".$dir;
|
||||
//print "newfile=".$newfile;
|
||||
//print "file=".$file;
|
||||
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
|
||||
|
||||
dol_mkdir($conf->bom->dir_temp);
|
||||
|
||||
|
||||
// If CUSTOMER contact defined on order, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external', 'CUSTOMER');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
$contactobject=null;
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->name,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Line of free text
|
||||
$newfreetext='';
|
||||
$paramfreetext='ORDER_FREE_TEXT';
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray);
|
||||
}
|
||||
|
||||
// Open and load template
|
||||
require_once ODTPHP_PATH.'odf.php';
|
||||
try {
|
||||
$odfHandler = new odf(
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->commande->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
)
|
||||
);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
// After construction $odfHandler->contentXml contains content and
|
||||
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
|
||||
// [!-- BEGIN lines --]*[!-- END lines --]
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
try {
|
||||
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object, $outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user, $outputlangs);
|
||||
$array_soc=$this->get_substitutionarray_mysoc($mysoc, $outputlangs);
|
||||
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject, $outputlangs);
|
||||
$array_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in object as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
|
||||
|
||||
$tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/', $key)) // Image
|
||||
{
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line, $outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Replace labels translated
|
||||
$tmparray=$outputlangs->get_translations_for_substitutions();
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
try {
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
}catch (Exception $e){
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$odfHandler->saveToDisk($file);
|
||||
} catch (Exception $e) {
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
146
htdocs/core/modules/mrp/mod_mrp_advanced.php
Normal file
146
htdocs/core/modules/mrp/mod_mrp_advanced.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/mod_mrp_advanced.php
|
||||
* \ingroup mrp
|
||||
* \brief File containing class for numbering model of MOs advanced
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage customer Bom numbering rules advanced
|
||||
*/
|
||||
class mod_mrp_advanced extends ModeleNumRefMos
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
/**
|
||||
* @var string Error message
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string name
|
||||
*/
|
||||
public $name='advanced';
|
||||
|
||||
|
||||
/**
|
||||
* Returns the description of the numbering model
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
||||
$texte.= '<input type="hidden" name="maskconstBom" value="MRP_ADVANCED_MASK">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes2");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes3");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Mo"), $langs->transnoentities("Mo"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMo" value="'.$conf->global->MRP_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte.= '<td class="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||
|
||||
$texte.= '</tr>';
|
||||
|
||||
$texte.= '</table>';
|
||||
$texte.= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$old_code_client=$mysoc->code_client;
|
||||
$old_code_type=$mysoc->typent_code;
|
||||
$mysoc->code_client='CCCCCCCCCC';
|
||||
$mysoc->typent_code='TTTTTTTTTT';
|
||||
$numExample = $this->getNextValue($mysoc, '');
|
||||
$mysoc->code_client=$old_code_client;
|
||||
$mysoc->typent_code=$old_code_type;
|
||||
|
||||
if (! $numExample)
|
||||
{
|
||||
$numExample = $langs->trans('NotConfigured');
|
||||
}
|
||||
return $numExample;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Product $objprod Object product
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objprod, $object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask=$conf->global->MRP_ADVANCED_MASK;
|
||||
|
||||
if (! $mask)
|
||||
{
|
||||
$this->error='NotConfigured';
|
||||
return 0;
|
||||
}
|
||||
|
||||
$date = ($object->date_mo ? $object->date_mo : $object->date);
|
||||
|
||||
$numFinal=get_next_value($db, $mask, 'mrp_mo', 'ref', '', null, $date);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
}
|
||||
149
htdocs/core/modules/mrp/mod_mrp_standard.php
Normal file
149
htdocs/core/modules/mrp/mod_mrp_standard.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/mod_mrp_standard.php
|
||||
* \ingroup mrp
|
||||
* \brief File of class to manage MO numbering rules standard
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php';
|
||||
|
||||
/**
|
||||
* Class to manage customer order numbering rules standard
|
||||
*/
|
||||
class mod_mrp_standard extends ModeleNumRefMos
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
public $prefix='MO';
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
/**
|
||||
* @var string name
|
||||
*/
|
||||
public $name='standard';
|
||||
|
||||
|
||||
/**
|
||||
* Return description of numbering module
|
||||
*
|
||||
* @return string Text with description
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
return $this->prefix."0501-0001";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the numbers already in force in the data base do not
|
||||
* cause conflicts that would prevent this numbering from working.
|
||||
*
|
||||
* @return boolean false if conflict, true if ok
|
||||
*/
|
||||
public function canBeActivated()
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
|
||||
$coyymm=''; $max='';
|
||||
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) { $coyymm = substr($row[0], 0, 6); $max=$row[0]; }
|
||||
}
|
||||
if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorNumRefModel', $max);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Product $objprod Object product
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objprod, $object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
// D'abord on recupere la valeur max
|
||||
$posindice=9;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $max = intval($obj->max);
|
||||
else $max=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("mod_mrp_standard::getNextValue", LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//$date=time();
|
||||
$date=$object->date_creation;
|
||||
$yymm = strftime("%y%m", $date);
|
||||
|
||||
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||
else $num = sprintf("%04s", $max+1);
|
||||
|
||||
dol_syslog("mod_mrp_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||
return $this->prefix.$yymm."-".$num;
|
||||
}
|
||||
}
|
||||
151
htdocs/core/modules/mrp/modules_mrp.php
Normal file
151
htdocs/core/modules/mrp/modules_mrp.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/modules_mrp.php
|
||||
* \ingroup bom
|
||||
* \brief File that contains parent class for mos models
|
||||
* and parent class for mos numbering models
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
|
||||
|
||||
|
||||
/**
|
||||
* Parent class for mos models
|
||||
*/
|
||||
abstract class ModelePDFMos extends CommonDocGenerator
|
||||
{
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'mo';
|
||||
$list = array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$list = getListOfModels($db, $type, $maxfilenamelength);
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Parent class to manage numbering of MOs
|
||||
*/
|
||||
abstract class ModeleNumRefMos
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default description of the numbering template
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("mrp");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("mrp");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the numbers already in force in the data base do not
|
||||
* cause conflicts that would prevent this numbering from working.
|
||||
*
|
||||
* @return boolean false if conflict, true if ok
|
||||
*/
|
||||
public function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns next assigned value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns version of numbering module
|
||||
*
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
|
||||
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||
if ($this->version == 'dolibarr') return DOL_VERSION;
|
||||
if ($this->version) return $this->version;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user