Merge remote-tracking branch 'Upstream/develop' into 4.0-p24

This commit is contained in:
aspangaro 2016-04-29 20:47:52 +02:00
commit 35c87972bb
179 changed files with 2884 additions and 1039 deletions

View File

@ -6,8 +6,8 @@ WARNING:
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection"
during migration.
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection" during
migration.
Upgrading to any other version or any other database system is abolutely required BEFORE trying
make a Dolibarr upgrade.
@ -25,6 +25,8 @@ Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expect
Following changes may create regression for some external modules, but were necessary to make
Dolibarr better:
- Function log() of class CommandeFournisseur has been removed. Using it is no more required.
- Class Resource was renamed into DolResource to avoid conflict with a reserved PHP word.
- Method commonobject->add_thumb() has been renamed into commonobject->addThumbs().
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
- Property ->client that was deprecated 6 years ago, is replaced in all core code with ->thirdparty.
- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'.
@ -33,7 +35,6 @@ So if you included it into your module, change your code like this to be compati
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
***** ChangeLog for 3.9.1 compared to 3.9.* *****
FIX: #3815 Call to undefined function local_by_date()
FIX: #4424 Missing email of user popup in supplier orders area

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -379,7 +379,7 @@ if ($nboftargetok) {
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
if ($ret =~ /already exists/)
if ($ret =~ /(already exists|existe déjà)/)
{
print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
$QUESTIONOVERWRITETAG=<STDIN>;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -128,7 +128,9 @@ if ($result)
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
$param='';
$param.="&statut=$statut&date_select=$date_select";
if ($statut != '') $param.="&statut=".$statut;
if ($date_select) $param.="&date_select=".$date_select;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
if ($search_login) $param.="&search_login=".$search_login;
if ($search_acount) $param.="&search_account=".$search_account;
@ -214,7 +216,7 @@ if ($result)
$var=true;
$total=0;
while ($i < $num && $i < $conf->liste_limit)
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
$total+=$objp->cotisation;

View File

@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
@ -226,7 +226,7 @@ $tabsqlsort[28]="country ASC, code ASC";
$tabsqlsort[29]="position ASC";
$tabsqlsort[30]="code ASC";
$tabsqlsort[31]="pcg_version ASC";
$tabsqlsort[32]="code ASC, label ASC";
$tabsqlsort[32]="position ASC";
$tabsqlsort[33]="code ASC";
$tabsqlsort[34]="code ASC";
@ -263,7 +263,7 @@ $tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
$tabfield[29]= "code,label,percent,position";
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
$tabfield[31]= "pcg_version,country_id,country,label";
$tabfield[32]= "code,label,range,position,country_id,country";
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
$tabfield[33]= "code,label";
$tabfield[34]= "code,label";
@ -300,7 +300,7 @@ $tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
$tabfieldvalue[29]= "code,label,percent,position";
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
$tabfieldvalue[31]= "pcg_version,country,label";
$tabfieldvalue[32]= "code,label,range_account,position,country";
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
$tabfieldvalue[33]= "code,label";
$tabfieldvalue[34]= "code,label";
@ -337,7 +337,7 @@ $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
$tabfieldinsert[29]= "code,label,percent,position";
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
$tabfieldinsert[31]= "pcg_version,fk_pays,label";
$tabfieldinsert[32]= "code,label,range_account,position,fk_country";
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
$tabfieldinsert[33]= "code,label";
$tabfieldinsert[34]= "code,label";
@ -524,6 +524,7 @@ if ($id == 11)
'propal' => $langs->trans('Proposal'),
'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'),
'resource' => $langs->trans('Resource'),
// 'facture_fourn' => $langs->trans('SupplierBill'),
'fichinter' => $langs->trans('InterventionCard')
);
@ -585,6 +586,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue;
if ($value == 'formula' && empty($_POST['formula'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='')
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
)
@ -605,6 +607,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
@ -999,6 +1002,9 @@ if ($id)
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
if ($id == 2) // Special cas for state page
{
@ -1167,6 +1173,9 @@ if ($id)
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
// Affiche nom du champ
if ($showfield)
@ -1248,7 +1257,7 @@ if ($id)
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
}
}
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
$valuetoshow=yn($valuetoshow);
$align="center";
}
@ -1618,7 +1627,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print 'user<input type="hidden" name="type" value="user">';
print '</td>';
}
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
print '<td>';
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
print '</td>';
@ -1697,7 +1706,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
if ($fieldlist[$field]=='position') $size='size="4" ';
if ($fieldlist[$field]=='libelle') $size='centpercent';
if ($fieldlist[$field]=='tracking') $class='centpercent';
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@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
@ -26,6 +26,7 @@ require '../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
$langs->load("admin");
$langs->load("loan");
@ -76,6 +77,7 @@ if ($action == 'update')
llxHeader();
$form = new Form($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup');
@ -104,7 +106,14 @@ foreach ($list as $key)
// Value
print '<td>';
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
if (! empty($conf->accounting->enabled))
{
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
}
else
{
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
}
print '</td></tr>';
}

View File

@ -75,6 +75,7 @@ if ($action == 'update')
$menu->perms=$_POST['perms'];
$menu->target=$_POST['target'];
$menu->user=$_POST['user'];
$menu->fk_menu=$_POST['fk_menu'];
$result=$menu->update($user);
if ($result > 0)
{
@ -275,6 +276,8 @@ if ($action == 'create')
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
dol_fiche_head();
print '<table class="border" width="100%">';
// Id
@ -368,8 +371,10 @@ if ($action == 'create')
print '</table>';
dol_fiche_end();
// Boutons
print '<br><div class="center">';
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
@ -387,6 +392,8 @@ elseif ($action == 'edit')
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
print '<input type="hidden" name="menuId" value="'.$_GET['menuId'].'">';
dol_fiche_head();
print '<table class="border" width="100%">';
$menu = new Menubase($db);
@ -416,9 +423,9 @@ elseif ($action == 'edit')
// MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
print '<td><input type="text" name="fk_menu" value="'.$menu->fk_menu.'" size=10></td>';
//$menu_handler
//print '<td><input type="text" size="50" name="handler" value="all"></td>';
print '<td>'.$menu->fk_menu.'</td>';
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
// Niveau
@ -454,8 +461,10 @@ elseif ($action == 'edit')
print '</table>';
dol_fiche_end();
// Bouton
print '<br><div class="center">';
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';

View File

@ -262,7 +262,7 @@ print '</form>';
print '<br>';
print '<table class="border" width="100%">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TreeMenuPersonalized").'</td>';

View File

@ -116,16 +116,13 @@ class DolibarrApiAccess implements iAuthenticate
else
{
throw new RestException(401, "Failed to login to API. No parameter 'api_key' provided");
//dol_syslog("Failed to login to API. No parameter key provided", LOG_DEBUG);
//return false;
}
$userClass::setCacheIdentifier(static::$role);
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
$requirefortest = static::$requires;
if (! is_array($requirefortest)) $requirefortest=explode(',',$requirefortest);
return in_array(static::$role, (array) static::$requirefortest) || static::$role == 'admin';
$userClass::setCacheIdentifier(static::$role);
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
$requirefortest = static::$requires;
if (! is_array($requirefortest)) $requirefortest=explode(',',$requirefortest);
return in_array(static::$role, (array) $requirefortest) || static::$role == 'admin';
}
/**

View File

@ -384,7 +384,7 @@ print '</div>';
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' &nbsp; ';
print '<br>';
print '<div class="showforthirdpartyselector">';
print $form->select_company(GETPOST('socid'), 'socid', '', 1, 0, 0, array(), 0, 'minwidth300');
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
print '</div>';

View File

@ -937,7 +937,7 @@ if ($id > 0)
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
// Type of event
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@ -951,7 +951,7 @@ if ($id > 0)
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$object->label.'"></td></tr>';
// Full day event
print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
// Date start
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td colspan="3">';
@ -1090,7 +1090,7 @@ if ($id > 0)
// Thirdparty - Contact
if ($conf->societe->enabled)
{
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
print '<td>';
print '<div class="maxwidth200onsmartphone">';
$events=array();
@ -1115,7 +1115,7 @@ if ($id > 0)
$langs->load("projects");
print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
if ($numprojet==0)
{
@ -1125,7 +1125,7 @@ if ($id > 0)
}
// Priority
print '<tr><td class="titlefield nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
print '</td></tr>';

View File

@ -360,6 +360,7 @@ $showextcals=$listofextcals;
if (! empty($conf->use_javascript_ajax)) // If javascript on
{
$s.='<!-- Div to calendars selectors -->'."\n";
$s.='<script type="text/javascript">' . "\n";
$s.='jQuery(document).ready(function () {' . "\n";
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
@ -373,7 +374,7 @@ if (! empty($conf->use_javascript_ajax)) // If javascript on
$s.='</script>' . "\n";
// Local calendar
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
$s.='<div class="nowrap clear float minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
// External calendars
if (is_array($showextcals) && count($showextcals) > 0)

View File

@ -306,10 +306,11 @@ if ($resql)
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("");
print "</tr>\n";
print '<tr class="liste_titre">';
@ -329,9 +330,12 @@ if ($resql)
print '<td class="liste_titre"></td>';
//print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '<td></td>';
// Action column
print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
$contactstatic = new Contact($db);
@ -371,7 +375,7 @@ if ($resql)
{
$labeltype=$obj->type_code;
if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype];
print '<td>'.dol_trunc($labeltype,24).'</td>';
print '<td>'.dol_trunc($labeltype,28).'</td>';
}
// Start date
@ -397,7 +401,7 @@ if ($resql)
$societestatic->id=$obj->socid;
$societestatic->client=$obj->client;
$societestatic->name=$obj->societe;
print $societestatic->getNomUrl(1,'',10);
print $societestatic->getNomUrl(1,'',28);
}
else print '&nbsp;';
print '</td>';
@ -409,7 +413,7 @@ if ($resql)
$contactstatic->lastname=$obj->lastname;
$contactstatic->firstname=$obj->firstname;
$contactstatic->id=$obj->fk_contact;
print $contactstatic->getNomUrl(1,'',10);
print $contactstatic->getNomUrl(1,'',28);
}
else
{
@ -430,6 +434,8 @@ if ($resql)
// Status/Percent
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}

View File

@ -420,7 +420,7 @@ if ($filtert > 0 || $usergroup > 0)
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
//print $sql;
dol_syslog("comm/action/index.php", LOG_DEBUG);
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
@ -703,7 +703,9 @@ foreach ($usernames as $username)
{
$var = ! $var;
echo "<tr>";
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">' . $username->getNomUrl(1). '</td>';
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">';
print $username->getNomUrl(-1,'',0,0,24,1,'');
print '</td>';
$tmpday = $sav;
// Lopp on each day of week

View File

@ -112,7 +112,7 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
$i = 0;
print '<table class="noborder" width="100%">';

View File

@ -970,7 +970,7 @@ if ($id > 0)
if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1)
{
$langs->load("propal");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a></div>';
}
if (! empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status==1)

View File

@ -87,6 +87,11 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$listofsearchfields['search_customer_order']=array('text'=>'CustomerOrder');
}
// Search supplier proposal
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
{
$listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
}
// Search supplier order
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
@ -100,12 +105,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
// Search contract
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$listofsearchfields['search_contract']=array('text'=>'Contrat');
}
// Search supplier proposal
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
{
$listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
$listofsearchfields['search_contract']=array('text'=>'Contract');
}
if (count($listofsearchfields))

View File

@ -27,11 +27,11 @@
*/
/**
* \file htdocs/comm/propal.php
* \file htdocs/comm/propal/card.php
* \ingroup propale
* \brief Page of commercial proposals card and list
*/
require '../main.inc.php';
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formpropal.class.php';
@ -2062,7 +2062,7 @@ if ($action == 'create')
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td align="right">';
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';

