@ -224,7 +224,6 @@ public class DocumentApi extends BaseHandler {
				@@ -224,7 +224,6 @@ public class DocumentApi extends BaseHandler {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}  catch  ( UmbrellaException  e )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								LOG . log ( WARNING , e ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							LOG . log ( WARNING , "Updating settings of company-customer-document combination not implemented!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							var  attachment  =  new  Attachment ( doc . number ( ) + ".pdf" , rendered . mimeType ( ) , rendered . bytes ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							var  message  =  new  Message ( user , subject , content , null , List . of ( attachment ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							var  envelope  =  new  Envelope ( message , new  User ( doc . customer ( ) . shortName ( ) , new  EmailAddress ( email ) , doc . customer ( ) . language ( ) ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -504,7 +503,10 @@ public class DocumentApi extends BaseHandler {
				@@ -504,7 +503,10 @@ public class DocumentApi extends BaseHandler {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if  ( ! ( json . has ( FIELD_ITEM_CODE )  & &  json . get ( FIELD_ITEM_CODE )  instanceof  String  itemCode ) )  throw  missingFieldException ( FIELD_ITEM_CODE ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if  ( ! ( json . has ( TITLE )  & &  json . get ( TITLE )  instanceof  String  title ) )  throw  missingFieldException ( TITLE ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if  ( ! ( json . has ( FIELD_UNIT )  & &  json . get ( FIELD_UNIT )  instanceof  String  unit ) )  throw  missingFieldException ( FIELD_UNIT ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							var  unitPrice  = json . has ( FIELD_UNIT_PRICE )  & &  json . get ( FIELD_UNIT_PRICE )  instanceof  Number  num  ?  num  :  0L ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							var  unitPrice  =  json . has ( FIELD_UNIT_PRICE )  & &  json . get ( FIELD_UNIT_PRICE )  instanceof  Number  num  ?  num  :  0L ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							try  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								unitPrice  =  db . getCustomerPrice ( doc . companyId ( ) , doc . customer ( ) . id ( ) , itemCode ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}  catch  ( UmbrellaException  ignored )  { }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							int  tax  =  json . has ( FIELD_TAX )  & &  json . get ( FIELD_TAX )  instanceof  Number  t  ?  t . intValue ( )  :  19 ;  // TODO should not be hard-coded
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							Long  timeId  =  json . has ( FIELD_TIME_ID )  & &  json . get ( FIELD_TIME_ID )  instanceof  Number  t  ?  t . longValue ( )  :  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							var  pos  =  new  Position ( doc . positions ( ) . size ( ) + 1 , itemCode , amount . doubleValue ( ) , unit , title , description , unitPrice . longValue ( ) , tax , timeId , false ) ;