View File

@ -2816,10 +2816,10 @@ class Propal extends CommonObject
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') {
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'compta') { // deprecated
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'expedition') {
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;

View File

@ -54,7 +54,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
if (! empty($conf->propal->enabled))
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">';
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/card.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>';
@ -142,7 +142,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
$obj = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
print '</td><td align="right">';
print price($obj->price);
print "</td></tr>";

View File

@ -2587,12 +2587,8 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
// print '<table width="100%"><tr><td width="50%" valign="top">';
// print '<a name="builddoc"></a>'; // ancre
/*
* Documents generes
*/
// Documents
$comref = dol_sanitizeFileName($object->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref . '/' . $comref . '.pdf';
@ -2611,14 +2607,12 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// print '</td><td valign="top" width="50%">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'order', $socid);
// print '</td></tr></table>';
print '</div></div></div>';
}

View File

@ -207,9 +207,9 @@ class CommandeApi extends DolibarrApi
*/
function post($request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
}
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -224,7 +224,7 @@ class CommandeApi extends DolibarrApi
$this->commande->lines = $lines;
}
if(! $this->commande->create(DolibarrApiAccess::$user) ) {
throw new RestException(401);
throw new RestException(500, "Error while creating order");
}
return $this->commande->id;

View File

@ -9,6 +9,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -2516,7 +2517,7 @@ class Commande extends CommonOrder
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null)
{
global $conf, $mysoc;
global $conf, $mysoc, $langs;
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -2585,6 +2586,26 @@ class Commande extends CommonOrder
$line = new OrderLine($this->db);
$line->fetch($rowid);
if (!empty($line->fk_product))
{
$product=new Product($this->db);
$result=$product->fetch($line->fk_product);
$product_type=$product->type;
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough');
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback();
unset($_POST['productid']);
unset($_POST['tva_tx']);
unset($_POST['price_ht']);
unset($_POST['qty']);
unset($_POST['buying_price']);
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
}
}
$staticline = clone $line;
$line->oldline = $staticline;

View File

@ -673,6 +673,12 @@ if ($resql)
$var=!$var;
print '<tr '.$bc[$var].'>';
$notshippable=0;
$warning = 0;
$text_info='';
$text_warning='';
$nbprod=0;
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td class="nowrap">';
@ -694,17 +700,11 @@ if ($resql)
print '</td>';
// Show shippable Icon (create subloop, so may be slow)
if ($conf->stock->enabled)
if ($conf->stock->enabled)
{
$langs->load("stocks");
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
{
$notshippable=0;
$warning = 0;
$text_info='';
$text_warning='';
$nbprod=0;
$langs->load("stocks");
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
{
$numlines = count($generic_commande->lines); // Loop on each line of order
for ($lig=0; $lig < $numlines; $lig++)
{
@ -712,17 +712,19 @@ if ($resql)
{
$nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
// Get local and virtual stock and store it into cache
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
$generic_product->load_stock();
$generic_product->load_virtual_stock();
$generic_product->load_stock('nobatch');
//$generic_product->load_virtual_stock(); Already included into load_stock
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
$productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
} else {
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
}
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code is when this option is not set, setting it create strange result
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
{
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
$text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel;
@ -795,7 +797,7 @@ if ($resql)
{
print $form->textwithtooltip('',$text_info,2,1,$text_icon,'',2);
}
if ($warning) {
if ($warning) { // Always false in default mode
print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').'<br>'.$text_warning, 2, 1, img_picto('', 'error'),'',2);
}
print '</td>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
*
@ -34,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
$langs->load("banks");
$langs->load("bills");
@ -675,7 +675,13 @@ else
print '<table class="border" width="100%">';
// Accountancy code
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3">'.length_accountg($account->account_number).'</td></tr>';
print '<td colspan="3">';
if (! empty($conf->accounting->enabled)) {
print length_accountg($account->account_number).'</td></tr>';
} else {
print $account->account_number;
}
print '</td></tr>';
// Accountancy journal
if (! empty($conf->accounting->enabled))

View File

@ -7,6 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -1100,15 +1101,19 @@ class Account extends CommonObject
*/
public static function countAccountToReconcile()
{
global $db, $conf, $langs;
if ($user->societe_id) return 0; // protection pour eviter appel par utilisateur externe
global $db, $conf, $user;
//Protection against external users
if ($user->societe_id) {
return 0;
}
$nb=0;
$sql = "SELECT COUNT(ba.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE ba.rappro > 0 and ba.clos = 0";
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
if (empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) $sql.= " AND ba.courant != 2";
$resql=$db->query($sql);
if ($resql)

View File

@ -83,6 +83,7 @@ $search_montant_ht = GETPOST('search_montant_ht', 'alpha');
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
$origin = GETPOST('origin', 'alpha');
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
$fac_rec=GETPOST('fac_rec','int');
// PDF
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
@ -126,8 +127,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
if ($cancel) $action='';
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@ -672,7 +673,7 @@ if (empty($reshook))
/*
* Insert new invoice in database
*/
*/
else if ($action == 'add' && $user->rights->facture->creer)
{
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
@ -722,7 +723,7 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
// Proprietes particulieres a facture de remplacement
$object->fk_facture_source = $_POST['fac_replacement'];
$object->type = Facture::TYPE_REPLACEMENT;
@ -868,6 +869,15 @@ if (empty($reshook))
$object->ref_client = $_POST['ref_client'];
$object->ref_int = $_POST['ref_int'];
$object->modelpdf = $_POST['model'];
$object->fk_project = $_POST['projectid'];
$object->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']);
$object->mode_reglement_id = $_POST['mode_reglement_id'];
$object->fk_account = GETPOST('fk_account', 'int');
$object->amount = $_POST['amount'];
$object->remise_absolue = $_POST['remise_absolue'];
$object->remise_percent = $_POST['remise_percent'];
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
@ -2073,8 +2083,9 @@ if ($action == 'create')
$(document).ready(function() {
$("#socid").change(function() {
var socid = $(this).val();
var fac_rec = $(\'#fac_rec\').val();
// reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid;
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&fac_rec="+fac_rec;
});
});
</script>';
@ -2089,6 +2100,8 @@ if ($action == 'create')
$invoice_predefined = new FactureRec($db);
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
@ -2102,7 +2115,7 @@ if ($action == 'create')
if ($num > 0)
{
print '<tr><td>' . $langs->trans('CreateFromRepeatableInvoice') . '</td><td>';
print '<select class="flat" name="fac_rec">';
print '<select class="flat" id="fac_rec" name="fac_rec">';
print '<option value="0" selected></option>';
while ($i < $num)
{
@ -2113,7 +2126,22 @@ if ($action == 'create')
print '>' . $objp->titre . ' (' . price($objp->total_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
$i ++;
}
print '</select></td></tr>';
print '</select>';
// Option to reload page to retrieve customer informations. Note, this clear other input
if (!empty($conf->global->RELOAD_PAGE_ON_TEMPLATE_CHANGE))
{
print '<script type="text/javascript">
$(document).ready(function() {
$("#fac_rec").change(function() {
var fac_rec = $(this).val();
var socid = $(\'#socid\').val();
// reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&fac_rec="+fac_rec;
});
});
</script>';
}
print '</td></tr>';
}
$db->free($resql);
} else {
@ -2329,6 +2357,15 @@ if ($action == 'create')
}
}
// Template invoice
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" id="radio_template" value="0" disabled> ';
$text = $tmp.$langs->trans("RepeatableInvoice") . ' ';
//$text.= '('.$langs->trans("YouMustCreateStandardInvoiceFirst").') ';
$desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
print '</div>';
print '</td></tr>';
@ -2384,7 +2421,7 @@ if ($action == 'create')
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>';
}

View File

@ -53,7 +53,7 @@ class FactureRec extends CommonInvoice
var $propalid;
var $date_last_gen;
var $next_gen;
var $date_when;
var $nb_gen_done;
var $nb_gen_max;
@ -341,6 +341,17 @@ class FactureRec extends CommonInvoice
}
/**
* Create an array of invoice lines
*
* @return int >0 if OK, <0 if KO
*/
function getLinesArray()
{
return $this->fetch_lines();
}
/**
* Recupere les lignes de factures predefinies dans this->lines
*
@ -348,17 +359,24 @@ class FactureRec extends CommonInvoice
*/
function fetch_lines()
{
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.price, l.qty, l.tva_tx, ';
$this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
$sql.= ' l.remise, l.remise_percent, l.subprice,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
//$sql.= ' l.situation_percent, l.fk_prev_id,';
//$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,';
//$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' l.fk_unit, l.fk_contract_line,';
//$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= ' WHERE l.fk_facture = '.$this->id;
dol_syslog('Facture::fetch_lines', LOG_DEBUG);
$sql.= ' ORDER BY l.rang';
dol_syslog('FactureRec::fetch_lines', LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
@ -369,10 +387,13 @@ class FactureRec extends CommonInvoice
$objp = $this->db->fetch_object($result);
$line = new FactureLigne($this->db);
$line->id = $objp->rowid;
$line->rowid = $objp->rowid;
$line->label = $objp->custom_label; // Label line
$line->desc = $objp->description; // Description line
$line->description = $objp->description; // Description line
$line->product_type = $objp->product_type; // Type of line
$line->ref = $objp->product_ref; // Ref product
$line->product_ref = $objp->product_ref; // Ref product
$line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label; // Label product
@ -384,10 +405,6 @@ class FactureRec extends CommonInvoice
$line->remise_percent = $objp->remise_percent;
$line->fk_remise_except = $objp->fk_remise_except;
$line->fk_product = $objp->fk_product;
$line->date_start = $objp->date_start;
$line->date_end = $objp->date_end;
$line->date_start = $objp->date_start;
$line->date_end = $objp->date_end;
$line->info_bits = $objp->info_bits;
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
@ -412,7 +429,7 @@ class FactureRec extends CommonInvoice
}
else
{
$this->error=$this->db->error();
$this->error=$this->db-lasterror();
return -3;
}
}
@ -904,3 +921,52 @@ class FactureRec extends CommonInvoice
}
}
}
/**
* Class to manage invoice lines of templates.
* Saved into database table llx_facturedet_rec
*/
class FactureLigneRec extends CommonInvoiceLine
{
/**
* Delete line in database
*
* @return int <0 if KO, >0 if OK
*/
function delete()
{
global $conf,$langs,$user;
$error=0;
$this->db->begin();
// Call trigger
/*$result=$this->call_trigger('LINEBILLREC_DELETE',$user);
if ($result < 0)
{
$this->db->rollback();
return -1;
}*/
// End call triggers
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE rowid = ".($this->rowid > 0 ? $this->rowid : $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($this->db->query($sql) )
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->error()." sql=".$sql;
$this->db->rollback();
return -1;
}
}
}

View File

@ -14,6 +14,7 @@
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -280,24 +281,27 @@ class Facture extends CommonInvoice
$this->socid = $_facrec->socid;
$this->fk_project = $_facrec->fk_project;
$this->fk_account = $_facrec->fk_account;
$this->cond_reglement_id = $_facrec->cond_reglement_id;
$this->mode_reglement_id = $_facrec->mode_reglement_id;
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
$this->note_private = GETPOST('note_private') ? GETPOST('note_private') : $_facrec->note_private;
$this->modelpdf = GETPOST('model') ? GETPOST('model') : $_facrec->modelpdf;
$this->cond_reglement_id = GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $_facrec->cond_reglement_id;
$this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id;
$this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account;
// Fields always coming from template
$this->remise_absolue = $_facrec->remise_absolue;
$this->remise_percent = $_facrec->remise_percent;
$this->fk_incoterms = $_facrec->fk_incoterms;
$this->location_incoterms= $_facrec->location_incoterms;
$this->note_public = $_facrec->note_public;
$this->note_private = $_facrec->note_private;
// Clean parameters
if (! $this->type) $this->type = self::TYPE_STANDARD;
$this->ref_client=trim($this->ref_client);
$this->note_public=trim($this->note_public);
$this->note_private=trim($this->note_private);
$this->note_private=dol_concatdesc($facture->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
$this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
//if (! $this->remise) $this->remise = 0;
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
@ -2537,6 +2541,19 @@ class Facture extends CommonInvoice
$line = new FactureLigne($this->db);
$line->fetch($rowid);
if (!empty($line->fk_product))
{
$product=new Product($this->db);
$result=$product->fetch($line->fk_product);
$product_type=$product->type;
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) {
$this->error=$langs->trans('ErrorStockIsNotEnough');
$this->db->rollback();
return -3;
}
}
$staticline = clone $line;
$line->oldline = $staticline;

File diff suppressed because it is too large Load Diff

View File

@ -153,6 +153,7 @@ $arrayfields=array(
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0),
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
@ -694,7 +695,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total', $search_montant_vat, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status);
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
@ -997,6 +998,7 @@ if ($resql)
if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'rtp','',$param,'align="right"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -1117,6 +1119,11 @@ if ($resql)
print '<td class="liste_titre" align="right">';
print '</td>';
}
if (! empty($arrayfields['rtp']['checked']))
{
print '<td class="liste_titre" align="right">';
print '</td>';
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -1195,6 +1202,7 @@ if ($resql)
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
$paiement = $facturestatic->getSommePaiement();
$remaintopay = $obj->total_ttc - $paiement;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
@ -1347,6 +1355,14 @@ if ($resql)
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
$totalarray['totalam'] += $paiement;
}
if (! empty($arrayfields['rtp']['checked']))
{
print '<td align="right">'.(! empty($remaintopay)?price($remaintopay,0,$langs):'&nbsp;').'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
$totalarray['totalrtp'] += $remaintopay;
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -1425,6 +1441,7 @@ if ($resql)
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalamfield'] == $i) print '<td align="right">'.price($totalarray['totalam']).'</td>';
elseif ($totalarray['totalrtpfield'] == $i) print '<td align="right">'.price($totalarray['totalrtp']).'</td>';
else print '<td></td>';
}
print '</tr>';

View File

@ -382,7 +382,7 @@ print '</tr>';
* Charges sociales non deductibles
*/
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 0)</td></tr>';
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{
@ -456,7 +456,7 @@ print '</tr>';
* Charges sociales deductibles
*/
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 1)</td></tr>';
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{

View File

@ -181,6 +181,8 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
// SQL request
$catotal=0;
$catotal_ht=0;
$qtytotal=0;
if ($modecompta == 'CREANCES-DETTES')
{
@ -401,6 +403,8 @@ if ($modecompta == 'CREANCES-DETTES')
// Total
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($qtytotal).'</td>';
print '<td>&nbsp;</td>';
print '<td align="right">'.price($catotal_ht).'</td>';
print '<td align="right">'.price($catotal).'</td>';
print '<td>&nbsp;</td>';

View File

@ -107,6 +107,47 @@ class Contact extends CommonObject
$this->db = $db;
$this->statut = 1; // By default, status is enabled
}
/**
* Load indicators into this->nb for board
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{
global $user;
$this->nb=array();
$clause = "WHERE";
$sql = "SELECT count(sp.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$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.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')';
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
$this->nb["contacts"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
{
dol_print_error($this->db);
$this->error=$this->db->lasterror();
return -1;
}
}
/**
* Add a contact into database

View File

@ -236,8 +236,6 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
// Show box title
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']))
{
//$out.= '<div id="boxto_'.$this->box_id.'_title">'."\n";
//$out.= '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
$out.= '<tr class="box_titre">';
$out.= '<td';
if ($nbcol > 0) { $out.= ' colspan="'.$nbcol.'"'; }
@ -268,14 +266,11 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
}
$out.= '</td>';
$out.= "</tr>\n";
//$out.= "</table>\n";
//$out.= "</div>\n";
}
// Show box lines
if ($nblines)
{
//$out.= '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
// Loop on each record
for ($i=0, $n=$nblines; $i < $n; $i++)
{

View File

@ -3236,8 +3236,9 @@ abstract class CommonObject
*/
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
{
global $conf, $hookmanager, $inputalsopricewithtax, $usemargins, $langs, $user;
global $conf, $hookmanager, $langs, $user;
global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
// Define usemargins
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element,array('facture','propal','commande'))) $usemargins=1;
@ -3365,7 +3366,8 @@ abstract class CommonObject
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
{
global $conf,$langs,$user,$object,$hookmanager;
global $form,$bc,$bcdd, $object_rights;
global $form,$bc,$bcdd;
global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
$object_rights = $this->getRights();
@ -4458,7 +4460,10 @@ abstract class CommonObject
{
global $user;
return $user->rights->{$this->element};
$element = $this->element;
if ($element == 'facturerec') $element='facture';
return $user->rights->{$element};
}
/**
@ -4555,7 +4560,7 @@ abstract class CommonObject
$productFournisseur = new ProductFournisseur($this->db);
if (($result = $productFournisseur->find_min_price_product_fournisseur($fk_product)) > 0)
{
$buyPrice = $productFournisseur->fourn_price;
$buyPrice = $productFournisseur->fourn_unitprice;
}
else if ($result < 0)
{

View File

@ -2057,17 +2057,27 @@ class Form
{
global $langs,$conf;
global $price_level, $status, $finished;
$selected_input_value='';
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
{
if ($selected > 0)
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$producttmpselect = new Product($this->db);
$producttmpselect->fetch($selected);
$selected_input_value=$producttmpselect->ref;
unset($producttmpselect);
}
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
{
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
}
// mode=2 means suppliers products
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished;
print ajax_autocompleter('', $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'">';
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'">';
}
else
{
@ -2089,7 +2099,7 @@ class Form
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param string $filtre Pour filtre sql
* @param string $filterkey Filtre des produits
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request)
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit of line number
* @return array Array of keys for json
@ -2106,7 +2116,7 @@ class Form
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
$sql.= " pfp.supplier_reputation";
$sql.= " pfp.supplier_reputation";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
@ -2390,10 +2400,10 @@ class Form
$form.= $opt;
$i++;
}
$form.= '</select>';
$this->db->free($result);
}
$form.= '</select>';
$this->db->free($result);
return $form;
}
else
@ -4205,7 +4215,7 @@ class Form
$code_country="'".$societe_vendeuse->country_code."'";
}
else
{
{
$code_country="'".$mysoc->country_code."'"; // Pour compatibilite ascendente
}
if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on
@ -4243,8 +4253,9 @@ class Form
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
{
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
$tmpthirdparty=new Societe($this->db);
$defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
$defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
if (empty($defaulttx)) $defaultnpr=0;
}

View File

@ -515,7 +515,7 @@ class FormFile
$arraykeys=array_keys($modellist);
$modelselected=$arraykeys[0];
}
$out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', '');
$out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out.= ajax_combobox('model');
}
else

View File

@ -805,6 +805,7 @@ class FormOther
$select_week .= '<option value="'.$key.'">';
}
$select_week .= $val;
$select_week .= '</option>';
}
$select_week .= '</select>';
return $select_week;
@ -844,6 +845,7 @@ class FormOther
$select_month .= '<option value="'.$key.'">';
}
$select_month .= $val;
$select_month .= '</option>';
}
$select_month .= '</select>';
return $select_month;

View File

@ -311,7 +311,7 @@ class Notify
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref);
break;
case 'PROPAL_VALIDATE':
$link='/comm/propal.php?id='.$object->id;
$link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->dir_output;
$object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
@ -470,7 +470,7 @@ class Notify
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref);
break;
case 'PROPAL_VALIDATE':
$link='/comm/propal.php?id='.$object->id;
$link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->dir_output;
$object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);

View File

@ -346,7 +346,8 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
'DB_ERROR_NO_INDEX_TO_DROP',
'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante
'DB_ERROR_CANT_DROP_PRIMARY_KEY',
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS'
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
'DB_ERROR_22P02'
);
if ($okerror == 'none') $okerrors=array();
@ -928,7 +929,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; }
if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; }
if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; }
if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort)
{
print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';

View File

@ -65,7 +65,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<div class="fichecenter">';
if (! empty($conf->browser->phone)) print '<div class="fichehalfleft">';
else print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap borderright">';
else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
print '<table class="nobordernopadding">';
@ -74,7 +74,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<tr>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("ActionsToDoBy").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
print '</td><td class="maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
@ -95,14 +95,6 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
}
print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), 0, $multiselect);
print '</td></tr>';
// Status
print '<tr>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("Status");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
print '</td></tr>';
}
if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
@ -128,6 +120,17 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '</td></tr>';
}
if ($canedit)
{
// Status
print '<tr>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("Status");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
print '</td></tr>';
}
if ($canedit && $action == 'show_peruser')
{
// Filter on hours

View File

@ -136,7 +136,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
minLength: '.$minLength.',
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element
if (options.option_disabled) {
if (ui.item.disabled) {
@ -179,7 +180,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}
});
}
console.log("ajax_autocompleter new value selected, we trigger change on original component");
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}
,delay: 500
@ -290,14 +291,15 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt
needtotrigger="#" + fields[i];
}
}
}
if (needtotrigger != "") // To force select2 to refresh visible content
{
// We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done
// This is required for example when changing zip with autocomplete that change the country
jQuery(needtotrigger).delay(500).queue(function() {
jQuery(needtotrigger).trigger("change");
});
if (needtotrigger != "") // To force select2 to refresh visible content
{
// We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done
// This is required for example when changing zip with autocomplete that change the country
jQuery(needtotrigger).delay(500).queue(function() {
jQuery(this).trigger("change");
});
}
}
}
});

View File

@ -2,6 +2,8 @@
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Gilles Poirier <glgpoirier@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
@ -67,6 +69,15 @@ function fichinter_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention');
// Tab to link resources
if ($conf->resource->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resource';
$h++;
}
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;

View File

@ -1963,6 +1963,11 @@ function getElementProperties($element_type)
$module='ficheinter';
$subelement='fichinter';
}
if ($element_type == 'dolresource') {
$classpath = 'resource/class';
$module='resource';
$subelement='dolresource';
}
$classfile = strtolower($subelement);
$classname = ucfirst($subelement);

View File

@ -38,7 +38,7 @@ function propal_prepare_head($object)
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id;
$head[$h][1] = $langs->trans('ProposalCard');
$head[$h][2] = 'comm';
$h++;

View File

@ -1,6 +1,7 @@
<?php
/* Module to manage locations, buildings, floors and rooms into Dolibarr ERP/CRM
* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Gilles Poirier <glgpoirier@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
@ -28,7 +29,7 @@
* @param Object $object Object
* @return array Array of head entries
*/
function resourcePrepareHead($object)
function resource_prepare_head($object)
{
global $langs, $conf, $user;
$h = 0;
@ -36,15 +37,50 @@ function resourcePrepareHead($object)
$head[$h][0] = dol_buildpath('/resource/card.php',1).'?id='.$object->id;
$head[$h][1] = $langs->trans("ResourceCard");
$head[$h][2] = 'resource';
$head[$h][2] = 'resource';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('Contact');
$head[$h][2] = 'contact';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'resource');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
if(!empty($object->note_private)) $nbNote++;
if(!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$h][2] = 'note';
$h++;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id;
$head[$h][1] = $langs->trans("Documents");
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
$head[$h][2] = 'documents';
$h++;
/*$head[$h][0] = DOL_URL_ROOT.'/resource/info.php?id='.$object->id;
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;*/
complete_head_from_modules($conf,$langs,$object,$head,$h,'resource', 'remove');
return $head;
}

View File

@ -127,7 +127,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Commercial - Proposals
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1100__+MAX_llx_menu__, 'commercial', 'propals', 5__+MAX_llx_menu__, '/comm/propal/index.php?leftmenu=propals', 'Prop', 0, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal.php?action=create&amp;leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/card.php?action=create&amp;leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1102__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/list.php?leftmenu=propals', 'List', 1, 'propal', '$user->rights->propale->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?leftmenu=propals&amp;viewstatut=0', 'PropalsDraft', 1, 'propal', '$user->rights->propale->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?leftmenu=propals&amp;viewstatut=1', 'PropalsOpened', 1, 'propal', '$user->rights->propale->lire', '', 2, 3, __ENTITY__);

View File

@ -692,7 +692,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$langs->load("propal");
$newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Prop"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100);
$newmenu->add("/comm/propal.php?action=create&amp;leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
$newmenu->add("/comm/propal/card.php?action=create&amp;leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
$newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire);
if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire);
if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire);

View File

@ -1009,7 +1009,12 @@ class DolibarrModules // Can not be abstract, because we need to insta
if (! $err)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, label, jobtype, classesname, objectname, methodename, command, params, note, frequency, unitfrequency, priority, status, entity, test)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, label, jobtype, classesname, objectname, methodename, command, params, note,";
if(is_int($frequency)){ $sql.= ' frequency,'; }
if(is_int($unitfrequency)){ $sql.= ' unitfrequency,'; }
if(is_int($priority)){ $sql.= ' priority,'; }
if(is_int($status)){ $sql.= ' status,'; }
$sql.= " entity, test)";
$sql.= " VALUES (";
$sql.= "'".$this->db->escape($this->rights_class)."', ";
$sql.= "'".$this->db->idate($now)."', ";
@ -1022,10 +1027,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
$sql.= ($command?"'".$this->db->escape($command)."'":"null").",";
$sql.= ($parameters?"'".$this->db->escape($parameters)."'":"null").",";
$sql.= ($comment?"'".$this->db->escape($comment)."'":"null").",";
$sql.= "'".$this->db->escape($frequency)."', ";
$sql.= "'".$this->db->escape($unitfrequency)."', ";
$sql.= "'".$this->db->escape($priority)."', ";
$sql.= "'".$this->db->escape($status)."', ";
if(is_int($frequency)){ $sql.= "'".$this->db->escape($frequency)."', "; }
if(is_int($unitfrequency)){ $sql.= "'".$this->db->escape($unitfrequency)."', "; }
if(is_int($priority)) {$sql.= "'".$this->db->escape($priority)."', ";}
if(is_int($status)){ $sql.= "'".$this->db->escape($status)."', "; }
$sql.= $conf->entity.",";
$sql.= "'".$this->db->escape($test)."'";
$sql.= ")";

View File

@ -240,7 +240,7 @@ class ExportCsv extends ModeleExports
$this->col=0;
foreach($array_selected_sorted as $code => $value)
{
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-'),'_',$code);
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
else $alias=substr($code, strpos($code, ' as ') + 4);
if (empty($alias)) dol_print_error('','Bad value for field with key='.$code.'. Try to redefine export.');

View File

@ -319,7 +319,7 @@ class ExportExcel extends ModeleExports
foreach($array_selected_sorted as $code => $value)
{
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-'),'_',$code);
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
else $alias=substr($code, strpos($code, ' as ') + 4);
if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
$newvalue=$objp->$alias;

View File

@ -215,7 +215,7 @@ class ExportTsv extends ModeleExports
$this->col=0;
foreach($array_selected_sorted as $code => $value)
{
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-'),'_',$code);
if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
else $alias=substr($code, strpos($code, ' as ') + 4);
if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');

View File

@ -164,6 +164,7 @@ class modProduct extends DolibarrModules
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('group_concat(cat.label)'=>'Categories'));
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -260,6 +260,7 @@ class modSociete extends DolibarrModules
$this->export_fields_array[$r]+=array('u.login'=>'SaleRepresentativeLogin','u.firstname'=>'SaleRepresentativeFirstname', 'u.lastname'=>'SaleRepresentativeLastname');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Text",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'List:c_departements:nom:rowid');
$this->export_TypeFields_array[$r]=array('s.nom'=>"Text",'s.status'=>"Numeric",'s.client'=>"Numeric",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.code_compta'=>"Text",'s.code_compta_fournisseur'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_private'=>"Text",'s.note_public'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','st.code'=>'List:c_stcomm:libelle:code','d.nom'=>'Text','u.login'=>'Text','u.firstname'=>'Text','u.lastname'=>'Text');
$this->export_entities_array[$r]=array('u.login'=>'user','u.firstname'=>'user','u.lastname'=>'user'); // We define here only fields that use another picto
$this->export_examplevalues_array[$r]=array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 (not a supplier) or 1 (supplier)');
$this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -54,7 +54,9 @@ $userstatic=new User($db);
<!-- BEGIN PHP TEMPLATE CONTACTS -->
<div class="tagtable centpercent noborder allwidth">
<?php if ($permission) { ?>
<?php
if ($permission) {
?>
<form class="tagtr liste_titre">
<div class="tagtd"><?php echo $langs->trans("Nature"); ?></div>
<div class="tagtd"><?php echo $langs->trans("ThirdParty"); ?></div>
@ -132,10 +134,12 @@ $userstatic=new User($db);
</div>
</form>
<?php }
} ?>
<?php
}
}
?>
<form class="tagtr liste_titre">
<form class="tagtr liste_titre formnoborder">
<div class="tagtd"><?php echo $langs->trans("Nature"); ?></div>
<div class="tagtd"><?php echo $langs->trans("ThirdParty"); ?></div>
<div class="tagtd"><?php echo $langs->trans("Users").'/'.$langs->trans("Contacts"); ?></div>

View File

@ -46,7 +46,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
// Define colspan for button Add
$colspan = 3; // Col total ht + col edit + col delete
if (in_array($object->element,array('propal', 'supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
if (in_array($object->element,array('propal', 'supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
//print $object->element;
?>
@ -360,6 +360,7 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da
'propal',
'supplier_proposal',
'facture',
'facturerec',
'invoice',
'commande',
'order',

View File

@ -30,7 +30,9 @@
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
* $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
*
* $object_rights->creer initialized from = $object->getRights()
* $disableedit, $disablemove, $disableremove
*
* $type, $text, $description, $line
*/
@ -44,7 +46,6 @@ if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
if (empty($usemargins)) $usemargins=0;
?>
<?php $coldisplay=0; ?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
@ -201,9 +202,10 @@ if (empty($usemargins)) $usemargins=0;
<?php } ?>
<?php } ?>
<?php if ($this->statut == 0 && ($object_rights->creer)) { ?>
<?php
if ($this->statut == 0 && ($object_rights->creer)) { ?>
<td class="linecoledit" align="center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2) { ?>
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
<?php } else { ?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
<?php echo img_edit(); ?>
@ -213,7 +215,7 @@ if (empty($usemargins)) $usemargins=0;
<td class="linecoldelete" align="center"><?php $coldisplay++; ?>
<?php
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
if (($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disableremove)) {
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=ask_deleteline&amp;lineid=' . $line->id . '">';
print img_delete();
print '</a>';
@ -221,7 +223,8 @@ if (empty($usemargins)) $usemargins=0;
?>
</td>
<?php if ($num > 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref)) { ?>
<?php
if ($num > 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?>
<td align="center" class="linecolmove tdlineupdown"><?php $coldisplay++; ?>
<?php if ($i > 0) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
@ -235,7 +238,7 @@ if (empty($usemargins)) $usemargins=0;
<?php } ?>
</td>
<?php } else { ?>
<td align="center"<?php echo (empty($conf->browser->phone)?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>><?php $coldisplay++; ?></td>
<td align="center"<?php echo ((empty($conf->browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php } else { ?>
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>

View File

@ -13,7 +13,7 @@ $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<input type="hidden" name="action" value="add_element_resource">';
$out .= '<input type="hidden" name="element" value="'.$element.'">';
$out .= '<input type="hidden" name="element_id" value="'.$element_id.'">';
$out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'resource' : $resource_type).'">';
$out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'dolresource' : $resource_type).'">';
// Place

View File

@ -533,6 +533,12 @@ if (empty($reshook))
$object->set_billed();
}
elseif ($action == 'classifyclosed')
{
$object->fetch($id);
$object->setClosed();
}
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails
@ -885,6 +891,7 @@ if ($action == 'create')
//ship from preselected location
$stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number
$deliverableQty=min($quantityToBeDelivered, $stock);
if ($deliverableQty < 0) $deliverableQty = 0;
if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() && is_object($product->stock_warehouse[$warehouse_id])))
{
// Quantity to send
@ -1774,16 +1781,19 @@ else if ($id || $ref)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
}
// Close
if (! empty($conf->facture->enabled) && $object->statut > 0)
{
if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed)
{
$label="Close";
$label="Close"; $paramaction='classifyclosed'; // = Transferred/Received
// Label here should be "Close" or "ClassifyBilled" if we decided to make bill on shipments instead of orders
if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) $label="ClassifyBilled";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans($label).'</a>';
if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // TODO Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close.
{
$label="ClassifyBilled";
$paramaction='classifybilled';
}
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action='.$paramaction.'">'.$langs->trans($label).'</a>';
}
}

View File

@ -664,7 +664,7 @@ class Expedition extends CommonObject
$langs->load("agenda");
// Loop on each product line to add a stock movement
// TODO possibilite d'expedier a partir d'une propale ou autre origine
// TODO in future, shipment lines may not be linked to order line
$sql = "SELECT cd.fk_product, cd.subprice,";
$sql.= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql.= " edb.rowid as edbrowid, edb.eatby, edb.sellby, edb.batch, edb.qty as edbqty, edb.fk_origin_stock";
@ -738,7 +738,7 @@ class Expedition extends CommonObject
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('SHIPPING_VALIDATE',$user);
$result=$this->call_trigger('SHIPPING_VALIDATE',$user); // TODO Add option in workflow module on this trigger to close order if sum of shipment = product to ship of order
if ($result < 0) { $error++; }
// End call triggers
}
@ -878,16 +878,14 @@ class Expedition extends CommonObject
$product=new Product($this->db);
$result=$product->fetch($fk_product);
$product_type=$product->type;
if ($entrepot_id > 0) {
$product->load_stock();
$product_stock = $product->stock_warehouse[$entrepot_id]->real;
$product->load_stock();
$product_stock = $product->stock_warehouse[$entrepot_id]->real;
}
else
{
$product_stock = $product->stock_reel;
}
else
$product_stock = $product->stock_reel;
$product_type=$product->type;
if ($product_type == 0 && $product_stock < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough');
@ -1795,11 +1793,11 @@ class Expedition extends CommonObject
}
/**
* Classify the shipping as invoiced
* Classify the shipping as closed
*
* @return int <0 if ko, >0 if ok
*/
function set_billed()
function setClosed()
{
global $conf;
@ -1809,7 +1807,32 @@ class Expedition extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
//TODO: Add option/checkbox to set order billed if 100% of order is shipped
// TODO: Add option/checkbox to set order billed if 100% of order is shipped
$this->statut=2;
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
* @return int <0 if ko, >0 if ok
*/
function set_billed()
{
global $conf;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2, billed=1'; // TODO Update only billed
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
$resql=$this->db->query($sql);
if ($resql)
{
$this->statut=2;
$this->billed=1;
return 1;

View File

@ -1625,7 +1625,7 @@ else
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON fde.fk_c_type_fees=ctf.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON fde.fk_c_type_fees=ctf.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pjt ON fde.fk_projet=pjt.rowid';
$sql.= ' WHERE fde.fk_expensereport = '.$object->id;
@ -1691,7 +1691,7 @@ else
}
print '</td>';
}
print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper($objp->type_fees_libelle)).'</td>';
print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).'</td>';
print '<td style="text-align:left;">'.$objp->comments.'</td>';
print '<td style="text-align:right;">'.vatrate($objp->vatrate,true).'</td>';
print '<td style="text-align:right;">'.price($objp->value_unit).'</td>';

View File

@ -746,7 +746,7 @@ class ExpenseReport extends CommonObject
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
$sql.= ' p.ref as ref_projet, p.title as title_projet';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON de.fk_c_type_fees = ctf.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON de.fk_c_type_fees = ctf.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON de.fk_projet = p.rowid';
$sql.= ' WHERE de.'.$this->fk_element.' = '.$this->id;
@ -776,7 +776,7 @@ class ExpenseReport extends CommonObject
$deplig->total_tva = $objp->total_tva;
$deplig->total_ttc = $objp->total_ttc;
$deplig->type_fees_code = $objp->code_type_fees;
$deplig->type_fees_code = empty($objp->code_type_fees)?'TF_OTHER':$objp->code_type_fees;
$deplig->type_fees_libelle = $objp->libelle_type_fees;
$deplig->tva_tx = $objp->tva_tx;
$deplig->vatrate = $objp->tva_tx;
@ -850,12 +850,9 @@ class ExpenseReport extends CommonObject
{
global $conf,$langs;
$this->oldref = $this->ref;
$expld_car = (empty($conf->global->NDF_EXPLODE_CHAR))?"-":$conf->global->NDF_EXPLODE_CHAR;
// Sélection du numéro de ref suivant
$ref_next = $this->getNextNumRef();
$ref_number_int = ($this->ref+1)-1;
// Sélection de la date de début de la NDF
$sql = 'SELECT date_debut';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
@ -864,21 +861,59 @@ class ExpenseReport extends CommonObject
$objp = $this->db->fetch_object($result);
$this->date_debut = $this->db->jdate($objp->date_debut);
// Création du ref_number suivant
if($ref_next)
$update_number_int = false;
// Create next ref if ref is PROVxx
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
$prefix="ER";
if (! empty($conf->global->EXPENSE_REPORT_PREFIX)) $prefix=$conf->global->EXPENSE_REPORT_PREFIX;
$this->ref = strtoupper($fuser->login).$expld_car.$prefix.$this->ref.$expld_car.dol_print_date($this->date_debut,'%y%m%d');
// Sélection du numéro de ref suivant
$ref_next = $this->getNextNumRef();
$ref_number_int = ($this->ref+1)-1;
$update_number_int = true;
// Création du ref_number suivant
if($ref_next)
{
$prefix="ER";
if (! empty($conf->global->EXPENSE_REPORT_PREFIX)) $prefix=$conf->global->EXPENSE_REPORT_PREFIX;
$this->ref = strtoupper($fuser->login).$expld_car.$prefix.$this->ref.$expld_car.dol_print_date($this->date_debut,'%y%m%d');
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// We rename directory in order to avoid losing the attachments
$oldref = dol_sanitizeFileName($this->oldref);
$newref = dol_sanitizeFileName($this->ref);
$dirsource = $conf->expensereport->dir_output.'/'.$oldref;
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
if (file_exists($dirsource))
{
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest))
{
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles=dol_dir_list($conf->expensereport->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
foreach($listoffiles as $fileentry)
{
$dirsource=$fileentry['name'];
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
$dirsource=$fileentry['path'].'/'.$dirsource;
$dirdest=$fileentry['path'].'/'.$dirdest;
@rename($dirsource, $dirdest);
}
}
}
}
if ($this->fk_statut != 2)
{
$now = dol_now();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->ref."', fk_statut = 2, fk_user_valid = ".$fuser->id.", date_valid='".$this->db->idate($now)."',";
$sql.= " ref_number_int = ".$ref_number_int;
$sql.= " SET ref = '".$this->ref."', fk_statut = 2, fk_user_valid = ".$fuser->id.", date_valid='".$this->db->idate($now)."'";
if ($update_number_int) {
$sql.= ", ref_number_int = ".$ref_number_int;
}
$sql.= ' WHERE rowid = '.$this->id;
$resql=$this->db->query($sql);
@ -1265,7 +1300,9 @@ class ExpenseReport extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " WHERE p.rowid = ".$projet_id;
$result = $this->db->query($sql);
$objp_projet = $this->db->fetch_object($result);
if ($result) {
$objp_projet = $this->db->fetch_object($result);
}
$ligne->projet_ref = $objp_projet->ref_projet;
$ligne->projet_title = $objp_projet->title_projet;

View File

@ -225,7 +225,7 @@ class Export
else $i++;
if (strpos($key, ' as ')===false) {
$newfield=$key.' as '.str_replace(array('.', '-'),'_',$key);
$newfield=$key.' as '.str_replace(array('.', '-','(',')'),'_',$key);
} else {
$newfield=$key;
}
@ -587,14 +587,14 @@ class Export
if ($this->array_export_special[$indice][$key]=='NULLIFNEG')
{
//$alias=$this->array_export_alias[$indice][$key];
$alias=str_replace(array('.', '-'),'_',$key);
$alias=str_replace(array('.', '-','(',')'),'_',$key);
if ($objp->$alias < 0) $objp->$alias='';
}
// Operation ZEROIFNEG
if ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
{
//$alias=$this->array_export_alias[$indice][$key];
$alias=str_replace(array('.', '-'),'_',$key);
$alias=str_replace(array('.', '-','(',')'),'_',$key);
if ($objp->$alias < 0) $objp->$alias='0';
}
}

View File

@ -1715,7 +1715,7 @@ else if ($id > 0 || ! empty($ref))
$langs->load("propal");
if ($object->statut < 2)
{
if ($user->rights->propal->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
if ($user->rights->propal->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddProp").'</a></div>';
}
}

View File

@ -89,6 +89,46 @@ class Fichinter extends CommonObject
$this->statuts_logo[3]='statut4';
}
/**
* Load indicators into this->nb for board
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{
global $user;
$this->nb=array();
$clause = "WHERE";
$sql = "SELECT count(fi.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as fi";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON fi.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->societe_id)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= " ".$clause." fi.entity IN (".getEntity($this->element, 1).")";
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
$this->nb["fichinters"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
return -1;
}
}
/**
* Create an intervention into data base

View File

@ -7,7 +7,7 @@
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
*
@ -694,7 +694,16 @@ class FactureFournisseur extends CommonInvoice
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (!$resql) {
$error++;
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$this->errors[] = $langs->trans('ErrorRefAlreadyExists');
} else {
$this->errors[] = "Error ".$this->db->lasterror();
}
}
if (! $error)
{

View File

@ -247,8 +247,11 @@ if (empty($reshook))
// Set supplier ref
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
{
$result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha'));
if ($result < 0) dol_print_error($db, $object->error);
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
if ($object->update() < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// payments conditions

View File

@ -225,10 +225,19 @@ if ($search_amount_all_tax != '')
$sql .= natural_search('fac.total_ttc', $search_amount_all_tax, 1);
}
if ($search_status != '')
if ($search_status != '' && $search_status>=0)
{
$sql.= " AND fac.fk_statut = ".$search_status;
}
if ($filter && $filter != -1)
{
$aFilter = explode(',', $filter);
foreach ($aFilter as $fil)
{
$filt = explode(':', $fil);
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
}
}
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -265,7 +274,7 @@ if ($resql)
if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax);
if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax);
if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
if ($search_status >= 0) $param.="&search_status=".$search_status;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -885,7 +885,7 @@ else
{
print '<div class="tabBar">';
print $error;
print '<br /><br /><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
print '</div>';
}
else
@ -994,10 +994,10 @@ else
print '<table class="border" width="100%">';
print '<tbody>';
$linkback='';
$linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php">'.$langs->trans("BackToList").'</a>';
print '<tr>';
print '<td width="25%">'.$langs->trans("Ref").'</td>';
print '<td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($cp, 'id', $linkback, 1, 'rowid', 'ref');
print '</td>';

View File

@ -1219,7 +1219,7 @@ class Holiday extends CommonObject
// List for Dolibarr users
if ($type)
{
$sql = "SELECT u.rowid, u.lastname, u.firstname";
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
@ -1250,11 +1250,15 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid;
$tab_result[$i]['name'] = $obj->lastname;
$tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname;
$tab_result[$i]['type'] = $obj->type;
$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
$tab_result[$i]['gender'] = $obj->gender;
$tab_result[$i]['status'] = $obj->statut;
$tab_result[$i]['employee'] = $obj->employee;
$tab_result[$i]['photo'] = $obj->photo;
//$tab_result[$i]['type'] = $obj->type;
//$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
$i++;
}
@ -1264,7 +1268,7 @@ class Holiday extends CommonObject
else
{
// Erreur SQL
$this->error="Error ".$this->db->lasterror();
$this->errors[]="Error ".$this->db->lasterror();
return -1;
}
}

View File

@ -181,6 +181,10 @@ if ($result < 0)
}
$listUsers = $holiday->fetchUsers(false,true);
if (is_numeric($listUsers) && $listUsers < 0)
{
setEventMessages($holiday->error, $holiday->errors, 'errors');
}
$var=true;
$i = 0;
@ -260,9 +264,13 @@ else
print '<tr '.$bc[$var].' style="height: 20px;">';
print '<td>';
$userstatic->id=$users['rowid'];
$userstatic->lastname=$users['name'];
$userstatic->lastname=$users['lastname'];
$userstatic->firstname=$users['firstname'];
print $userstatic->getNomUrl(1);
$userstatic->gender=$users['gender'];
$userstatic->photo=$users['photo'];
$userstatic->statut=$users['status'];
$userstatic->employee=$users['employee'];
print $userstatic->getNomUrl(-1);
print '</td>';
if (count($typeleaves))

View File

@ -108,12 +108,12 @@ if ($object->id)
}
print '<table class="border" width="100%">';
print '<table class="border centpercent">';
$linkback='';
$linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php">'.$langs->trans("BackToList").'</a>';
print '<tr>';
print '<td width="25%">'.$langs->trans("Ref").'</td>';
print '<td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref');
print '</td>';

View File

@ -162,6 +162,7 @@ if (empty($user->societe_id))
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
! empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
! empty($conf->adherent->enabled) && $user->rights->adherent->lire,
! empty($conf->product->enabled) && $user->rights->produit->lire,
! empty($conf->service->enabled) && $user->rights->service->lire,
@ -169,6 +170,7 @@ if (empty($user->societe_id))
! empty($conf->commande->enabled) && $user->rights->commande->lire,
! empty($conf->facture->enabled) && $user->rights->facture->lire,
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
@ -181,6 +183,7 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
DOL_DOCUMENT_ROOT."/product/class/product.class.php",
DOL_DOCUMENT_ROOT."/product/class/service.class.php",
@ -188,6 +191,7 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
@ -199,6 +203,7 @@ if (empty($user->societe_id))
'Client',
'Client',
'Fournisseur',
'Contact',
'Adherent',
'Product',
'Service',
@ -206,6 +211,7 @@ if (empty($user->societe_id))
'Commande',
'Facture',
'Contrat',
'Fichinter',
'CommandeFournisseur',
'FactureFournisseur',
'SupplierProposal',
@ -217,6 +223,7 @@ if (empty($user->societe_id))
'customers',
'prospects',
'suppliers',
'contacts',
'members',
'products',
'services',
@ -224,6 +231,7 @@ if (empty($user->societe_id))
'orders',
'invoices',
'Contracts',
'fichinters',
'supplier_orders',
'supplier_invoices',
'askprice',
@ -235,6 +243,7 @@ if (empty($user->societe_id))
'company',
'company',
'company',
'contact',
'user',
'product',
'service',
@ -243,6 +252,7 @@ if (empty($user->societe_id))
'bill',
'order',
'order',
'order',
'bill',
'propal',
'trip',
@ -253,6 +263,7 @@ if (empty($user->societe_id))
"ThirdPartyCustomersStats",
"ThirdPartyProspectsStats",
"Suppliers",
"Contacts",
"Members",
"Products",
"Services",
@ -260,6 +271,7 @@ if (empty($user->societe_id))
"CustomersOrders",
"BillsCustomers",
"Contracts",
"Interventions",
"SuppliersOrders",
"SuppliersInvoices",
"SupplierProposalShort",
@ -272,6 +284,7 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/societe/list.php?type=c',
DOL_URL_ROOT.'/societe/list.php?type=p',
DOL_URL_ROOT.'/societe/list.php?type=f',
DOL_URL_ROOT.'/contact/list.php',
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
@ -279,6 +292,7 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial',
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
DOL_URL_ROOT.'/contrat/list.php',
DOL_URL_ROOT.'/fichinter/list.php',
DOL_URL_ROOT.'/fourn/commande/list.php',
DOL_URL_ROOT.'/fourn/facture/list.php',
DOL_URL_ROOT.'/supplier_proposal/list.php',
@ -290,6 +304,7 @@ if (empty($user->societe_id))
"companies",
"prospects",
"suppliers",
"companies",
"members",
"products",
"produts",
@ -298,6 +313,7 @@ if (empty($user->societe_id))
"bills",
"supplier_proposal",
"contracts",
"interventions",
"trips",
"projects"
);

View File

@ -0,0 +1,29 @@
-- Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@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 <http://www.gnu.org/licenses/>.
--
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
--
-- Categories compte de résultat Français
--
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d\'achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);

View File

@ -36,6 +36,8 @@ ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10)
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0;
CREATE TABLE llx_product_lot (
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
@ -64,6 +66,8 @@ ALTER TABLE llx_product ADD COLUMN height_units tinyint DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
ALTER TABLE llx_product MODIFY COLUMN stock real;
CREATE TABLE llx_categorie_user
(
fk_categorie integer NOT NULL,
@ -301,19 +305,15 @@ ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_ht double(24,8) DEFAUL
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_tva double(24,8) DEFAULT 0;
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_ttc double(24,8) DEFAULT 0;
ALTER TABLE llx_paiement ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_paiement_facture ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_paiementfourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_paiementfourn_facturefourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ht double(24,8) NOT NULL;
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ht double(24,8) DEFAULT 0 NOT NULL;
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL;
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL;
ALTER TABLE llx_supplier_proposal ADD COLUMN fk_multicurrency integer;
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_code varchar(255);
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_tx double(24,8) DEFAULT 1;
@ -364,11 +364,18 @@ CREATE TABLE llx_c_accounting_category (
) ENGINE=innodb;
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE',"Ventes de marchandises", '707xxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR',"Coût d'achats marchandises vendues", '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE',"Marge commerciale", '', 0, 1, '1 + 2', '30', 1, 1);
UPDATE llx_accounting_account SET account_parent = '0' WHERE account_parent = '';
ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0;
-- VMYSQL4.1 ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0;
-- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_parent TYPE integer USING account_parent::integer;
DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque;
-- VMYSQL4.1 DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque;
-- VPGSQL8.2 DROP INDEX uk_bordereau_cheque;
ALTER TABLE llx_bordereau_cheque CHANGE COLUMN number ref VARCHAR(30) NOT NULL;
CREATE UNIQUE INDEX uk_bordereau_cheque ON llx_bordereau_cheque (ref, entity);
@ -389,3 +396,18 @@ ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price
-- Delete old deprecated field
ALTER TABLE llx_product_stock DROP COLUMN pmp;
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
ALTER TABLE llx_resource ADD COLUMN asset_number varchar(255) after ref;
ALTER TABLE llx_resource ADD COLUMN datec datetime DEFAULT NULL;
ALTER TABLE llx_resource ADD COLUMN date_valid datetime DEFAULT NULL;
ALTER TABLE llx_resource ADD COLUMN fk_user_author integer DEFAULT NULL;
ALTER TABLE llx_resource ADD COLUMN fk_user_modif integer DEFAULT NULL;
ALTER TABLE llx_resource ADD COLUMN fk_user_valid integer DEFAULT NULL;
ALTER TABLE llx_resource ADD COLUMN fk_statut smallint NOT NULL DEFAULT '0';
ALTER TABLE llx_resource ADD COLUMN import_key varchar(14);
ALTER TABLE llx_resource ADD COLUMN extraparams varchar(255);
ALTER TABLE llx_element_resources ADD COLUMN duree real; -- total duration of using ressource

View File

@ -29,7 +29,7 @@ create table llx_accounting_account
pcg_type varchar(20) NOT NULL,
pcg_subtype varchar(20) NOT NULL,
account_number varchar(32) NOT NULL,
account_parent integer, -- Hierarchic parent
account_parent integer DEFAULT 0, -- Hierarchic parent
label varchar(255) NOT NULL,
fk_accounting_category integer DEFAULT 0,
fk_user_author integer DEFAULT NULL,

View File

@ -26,6 +26,7 @@ CREATE TABLE llx_element_resources
resource_type varchar(64), -- resource or user
busy integer,
mandatory integer,
duree real, -- total duration of using ressource
fk_user_create integer,
tms timestamp
)ENGINE=innodb;

View File

@ -40,8 +40,9 @@ create table llx_expedition
fk_address integer DEFAULT NULL, -- delivery address (deprecated)
fk_shipping_method integer,
tracking_number varchar(50),
fk_statut smallint DEFAULT 0,
fk_statut smallint DEFAULT 0, -- 0 = draft, 1 = validated, 2 = billed or closed depending on WORKFLOW_BILL_ON_SHIPMENT option
billed smallint DEFAULT 0,
height float, -- height
width float, -- with
size_units integer, -- unit of all sizes (height, width, depth)

View File

@ -79,7 +79,7 @@ create table llx_product
surface_units tinyint DEFAULT NULL,
volume float DEFAULT NULL,
volume_units tinyint DEFAULT NULL,
stock integer, -- Current physical stock (dernormalized field)
stock real, -- Current physical stock (dernormalized field)
pmp double(24,8) DEFAULT 0 NOT NULL, -- To store valuation of stock calculated using average price method, for this product
fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product
lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product

View File

@ -1,5 +1,6 @@
-- Module to manage resources into Dolibarr ERP/CRM
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
-- Copyright (C) 2016 Gilles Poirier <glgpoirier@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
@ -16,12 +17,21 @@
CREATE TABLE llx_resource
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,
ref varchar(255),
description text,
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,
ref varchar(255),
asset_number varchar(255),
description text,
fk_code_type_resource varchar(32),
note_public text,
note_private text,
tms timestamp
)ENGINE=innodb;
datec datetime DEFAULT NULL,
date_valid datetime DEFAULT NULL,
fk_user_author integer DEFAULT NULL,
fk_user_modif integer DEFAULT NULL,
fk_user_valid integer DEFAULT NULL,
fk_statut smallint NOT NULL DEFAULT '0',
note_public text,
note_private text,
import_key varchar(14),
extraparams varchar(255), -- for stock other parameters with json format
tms timestamp
)ENGINE=innodb;

View File

@ -33,7 +33,7 @@ create table llx_societe_remise_except
fk_facture integer,
fk_facture_source integer,
description text NOT NULL,
multicurrency_amount_ht double(24,8) NOT NULL,
multicurrency_amount_ht double(24,8) DEFAULT 0 NOT NULL,
multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL,
multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL
)ENGINE=innodb;

View File

@ -24,8 +24,8 @@ create table llx_stock_mouvement
datem datetime, -- Date and hour of movement
fk_product integer NOT NULL, -- Id of product
batch varchar(30) DEFAULT NULL, -- Lot or serial number
eatby date DEFAULT NULL, -- Eatby date
sellby date DEFAULT NULL, -- Sellby date
eatby date DEFAULT NULL, -- Eatby date (deprecated, we should get value from batch number in table llx_product_lot)
sellby date DEFAULT NULL, -- Sellby date (deprecated, we should get value from batch number in table llx_product_lot)
fk_entrepot integer NOT NULL, -- Id warehouse
value real, -- Qty of movement
price double(24,8) DEFAULT 0, -- Entry price (used to calculate PMP, FIFO or LIFO value)

View File

@ -20,7 +20,7 @@
CREATE TABLE llx_website_page
(
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
fk_website integer,
fk_website integer NOT NULL,
pageurl varchar(16) NOT NULL,
title varchar(255),
description varchar(255),

View File

@ -199,6 +199,6 @@ OppStatusQUAL=المؤهل العلمى
OppStatusPROPO=مقترح
OppStatusNEGO=Negociation
OppStatusPENDING=بانتظار
OppStatusWIN=فاز
OppStatusWON=فاز
OppStatusLOST=ضائع
Budget=Budget

View File

@ -199,6 +199,6 @@ OppStatusQUAL=Qualification
OppStatusPROPO=Proposal
OppStatusNEGO=Negociation
OppStatusPENDING=Pending
OppStatusWIN=Won
OppStatusWON=Won
OppStatusLOST=Lost
Budget=Budget

View File

@ -199,6 +199,6 @@ OppStatusQUAL=Qualification
OppStatusPROPO=Proposal
OppStatusNEGO=Negociation
OppStatusPENDING=Pending
OppStatusWIN=Won
OppStatusWON=Won
OppStatusLOST=Lost
Budget=Budget

View File

@ -199,6 +199,6 @@ OppStatusQUAL=Qualificació
OppStatusPROPO=Pressupost
OppStatusNEGO=Negociació
OppStatusPENDING=Pendent
OppStatusWIN=Guanyat
OppStatusWON=Guanyat
OppStatusLOST=Perdut
Budget=Budget

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